SPDY与保持活动连接的http复用不同 [英] Is SPDY any different than http multiplexing over keep alive connections

查看:196
本文介绍了SPDY与保持活动连接的http复用不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTTP 1.1支持保持活动连接,直到Connection:close被发送,连接才会被关闭。

因此,如果浏览器在这种情况下firefox有网络.http.pipelining启用和network.http.pipelining.maxrequests增加的效果到底是不是一样?

我知道这些设置是被禁用的,因为对于一些网站来说,这可能会增加负载,但我认为一个简单的http头标志可以告诉浏览器可以使用多路复用,问题可以更容易地解决。

在浏览器中更改默认设置比创建一个增加复杂性的新协议更容易,尤其是在http服务器中?

解决方案

SPDY具有许多优点,超越了HTTP流水线可以提供的优势,这在 正如您在问题中提到的,并非所有服务器都能处理流水线:这不仅仅是加载,有些服务器实际上在客户端请求流水线时表现不正确。使用头来表明可以进行流水线操作已经太迟了,以至于无法获得最大的好处:在这一点上,您已经收到了第一个响应,所以虽然您可以在将来的连接中使用它,但是对于这个响应来说已经太晚了。 li>

  • SPDY使用特定于该任务的算法(有状态的并了解通常在HTTP标头中的内容)压缩标头;是的,SSL已经包含了压缩,只是用deflate压缩它们并不是那么高效。大多数HTTP请求都没有主体,只有一个简短的GET行,所以头几乎构成了整个请求:任何压缩都可以得到改进。与它们的头文件相比,许多响应也很小。

  • SPDY允许服务器发送额外的响应,而无需客户端请求它们。例如,服务器可能会在客户端有机会接收和解析HTML以确定样式表URL后,开始将CSS的原始HTML发回。这可以进一步加速页面加载,因为在请求呈现页面所需的其他资源之前,不需要客户端实际解析HTML。它还支持这个功能的带宽较小的版本,它可以暗示可能需要的资源,并允许客户端决定:例如,这允许不关心图像的客户端不打扰请求它们,但是想要显示图像的客户仍然可以使用给定的URL来请求图像,而不需要等待HTML。

  • 其他事情:请参阅William Chan的答案。


  • HTTP 1.1 supports keep alive connections, connections are not closed until "Connection: close" is sent.

    So, if the browser, in this case firefox has network.http.pipelining enabled and network.http.pipelining.maxrequests increased isn't the same effect in the end?

    I know that these settings are disabled because for some websites this could increase load but I think a simple http header flag could tell the browser that is ok tu use multiplexing and this problem can be solved easier.

    Wouldn't be easier to change default settings in browsers than invent a new protocol that increases complexity especially in the http servers?

    解决方案

    SPDY has a number of advantages that go beyond what HTTP pipelining can offer, which are described in the SPDY whitepaper:

    1. With pipelining, the server still has to return the responses one at a time in the order they were requested. This can be a problem if the client requests a resource that's dynamically generated before one that is static: the server cannot send any of the "easy" static responses until the dynamically generated one has been generated and sent. With SPDY, responses can be returned out of order or in parallel as they are generated, lowering the total time to receive all resources.
    2. As you noted in your question, not all servers are able to deal with pipelining: it's not just load, some servers actually behave incorrectly when the client requests pipelining. Using a header to indicate that it's okay to do pipelining is too late to get the maximum benefit: you are already receiving the first response at that point, so while you can use it on future connections it's already too late for this one.
    3. SPDY compresses headers using an algorithm which is specific to that task (stateful and with knowledge of what is normally in HTTP headers); while yes, SSL already includes compression, just compressing them with deflate is not as efficient. Most HTTP requests have no bodies and only a short GET line, so the headers make up virtually the entire request: any compression you can get is an improvement. Many responses are also small compared to their headers.
    4. SPDY allows servers to send back additional responses without the client asking for them. For example, a server might start sending back the CSS for a page along with the original HTML, before the client has had a chance to receive and parse the HTML to determine the stylesheet URL. This can speed up page loads even further by eliminating the need for the client to actually parse the HTML before requesting other resources needed to render the page. It also supports a less bandwidth-heavy version of this feature where it can "hint" about which resources might be needed, and allow the client to decide: this allows, for example, clients that don't care about images to not bother to request them, but clients that want to display images can still request the images using the given URLs without needing to wait for the HTML.
    5. Other things too: see William Chan's answer for even more.

    这篇关于SPDY与保持活动连接的http复用不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆