简体   繁体   English

OkHttp 会自动重用 HTTP1/1 连接吗?

[英]Does OkHttp reuse HTTP1/1 connections automatically?

My application has to send a lot of http requests to the same server.我的应用程序必须向同一台服务器发送大量 http 请求。 It may be 20 or more requests which responses should be handled as quickly as possible.可能是 20 个或更多请求,应尽快处理这些请求。 In this case I want to reuse already instantiated by first request TCP connection for all next requests cause it should dramatically improve performance.在这种情况下,我想为所有下一个请求重用第一个请求 TCP 连接已经实例化的方法,因为它应该显着提高性能。 While researching the topic I've found out that OkHttp has ConnectionPool where it stores reusable connections.在研究这个话题时,我发现 OkHttp 有 ConnectionPool 来存储可重用的连接。 It's led me to the question does OkHttp reuse HTTP1/1 connections or only HTTP2 and SPDY?这让我想到了一个问题:OkHttp 是重用 HTTP1/1 连接还是仅重用 HTTP2 和 SPDY? How OkHttp api user can change this behavior? OkHttp api 用户如何改变这种行为?

是的,默认情况下,这是更新的链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM