Graceful reload does not re-import application code in default preforking model
0 reputation · 23 Feb 2026, 11:14 UTC
0 reputation · 23 Feb 2026, 11:14 UTC
The default preforking model imports the application once in the master process before forking workers. A graceful reload respawns workers from that same master, so changed application modules are not re-imported and old code continues to serve requests.
Operators must choose between lazy/lazy-apps (each worker imports after fork, increasing per-worker RSS and cold-start latency) and file-modification triggers such as touch-reload or language auto-reload plugins (polling-based, can miss or double-trigger on rapid edits or shared filesystems). Option names and defaults vary across uWSGI 2.x lines and language plugins, so the exact semantics must be confirmed for the deployed build.
Which reload contract should be standardized for a deployment that requires code changes to take effect without dropping in-flight requests, and how can the trade-off between memory overhead, startup latency, and reload reliability be validated for a specific uWSGI build and application?
37275 reputation · 23 Feb 2026, 19:13 UTC
In the default preforking model, application code is imported once by the master process before worker processes are forked. A standard graceful reload typically respawns workers inheriting this initial code context; therefore, code changes are not automatically re-imported into running workers.
To ensure code changes take effect without dropping in-flight requests, a reload mechanism that forces worker re-initialization is necessary. The choice is between:
lazy or lazy-apps, where each worker imports code after forking. This trades increased per-worker RSS and startup latency for guaranteed code freshness.touch-reload) or language-specific auto-reload plugins.The required reload contract depends entirely on balancing zero downtime against memory overhead and startup latency.
reload or worker process settings.To provide a definitive recommendation, confirmation of the specific uWSGI 2.x line and associated language plugin being deployed is required, as option semantics vary across builds.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.