Forums

Intermittent extreme slowdowns on my web app – anything going on with the server recently?

Hi PA team,

I've been experiencing some strange performance issues with my hosted web apps over the last couple of days. Yesterday the apps were running extremely slowly (pages taking many seconds to load, almost unresponsive at times). Reloading the web app multiple times seemed to fixed it and things returned to normal... but today it's happening again.

A bit of background that might be relevant:

  • I have a scheduled task that automatically reloads the app every day by programmatically touching the WSGI file. This has worked reliably for a long time to keep things fresh without manual intervention, but I'm wondering if the repeated reloads combined with whatever is causing the slowdown might be related or exacerbating something.
  • Apps are on a paid account (12 workers)
  • No major code changes recently that would explain this
  • No obvious errors in the server/error/access logs that stand out (happy to share snippets if helpful)

Has anyone else been seeing similar slowdowns recently? Or has there been anything funky going on with one of the servers in the last day or two? (Maybe high load, disk I/O issues, or something similar?)

Any pointers on what else I could check, would be greatly appreciated. Thanks in advance for any insight!

Add some extra logging to your code to see what is actually slow for you. Is it some computation? Db query? Filesystem operation? Some external API call?

Hi fjl,

No external API calls, no heavy computations, just standard queries and filesystem operations (weasyprint). I looked through the logs and there generating PDfs using Weasyprint is taking longer than before even though it hasn't been touched in weeks. Can you tell me if I've ran out of workers at any point in the past few days?

Something like this has happened before on PA when other apps on the shared server spike load or cause transient issues — any chance of checking recent server/load balancer/MySQL host activity for my instance?

Also, incase it's helpful here are the logs after I restarted it:

2026-03-04 11:49:47 Wed Mar  4 11:49:47 2026 - *** /etc/uwsgi/www.mcdconstruction.app.ini has been touched... grace them all !!! ***
2026-03-04 11:49:47 ...gracefully killing workers...
2026-03-04 11:49:47 Gracefully killing worker 1 (pid: 3834)...
2026-03-04 11:49:47 Gracefully killing worker 2 (pid: 3837)...
2026-03-04 11:49:47 Gracefully killing worker 6 (pid: 3849)...
2026-03-04 11:49:47 Gracefully killing worker 4 (pid: 3843)...
2026-03-04 11:49:47 Gracefully killing worker 12 (pid: 3867)...
2026-03-04 11:49:47 Gracefully killing worker 9 (pid: 3858)...
2026-03-04 11:49:47 Gracefully killing worker 7 (pid: 3852)...
2026-03-04 11:49:47 Gracefully killing worker 11 (pid: 3864)...
2026-03-04 11:49:47 Gracefully killing worker 5 (pid: 3846)...
2026-03-04 11:49:47 Gracefully killing worker 8 (pid: 3855)...
2026-03-04 11:49:47 Gracefully killing worker 10 (pid: 3861)...
2026-03-04 11:49:47 Gracefully killing worker 3 (pid: 3840)...
2026-03-04 11:50:24 worker 3 buried after 37 seconds
2026-03-04 11:50:24 worker 9 buried after 37 seconds
2026-03-04 11:50:24 worker 10 buried after 37 seconds
2026-03-04 11:50:25 worker 2 buried after 38 seconds
2026-03-04 11:50:25 worker 4 buried after 38 seconds
2026-03-04 11:50:25 worker 8 buried after 38 seconds
2026-03-04 11:50:25 worker 12 buried after 38 seconds
2026-03-04 11:50:26 worker 5 buried after 39 seconds
2026-03-04 11:50:27 worker 1 buried after 40 seconds
2026-03-04 11:50:57 *** Starting uWSGI 2.0.28 (64bit) on [Wed Mar  4 11:50:28 2026] ***
2026-03-04 11:50:57 compiled with version: 11.4.0 on 16 January 2025 20:41:13
2026-03-04 11:50:57 os: Linux-6.8.0-1043-aws #45~22.04.1-Ubuntu SMP Wed Nov 12 16:16:28 UTC 2025
2026-03-04 11:50:57 nodename: green-liveweb46
2026-03-04 11:50:57 machine: x86_64
2026-03-04 11:50:57 clock source: unix
2026-03-04 11:50:57 pcre jit disabled
2026-03-04 11:50:57 detected number of CPU cores: 4
2026-03-04 11:50:57 current working directory: /home/xDev
2026-03-04 11:50:57 detected binary path: /usr/local/bin/uwsgi
2026-03-04 11:50:57 *** dumping internal routing table ***
2026-03-04 11:50:57 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
2026-03-04 11:50:57 *** end of the internal routing table ***
2026-03-04 11:50:57 chdir() to /home/xDev/
2026-03-04 11:50:57 your processes number limit is 6144
2026-03-04 11:50:57 your memory page size is 4096 bytes
2026-03-04 11:50:57 detected max file descriptor number: 123456
2026-03-04 11:50:57 building mime-types dictionary from file /etc/mime.types...
2026-03-04 11:50:57 1516 entry found
2026-03-04 11:50:57 lock engine: pthread robust mutexes
2026-03-04 11:50:57 thunder lock: disabled (you can enable it with --thunder-lock)
2026-03-04 11:50:57 uwsgi socket 0 bound to UNIX address /var/sockets/www.mcdconstruction.app/socket fd 7
2026-03-04 11:50:57 Python version: 3.12.8 (main, Jan 16 2025, 12:10:47) [GCC 11.4.0]
2026-03-04 11:50:57 PEP 405 virtualenv detected: /home/xDev/apps/...
2026-03-04 11:50:57 Set PythonHome to /home/xDev/apps/...
2026-03-04 11:50:57 Python main interpreter initialized at 0x73f6bc5fec70
2026-03-04 11:50:57 python threads support enabled
2026-03-04 11:50:57 your server socket listen backlog is limited to 100 connections
2026-03-04 11:50:57 your mercy for graceful operations on workers is 60 seconds
2026-03-04 11:50:57 setting request body buffering size to 65536 bytes
2026-03-04 11:50:57 mapped 2172664 bytes (2121 KB) for 12 cores
2026-03-04 11:50:57 *** Operational MODE: preforking ***
2026-03-04 11:50:57 initialized 214 metrics
2026-03-04 11:50:57 INFO     Loaded 5 event sources in 2 groups, with 3 model mappings [calendars.registry.load_event_sources:302]
2026-03-04 11:50:57 WSGI app 0 (mountpoint='') ready in 28 seconds on interpreter 0x73f6bc5fec70 pid: 1 (default app)
2026-03-04 11:50:57 *** uWSGI is running in multiple interpreter mode ***
2026-03-04 11:50:57 spawned uWSGI master process (pid: 1)
2026-03-04 11:50:57 spawned uWSGI worker 1 (pid: 10647, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 1
2026-03-04 11:50:57 spawned uWSGI worker 2 (pid: 10650, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 2
2026-03-04 11:50:57 spawned uWSGI worker 3 (pid: 10653, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 3
2026-03-04 11:50:57 spawned uWSGI worker 4 (pid: 10656, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 4
2026-03-04 11:50:57 spawned uWSGI worker 5 (pid: 10659, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 5
2026-03-04 11:50:57 spawned uWSGI worker 6 (pid: 10662, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 6
2026-03-04 11:50:57 spawned uWSGI worker 7 (pid: 10665, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 7
2026-03-04 11:50:57 spawned uWSGI worker 8 (pid: 10668, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 8
2026-03-04 11:50:57 spawned uWSGI worker 9 (pid: 10671, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 9
2026-03-04 11:50:57 spawned uWSGI worker 10 (pid: 10674, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 10
2026-03-04 11:50:57 spawned uWSGI worker 11 (pid: 10677, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 11
2026-03-04 11:50:57 spawned uWSGI worker 12 (pid: 10680, cores: 1)
2026-03-04 11:50:57 metrics collector thread started
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 12
2026-03-04 11:50:57 *** Starting uWSGI 2.0.28 (64bit) on [Wed Mar  4 18:50:23 2026] ***
2026-03-04 11:50:57 compiled with version: 11.4.0 on 16 January 2025 20:41:13
2026-03-04 11:50:57 os: Linux-6.8.0-1043-aws #45~22.04.1-Ubuntu SMP Wed Nov 12 16:16:28 UTC 2025
2026-03-04 11:50:57 nodename: green-liveweb46
2026-03-04 11:50:57 machine: x86_64
2026-03-04 11:50:57 clock source: unix
2026-03-04 11:50:57 pcre jit disabled
2026-03-04 11:50:57 detected number of CPU cores: 4
2026-03-04 11:50:57 current working directory: /home/xDev
2026-03-04 11:50:57 detected binary path: /usr/local/bin/uwsgi
2026-03-04 11:50:57 *** dumping internal routing table ***
2026-03-04 11:50:57 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
2026-03-04 11:50:57 *** end of the internal routing table ***
2026-03-04 11:50:57 chdir() to /home/xDev/
2026-03-04 11:50:57 your processes number limit is 6144
2026-03-04 11:50:57 your memory page size is 4096 bytes
2026-03-04 11:50:57 detected max file descriptor number: 123456
2026-03-04 11:50:57 building mime-types dictionary from file /etc/mime.types...
2026-03-04 11:50:57 1516 entry found
2026-03-04 11:50:57 lock engine: pthread robust mutexes
2026-03-04 11:50:57 thunder lock: disabled (you can enable it with --thunder-lock)
2026-03-04 11:50:57 uwsgi socket 0 bound to UNIX address /var/sockets/www.mcdconstruction.app/socket fd 3
2026-03-04 11:50:57 Python version: 3.12.8 (main, Jan 16 2025, 12:10:47) [GCC 11.4.0]
2026-03-04 11:50:57 PEP 405 virtualenv detected: /home/xDev/apps/...
2026-03-04 11:50:57 Set PythonHome to /home/xDev/apps/...
2026-03-04 11:50:57 Python main interpreter initialized at 0x701d07a58c70
2026-03-04 11:50:57 python threads support enabled
2026-03-04 11:50:57 your server socket listen backlog is limited to 100 connections
2026-03-04 11:50:57 your mercy for graceful operations on workers is 60 seconds
2026-03-04 11:50:57 setting request body buffering size to 65536 bytes
2026-03-04 11:50:57 mapped 2172664 bytes (2121 KB) for 12 cores
2026-03-04 11:50:57 *** Operational MODE: preforking ***
2026-03-04 11:50:57 initialized 214 metrics
2026-03-04 11:50:57 INFO     Loaded 5 event sources in 2 groups, with 3 model mappings [calendars.registry.load_event_sources:302]
2026-03-04 11:50:57 WSGI app 0 (mountpoint='') ready in 29 seconds on interpreter 0x701d07a58c70 pid: 1 (default app)
2026-03-04 11:50:57 *** uWSGI is running in multiple interpreter mode ***
2026-03-04 11:50:57 gracefully (RE)spawned uWSGI master process (pid: 1)
2026-03-04 11:50:57 spawned uWSGI worker 1 (pid: 85, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 1
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 2
2026-03-04 11:50:57 spawned uWSGI worker 2 (pid: 88, cores: 1)
2026-03-04 11:50:57 spawned uWSGI worker 3 (pid: 91, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 3
2026-03-04 11:50:57 spawned uWSGI worker 4 (pid: 94, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 4
2026-03-04 11:50:57 spawned uWSGI worker 5 (pid: 97, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 5
2026-03-04 11:50:57 spawned uWSGI worker 6 (pid: 100, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 6
2026-03-04 11:50:57 spawned uWSGI worker 7 (pid: 103, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 7
2026-03-04 11:50:57 spawned uWSGI worker 8 (pid: 106, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 8
2026-03-04 11:50:57 spawned uWSGI worker 9 (pid: 109, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 9
2026-03-04 11:50:57 spawned uWSGI worker 10 (pid: 112, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 10
2026-03-04 11:50:57 spawned uWSGI worker 11 (pid: 115, cores: 1)
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 11
2026-03-04 11:50:57 spawned 2 offload threads for uWSGI worker 12
2026-03-04 11:50:57 spawned uWSGI worker 12 (pid: 118, cores: 1)

Have you added logging to see where the slow part is? See https://help.pythonanywhere.com/pages/MySiteIsSlow/

Hi Glenn,

Thanks for the link and suggestion — yes, I added detailed timing logs (using time.perf_counter() around key sections and WeasyPrint's built-in progress logging).

The slowdown was clearly inside the PDF-generating views that use WeasyPrint. The bottleneck is in the rendering/layout phase (Steps 4–6 in WeasyPrint logs).

I tracked it down to heavy use of nested flexbox layouts in style sheets -- WeasyPrint's flex implementation is known to be slow for nested/complex cases. That said, the code in that area hasn't changed in months, so I'm puzzled why the extreme slowdowns (50s+ on PA) only started recently. Since WeasyPrint is very CPU-intensive during layout, could this be related to resource contention from another app/user on the same shared server/node (green-liveweb46)?

Also, during the slow periods, did my app ever run out of available workers (or hit any queueing/backlog)? If so, that might explain why a manual or scheduled reload (touching the WSGI file) fixes it temporarily by spawning fresh workers.

Happy to share log snippets, the CSS changes, or a minimal repro if that helps the team investigate the node side.

Thanks again for the quick response!

Consider https://help.pythonanywhere.com/pages/AsyncInWebApps/

Hi fjl,

I'm aware of the PA blog post and since the "normal" speed is between 5-8 seconds, it doesn't seem to warrant creating a task queue. Since nothing changed from a code perspective, it doesn't make sense what caused the 5x slowdown.

Can you tell me:

  1. Did my app ever run out of available workers during that time?
  2. Were there any issues with PA during that time?
  3. Could this be caused by other users' apps on the same server? If so, can you confirm whether or not it's the case?

Which web app is this about?

The mcdconstruction one.

It does not look like you were running out of workers at around the time of the reload that you showed. There were no issues at around that time either. Yes, it could be caused by a noisy neighbour. However, if reloading the web app fixes it and makes it fast again, that would suggest to me that there is something going on in your web app that is causing it to slow down over time.