Closed ssankko closed 3 years ago
Thanks! @ssankko, That sounds like a good improvement. I'll implement. Would you mind doing some performance testing with the branch once done?
You can test it know from the branch in this PR
@danielSanchezQ I tested it, and it sure did speed up consecutive requests! Thanks!
Hello!
I have remote server on the other side of the globe. Simple (first) postman request to this server takes around 600ms to complete, including dns lookup and tcp handshakes.![image](https://user-images.githubusercontent.com/20635035/107624304-63d1d900-6ca6-11eb-8b82-3b01ddeb31d6.png)
Consecutive requests use cached dns and handshakes, so one request takes around 160ms.![image](https://user-images.githubusercontent.com/20635035/107624345-71875e80-6ca6-11eb-96c0-fec009098108.png)
Though, when i send identical request to localhost reverse proxy each request takes around 330ms. I guess establishing new connection each request takes its toll.![image](https://user-images.githubusercontent.com/20635035/107624371-7d732080-6ca6-11eb-9368-615f5716a8d8.png)
Using already existing
reqwest::Client
cuts time in half, resulting in around 162ms.I propose maybe use one
Client
, created lazily withlazy_static
.