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.

One of my Linux web servers recently ran out of memory, hung itself in an OOM kill frenzy, and had to be rebooted. This is a 512 MB VPS, but it has been running without problems since it was set up months ago. How can I prevent this from happening again?

I have not been able to find out from the logs which process was the cause. The processes killed were mysqld followed by apache2. Based on what's running on the box, I think it's likely that something went wrong in one of the Django applications (running under apache and mod_wsgi). Would limit the stack size (with the stack-size option to wsgi) help? Is is possible to limit wsgi or python or apache's memory usage in general? (The answers to this question say no.)

share|improve this question

1 Answer 1

Don't run your WSGI application in embedded mode with prefork MPM if you are, use daemon mode instead so number of processes limited. Read:

http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html

In version 4.0 of mod_wsgi, so long as you are using daemon mode, you can restrict memory of individual processes if operating system supports it.

share|improve this answer

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.