In some cases you may notice requests taking longer to return.
For example, you may see that a request after N amount of time returns in X amount of time, and a request that takes N+M amount of time return in X+Y amount of time. Part of the reason for this is because the connection is being broken after N+M, and the extra time accounts for the time it takes to reconnect.
This is done via the use of the keep-alive https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive header's timeout token used by the API Clients.
You may be able to override the default value for your client. For example, the default value for algoliasearch-java-net
can be overridden using jdk.httpclient.keepalive.timeout
.