Wednesday, March 30, 2011

Re: Django Web Application Cost So Many memory

Why are you using prefork MPM and running Django embedded that way.

Prefork MPM may be fine for PHP, but it is a poor solution for fat Python web applications unless you are prepared to give it the necessary memory resources and configure Apache properly specifically for that single Python web applications requirements.

If you are going to use embedded mode of Apache, then you should at least use worker MPM and then you still need to be mindful of how Apache MPM settings are configured so as to try and keep processes persistent all the time and not let Apache kill off/restart processes when it feels it needs to as the startup load will only make performance worse when you need it, ie., when load spikes.

For a discussion on why embedded mode is not always the best, especially with prefork MPM, go read:

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

If using Apache/mod_wsgi the preferred setup would be daemon mode where you can better control processes/threads independent of Apache MPM, meaning you can still use prefork MPM if you are stuck with support a PHP application on the same Apache.

Graham

On Wednesday, March 30, 2011 11:03:37 PM UTC+11, bird sky wrote:
Hello Everybody:
     I encounter a problem that my Django project, it has more than 60
app modules, and some models are very large, more than 30 fields . And
when I startup my project, regardless of in development server, fast
cgi(flup),or mod_wsgi. i found it cost at least 60M memory per
instance. I guess this has some relation with that "django will load
all models on startup" . but how can I deal with my problem? Because
if an instance cost 60M memory, when I deploy my project in prefork
web server with 100 instance, i will cost 6GB memory. I don't think
this is a normal state.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment