Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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 6: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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.