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 using Supervisor and the uWSGI Emperor mode. When I set limit-as to 512 (MB), workers die instantly (respawn, die, respawn, die, every 3/4 of a second or so):

[uwsgi]
workers = 4
threads = 40
limit-as = 512
harakiri = 20
max-requests = 1600
... non-performance/memory/processor-related settings ommitted

But, if I change limit-as to:

[uwsgi]
workers = 4
threads = 40
limit-as = 1024
harakiri = 20
max-requests = 1600
... non-performance/memory/processor-related settings ommitted

and restart uwsgi, the problem is gone immediately. In order to put a sham in this, I've modified the setting back to 512, restarted again, and the problem is back immediately.

Notes: My app is a simple Django app without much additional Python setup during start-up time.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

it looks like 512M address space is not enough for your app. If you have to respect such a limit decrease the number of threads or reduce their stacksize with thread-stack-size = 512 (512k is generally the minimal amount for a python app)

share|improve this answer
    
sorry, but i think you do not know what address space is. It has nothing to do with physical memory. Generally users find the address space consumed by their processes letting them run for some days and then they choose the limit-as value. –  roberto Dec 10 '12 at 15:38
    
Since 64bit has up to 8TB of address space, what would be considered to be a safe value when considering that I have 12GB of RAM for the server, and would like to use about half that for the application? Will setting the address space to something like 4GB for each process end up cause the setting's usefulness to diminish? –  orokusaki Dec 10 '12 at 21:36
    
there is nothing like a safe value. It is app dependent. Just as an example each one of your thread will allocate 8M of address space for their stack (that is why i previously suggested you to tune it), other modules could create memory mapped files consuming tons of address space and so on. Let your app runs and check which is a good value (if you add --memory-report to uWSGI you will get infos after each request). Instead, if you want to limit physical memory check linux cgroups. –  roberto Dec 11 '12 at 6:31
    
Thanks, roberto –  orokusaki Dec 11 '12 at 16:50

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.