What I was doing is to send keepalive requests to the server. I'm just 
wondering if there is a more graceful solution.
Anyway, thanks for your solution.













--

Best wishes!


At 2022-01-21 02:10:46, "Max Dymond" <max.dym...@microsoft.com> wrote:
>> Thanks for your reply,.<br/><br/>Yes, I don't do repeated request. Maybe 
>> come a request, then next one come an hour later. But the requests are 
>> latency concered(should be less than 50ms) . <br/><br/>If every request 
>> comes, then make a new connection to the server, the total cost of the 
>> request would probably exceed 50ms due to tcp handshake.<br/><br/>So I hope 
>> to keep the underlying connection in libcurl cache to stay as long as 
>> possible, such that once a request comes, <br/>there's a 'ready' 
>> connection(no need to establish from srcatch) to handle it.
>
>
>Are you using HTTP/2 or plain HTTP?  For HTTP/2 there's 
>https://curl.se/libcurl/c/curl_easy_upkeep.html which is designed to keep a 
>long-lived connection alive to a server by sending periodic HTTP/2 PING frames.
>
>Otherwise it sounds like you might have to configure the TCP keepalive 
>settings of the host to keep the connection alive for longer; or, write your 
>client in such a way that it periodically sends keepalive requests to the 
>server (perhaps by sending OPTIONS to the server). 
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to