Alvin
Alvin

Reputation: 2543

Django memory leak on Apache/MySQL

I have a Satchmo deployment w/ 500k products running on

Technology stacks asside (going to migrate to nginx / gunicorn / etc... over time) this site has one hell of a memory leak

the server itself is running with 16GB of memory and over time it is all being consumed by the apache process

debug is turned off

and the cache is being run through MySQL

I've googled and experimented for days without any changes other than the memory consumption has slowed down.

Any suggestions for tracking this one down?

My next step is to profile the project (not fond of the idea given the volume of dependencies in Satchmo) though I don't believe the issue is with the project itself since

  1. I've used Satchmo before without memory issues
  2. This doesn't show up on my dev machine

Upvotes: 1

Views: 914

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

How are you running mod_wsgi? Embedded mode or daemon mode? Embedded mode and prefork is a bad idea unless you have set up Apache appropriately. Read:

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

and

http://blog.dscpl.com.au/2009/11/save-on-memory-with-modwsgi-30.html

Also make sure you aren't still loading mod_python.

Not that the cause of the memory usage will jump out, but you might try a production monitoring tool like New Relic which can look at what is going on inside of your application. Both Python agent and server monitoring tools could be useful, especially historical charting as will give a better indication of what is going on over time.

Disclaimer: I work for New Relic these days on the Python agent. :-)

Upvotes: 2

Related Questions