I was debugging an issue with a Boost / Beast http client that would receive end of stream after one request, even with HTTP/1.1 and KeepAlive enabled on client and CivetWeb. Inspecting the response headers of CivetWeb, I noticed something interesting:
Connection: keep-alive
Keep-Alive: timeout=1
The configured Keep-Alive is 1 second, which is a bit short.
I thought to make a quick change in the settings, but it seems this is only configurable at build time:
Can I propose a patch to make this configurable and/or up the fixed timeout to something a bit higher? Apache uses 15 seconds, Nginx has 10 as a default.
Regarding the Stone Viewer, does that load images in the background or just On Demand ? It seems a bit slower than OHIF and some other viewers.
It loads on demand, with some prefetching for the instances that are closed to the one currently displayed. This enormously reduces the network bandwidth.
I still would like to contribute in making it configurable - given that Orthanc would usually serve a smaller pool of web and api HTTP clients (or in setups behind a reverse proxy) one might opt to set much higher values; Nginx and Apache default settings are tuned towards serving public web sites with potentially thousands of browser connections.
I have introduced a new KeepAliveTimeout configuration with a default value of 1 as it was in 1.11.2. I realized that 10 was not ideal at all e.g. when using a web-browser.
When you open the default Orthanc UI in a browser, it loads around 30 files in 30 requests.
If you refresh immediately (within a few seconds), it loads the first 20 files correctly but then, seems to wait for the end of the 10 seconds period to serve the last 10 files.
Note that, by default, there are 50 threads available in Orthanc to server HTTP requests.
So it seems that the HTTP requests are “reserved” for the whole duration of the KeepAliveTimeout period.
Do you think we should investigate that or is this an expected behaviour in HTTP ? disclaimer: I should probably read more about the HTTP protocol !.