I have switched the PyPI installation to nginx and uwsgi. The start scripts are in /etc/init.d/{nginx,pypi}; the configuration in /etc/nginx and /data/pypi/config.ini. Log files go to /log as usual. Regards, Martin
* "Martin v. Löwis" <martin@v.loewis.de>:
I have switched the PyPI installation to nginx and uwsgi. The start scripts are in /etc/init.d/{nginx,pypi}; the configuration in /etc/nginx and /data/pypi/config.ini. Log files go to /log as usual.
Out of curiosity: Why? p@rick -- Patrick Ben Koetter <patrick@python.org> Python.org Postmaster Team
Am 22.11.2011 21:56, schrieb Patrick Ben Koetter:
* "Martin v. Löwis" <martin@v.loewis.de>:
I have switched the PyPI installation to nginx and uwsgi. The start scripts are in /etc/init.d/{nginx,pypi}; the configuration in /etc/nginx and /data/pypi/config.ini. Log files go to /log as usual.
Out of curiosity: Why?
I hope that it can deal better with the overload cases that (possibly) have constantly caused outages over the last few months. Load average would occasionally go to 250, and apache spawn 2400 threads (*), in overload situations. With nginx, this shouldn't happen (IIUC), it will continue to serve files with low load even if all the PyPI processes become unresponsive. In addition, I also switched to uwsgi (primarily because it's one of nginx's supported integrations of Python apps). I found that uwsgi supports a timeout on single requests, which I set to 60s. So any PyPI request taking longer than 60s (and I think these actually happened in the past) will get killed, which should help to overcome overload situations more quickly, and to allow continuing service to "regular" users even in abuse situations. Of course, whether this actually works out, we will see. Regards, Martin (*) one may wonder: why did he set the thread limit to 2400 then? Because when I didn't, people would be locked out of PyPI, when it said that it couldn't take any additional clients, even though the CPU load was "low".
* "Martin v. Löwis" <martin@v.loewis.de>:
Am 22.11.2011 21:56, schrieb Patrick Ben Koetter:
* "Martin v. Löwis" <martin@v.loewis.de>:
I have switched the PyPI installation to nginx and uwsgi. The start scripts are in /etc/init.d/{nginx,pypi}; the configuration in /etc/nginx and /data/pypi/config.ini. Log files go to /log as usual.
Out of curiosity: Why?
I hope that it can deal better with the overload cases that (possibly) have constantly caused outages over the last few months. Load average would occasionally go to 250, and apache spawn 2400 threads (*), in overload situations. With nginx, this shouldn't happen (IIUC), it will continue to serve files with low load even if all the PyPI processes become unresponsive.
In addition, I also switched to uwsgi (primarily because it's one of nginx's supported integrations of Python apps). I found that uwsgi supports a timeout on single requests, which I set to 60s. So any PyPI request taking longer than 60s (and I think these actually happened in the past) will get killed, which should help to overcome overload situations more quickly, and to allow continuing service to "regular" users even in abuse situations.
Of course, whether this actually works out, we will see.
If a web cache helps with PyPi, we could add varnish <https://www.varnish-cache.org/>. It has been praised all over the place. Ralf and I happen to know the author. Dunno if that would open a door, but I would try if we think we need help. p@rick -- Patrick Ben Koetter <patrick@python.org> Python.org Postmaster Team
If a web cache helps with PyPi, we could add varnish <https://www.varnish-cache.org/>. It has been praised all over the place. Ralf and I happen to know the author. Dunno if that would open a door, but I would try if we think we need help.
I'm very skeptical with respect to caching. It can be a source of problems on its own. Regards, Martin
* "Martin v. Löwis" <martin@v.loewis.de>:
If a web cache helps with PyPi, we could add varnish <https://www.varnish-cache.org/>. It has been praised all over the place. Ralf and I happen to know the author. Dunno if that would open a door, but I would try if we think we need help.
I'm very skeptical with respect to caching. It can be a source of problems on its own.
Yes, it can. If we need to examine such alternatives I recommend using varnish. p@rick -- Patrick Ben Koetter <patrick@python.org> Python.org Postmaster Team
On 22/11/2011 21:49, "Martin v. Löwis" wrote:
If a web cache helps with PyPi, we could add varnish <https://www.varnish-cache.org/>. It has been praised all over the place. Ralf and I happen to know the author. Dunno if that would open a door, but I would try if we think we need help.
I'm very skeptical with respect to caching. It can be a source of problems on its own.
I would strongly advocate a Varnish cache for add read-only actions. (ie: non-auth'd views of anything). This is simply good practice when building a web app such as PyPI. cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk
participants (3)
-
"Martin v. Löwis" -
Chris Withers -
Patrick Ben Koetter