-
-
Notifications
You must be signed in to change notification settings - Fork 271
Description
I've been digging into some slow restart problems on one of our VMs using bpftrace (sometimes 60+ seconds for a full httpd restart). Along the way I noticed a possible performance issue (or at least possible improvement) with the restart of individual WSGI apps / daemon processes.
The shutdown-timeout option (default 5 seconds) on WSGIDaemonProcess seems to be a mandatory wait, rather than "wait up to N seconds until idle". The behavior is roughly:
- touch the WSGI script (application.py)
- make a request to the app, triggering a daemon process restart; apache holds connection open and browser starts waiting for response
- from tracing, I see the old daemon process PID makes a 5 second
nanosleep()syscall during which nothing happens (the app is idle and receiving no requests besides the pending test request) - the nanosleep period ends, the old daemon process shuts down, and the new one is cloned and started up
- the new daemon process handles the request
It would be nice, during #3, if the daemon process is idle (no requests), to restart immediately, rather than requiring waiting the full shutdown-timeout each time. It would be less delays for users when apps need a quick patch, less chance of secondary bugs and issues happening due to the delayed requests, etc.
Happy to share more details if it sounds like something particular to our Apache configuration.
Side note, thanks to Graham for his longtime, dedicated support (both documentation / assistance, and coding) on this excellent module. It's been sitting reliably at the foundation of our applications for years, and when I've needed it I've nearly always found the documentation, expert StackOverflow answer from him, etc. to help.