Forums

web app running 3x slower today

Is it normal for apps to run slower at different times of day or are there any pythonanywhere server issues going on that would slow down the system today? I migrated my databases from sqlite to mysql over the weekend to improve performance and was very happy with the improved page download times. As part of that I was watching closely those times. This morning I was updating a couple packages in my virtual environment and when I went to test it I noticed my page download times are 3x from yesterday. I reverted the changes and I created a new virtual environment to start from scratch and neither fixed it.

We have a bunch of tips to start with when you encounter this issue, see https://help.pythonanywhere.com/pages/MySiteIsSlow/. It's best to establish what exactly is being slow, so we can check if that corresponds to something we see in our system, or it's rather related to something else.

Thanks for the link. It was helpful. I established it is the webapp itself. I used cProfile to dig into it. It helped me identify that 80% of my problem is something with my webapp that I can easily optimize. But it also clearly shows a pattern that everything runs ~3x slower during the day than it does in the mornings and evenings. I can email you the 2 logs and it has been pretty consistent pattern over the last 3 days. I'll probably be happy as that delta will only be a couple hundred ms once I do my optimizations, but I'd still like to understand if this is expected as I build more complex and time consuming pages.

I see that your web app is often running out of available web workers. That makes your requests wait and adds to response times,

Where do you see that exactly? I've looked through the pages and forums and could not find where you can monitor that. My site is a family website. There are 3 users, 2 of which are rarely on it, and I have 3 web workers. I've looked over the access log and do not see any unusual activity that would explain why I'm running out. My understanding is one page access utilizes one web worker. If it is just me serializing my requests I do not understand how I'm running out of web workers often.

There is not really a way for you to monitor that at the moment. It's not each page access that uses a worker, it's each request.

Check your access logs for requests that are taking longer than you expect to respond and try to add logging to them as described in the help page linked above so you can see where they are spending their time when they are taking longer.