如何在 OkHttp 中优化 isHealthy() 方法,当 doExtensiveCheck 参数设置为 true 时?

huangapple go评论50阅读模式
英文:

How to optimize the isHealthy() method in OkHttp when the doExtensiveCheck parameter is set to true?

问题

我们在Java项目中使用okhttp3.14.9来发送HTTP请求,发现使用PUT/POST方法大约需要20毫秒,而GET方法只需要2毫秒,两者的请求主体都为空。有人能帮忙吗?

我发现根本原因是doExtensiveCheck参数,那么如何优化这个?

英文:

We ues okhttp3.14.9 to send http requests in java project,and we found that put/post method took about 20ms while get just took 2ms,both requestbody is empty,anyone can help?

I found the root cause is the doExtensiveCheck parameter,so how to optimize this?

答案1

得分: 1

升级您的 OkHttp。此方法在 OkHttp 4.x 中进行了优化,不再存在这个性能问题。

英文:

Upgrade your OkHttp. This method is optimized in OkHttp 4.x and doesn’t have this performance problem.

huangapple
  • 本文由 发表于 2023年4月4日 14:32:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75926143.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定