Forums

Highly variable server response time

On most occasions the homepage request is rendered to a browser via flask in a few milliseconds. It is a very small size html render.

However, with increasing frequency, a request for the homepage hangs for 5-25 seconds.

What are the reasons this could happen?

The homepage is https://www.bessanalytics.com

There are multiple factors that can contribute to the slowness. I'd suggest having a look at this help page and follow hints to exclude some common possibilities. There could be some traffic spikes or maintenance actions related to the underlying infrastructure (but those shouldn't be frequent) -- for those, I'd look at correlations between access logs and the server log. If those hints are not enough, we'd need to have more details on the web app to investigate the issue, you could contact us via email, if you'd prefer.

Self evidently, if 75% of the requests are served within. 30ms, but some take from 5s up to 35s, it ought not to be the code.

There are no changes to what is served except overnight at 2am when the db updates on a scheduled task.

So doesn’t this mean it is a function of the server?

It could be related to the server business, since your code is running on a shared infrastructure. Were you able to establish where exactly the code slow-downs? (For example if the slowness happens where the code hits an external service or processes some input data, that may be an indicator of a possible cause.) Also -- does it happen often? Is there a pattern to it? Is it related with traffic spikes? Do you see any other correlation between server log and the access log?

Inspecting the logs I don't see a pattern but the issue seems to have fallen away for the time being so I will close this forum topic for now. Thank you for the input.