TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Deploying Python Without Downtime

33 pointsby philipcristianoalmost 12 years ago

3 comments

jonny5532almost 12 years ago
A neat trick with uWSGI is to dynamically set the number of worker processes to 0, which causes incoming requests to hang whilst waiting to be processed by no-longer-extant workers.<p>As long as you can apply DB migrations before the waiting requests timeout (and then set the number of workers back to something sensible) you can perform quite major upgrades without even dropping connections.
评论 #5951894 未加载
评论 #5953127 未加载
dkuebricalmost 12 years ago
One thing worth noting about these rolling restarts that I didn&#x27;t see in your post: if the new code isn&#x27;t completely backwards-compatible, you can end up with bad states from having a mix of workers running. This negates a lot of the value of the rolling restart because it creates other failure modes.<p>For example, if you introduce a new ajax endpoint in the release, and a client hits a new worker generating a HTML page that calls it, but 90% of your gunicorn workers are still serving the old version of the app, 90% chance that you&#x27;re going to 404 that request.
评论 #5952047 未加载
buttsciclesalmost 12 years ago
Rather than killing Gunicorn&#x27;s child processes, I prefer to send SIGHUP to the master process.[1]<p>It&#x27;s as simple as<p>`pkill -f --signal HUP &quot;gunicorn: master \[procname\]&quot;`<p>[1] <a href="https://gunicorn-docs.readthedocs.org/en/latest/faq.html?highlight=HUP#how-do-i-reload-my-application-in-gunicorn" rel="nofollow">https:&#x2F;&#x2F;gunicorn-docs.readthedocs.org&#x2F;en&#x2F;latest&#x2F;faq.html?hig...</a>
评论 #5951817 未加载