Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does OkHttp reuse HTTP1/1 connections automatically?

My application has to send a lot of http requests to the same server. It may be 20 or more requests which responses should be handled as quickly as possible. In this case I want to reuse already instantiated by first request TCP connection for all next requests cause it should dramatically improve performance. While researching the topic I've found out that OkHttp has ConnectionPool where it stores reusable connections. It's led me to the question does OkHttp reuse HTTP1/1 connections or only HTTP2 and SPDY? How OkHttp api user can change this behavior?

like image 944
Tymur Yarosh Avatar asked May 30 '26 18:05

Tymur Yarosh


1 Answers

Yes it does by default, and here is the updated link

like image 60
baywet Avatar answered Jun 02 '26 08:06

baywet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!