Seems like issues in any backend service accessed through proxy can cause digitransit-proxy and gateway to be filled with open connections. This issue could be mitigated to some extent by defining lower http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout values on location level. It should be researched if nginx allows more sophisticated timeout settings.
The current situation is as follows:
For OTP queries:
Finland has 30 second timeout in client (digitransit-ui) and gateway but 20 second timeout in proxy. For routing it has 20 second timeout for first each itinerary search.
Other routers have 10 second timeout in client (digitransit-ui) but 30 second in gateway and 20 second in proxy. For routing it has 5 second timeout for first itinerary, 4 second timeout for second and 2 second for each of the rest itineraries.
Client (digitransit-ui) has 10 second timeout, gateway 30 second timeout and proxy 20 second timeout.
I did couple of pull requests: and . These change non-finland OTP timeout in client to 12 second and in proxy to 11.5 seconds. Finland OTP timeout in proxy is changed to 29.5 seconds. Pelias timeout is changed to 9 seconds. Timeout for the rest of the API paths is reduced from 20 seconds to 10 seconds. Also read timeout in proxy for rest of the servers/locations is reduced from 60 seconds to 10 seconds, write timeout from 60 seconds to 10 seconds. Timeout for establishing connection is decreased from 60 seconds to 10 seconds.
We could also apply different timeouts in application gateway. However, that should be done for the gateways for the new environments.