Forum OpenACS Q&A: Re: NaviServer stops serving connections when slow external api calls pile up.

Dear Marty,

Please notice, that all time periods passed to NaviServer are in seconds if not specified differently. Calling

ns_http ... -expire 500 ...
means "expire in 8 minutes and 20 seconds". To set an expiry of half a second, one can use e.g. one of the following formats:
ns_http ... -expire 500ms ...
ns_http ... -expire 0.5s ...

Note, that there are many possible causes to endanger the liveliness of a system when depending on external services (which might take "forever", or "hang" or which might terminate on service restarts, or which might have a high variance in performance, etc.).

When you configure the HTTP client log [1] (introduced with 4.99.21) and you use a recent version of the nsstats module (checkout Bitbucket), you can get the statistics about the ns_http requests, similar to the access.log. With this you can identify certain potential bottlenecks.

When the HTTP-requests needed by your application are slow or unreliable, throwing in more cores or memory does not help. However, you can use a separate connection pool for such requests, or you have to use some background processing (like e.g. with ns_jobs).

[1] https://bitbucket.org/naviserver/naviserver/src/cdf5cb353b72e3b1560eaeb263d8dd898370634b/openacs-config.tcl#lines-640

Many thanks Gustaf!

I am glad I asked the question. We were thinking the default was in ms for some time - thanks for taking the time and pointing that out.

Also, thank you for pointing out the HTTP client log configuration - I do want to set that up to help alert us to slowness in any external API calls.

Hope your holiday season has been a great one!

Sincerely,
Marty