2

I'm running django on uwsgi using the following command

uwsgi --master --cheap --idle 60 --http-socket :8084 --wsgi-file /var/django/mysite/django.wsgi

Typically my processes sit at around 10mb each, but I have seen them sitting at around half a MB. My question is, does uwsgi drop the processes down to an even cheaper mode when the server is running out of memory? If anyone can explain exactly how --cheap and --idle work, that would be much appreciated.

Greg
  • 239
  • 1
  • 12

1 Answers1

2

From the documentation:

cheap postpone workers startup until the first request

cheaper an advanced cheap mode, this will only spawn <n> workers on startup and will use various (pluggable) algorithms to implement adaptive process spawining.

idle destroy workers (the server will go in cheap mode) after <secs> of inactivity

So basically those options reduce memory usage by only running workers when they are actually needed. The downside is slightly higher latency because workers have to be started when the request comes in.

mgorven
  • 30,615
  • 7
  • 79
  • 122
  • Thanks, I had read that in the docs but I'm mainly curious as to how my processes dropped to ~500kb. Any idea? – Greg Jun 25 '12 at 23:29
  • @Greg I would presume that there are currently no workers running then. Are all the processes like that? Is the site currently serving requests? – mgorven Jun 26 '12 at 06:13
  • Yes and yes - what I observed was all the processes were at ~500kb, but when I browsed to the site, the process for that site jumped up to the usual level of memory usage and served the request. – Greg Jun 26 '12 at 21:10