summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleafee98 <leafee98@hotmail.com>2022-05-30 11:43:59 +0800
committerleafee98 <leafee98@hotmail.com>2022-05-30 11:43:59 +0800
commitd7a38e83ca223bc6c1219635a38f91893c07cc34 (patch)
treed5bb2a17b8c9799f769ec1ec68e5c1d23298d93a
parentbb18cd72c379fe4fa826777dd0872de540bf61d5 (diff)
new essay: why upload with http2 slower than http1.1
-rw-r--r--content/essays/why-upload-with-http2-slower-than-http1.1.md19
1 files changed, 19 insertions, 0 deletions
diff --git a/content/essays/why-upload-with-http2-slower-than-http1.1.md b/content/essays/why-upload-with-http2-slower-than-http1.1.md
new file mode 100644
index 0000000..bf23e11
--- /dev/null
+++ b/content/essays/why-upload-with-http2-slower-than-http1.1.md
@@ -0,0 +1,19 @@
+---
+title: "HTTP/2 的上传速度表现劣于 HTTP/1.1 的原因"
+date: 2022-05-30T09:29:51+08:00
+tags: []
+categories: []
+weight: 50
+show_comments: true
+draft: false
+---
+
+<!--more-->
+
+在使用 Nginx 提供的 HTTP/2 实现时,有些情况下会发现上传速度不理想,甚至慢于 HTTP/1.1,这是因为 HTTP/2 相较于 HTTP/1.1 多了一个在应用层的流传输控制。
+
+HTTP/2 和 HTTP/1.1 共同基于的 TCP 也拥有流控制,TCP 的流控制的窗口大小由操作系统决定,并且影响操作系统建立的所有 TCP 连接的速率上限,此上限亦即 HTTP/1.1 的速率上限;HTTP/2 的流控制的窗口大小由对应软件如 Nginx 实现,当此窗口小于 TCP 的窗口并且具有一定的差距时,HTTP/2 的速率会受到明显影响,另一方面当 HTTP/2 的流控制窗口过大时,又会造成内存的浪费,当设定为某一个合适的值时,性能表现甚至会略微胜过 HTTP/1.1。
+
+## 参考
+
+[Delivering HTTP/2 upload speed improvements](https://blog.cloudflare.com/delivering-http-2-upload-speed-improvements/)