简体   繁体   中英

Does cloning the OkHttp client impact connection reuse?

On the OkHttp recipes under "Timeouts / Per call configuration" it says that a timeout can be set per call by cloning the client and then setting the timeout on that cloned object. Will doing this impact performance?

I'm concerned that cloning the client will interfere with its reuse of existing connections. Calls to the same server for different resources will have varying timeouts. I'm using OkHttp server side and want to maximize performance.

Cloning won't harm performance. The clone is shallow so you keep the same connection pool, cache, and other dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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