Hello, First, I'm gonna say that I have DEBUG turned off, and it's not Django's fault.
My Django sites seem to eat lots of memory. This is fine, and it isn't a huge deal except that I am using all of my VPS's memory plus swap. The real solution is to upgrade memory on the VPS, but I'm a poor college student so I want to reduce the memory footprint any way I can. I'm using mod_python and apache. I've seen discussion about mod_python specifically where it was suggested to set large variables to None when you're done with them. Django does most of the grunt work, and my views don't seem to load any very large variables. It seems like any variables instantiated by my views would go out of scope after the view function has returned, and the Python garbage collection will show up. I'm curious to know if anyone has ever tried to optimize their code to reduce the overall memory footprint. I haven't found any blog posts about it yet. I'm willing to resort to making my Django code as non-persistent as possible. My sites are all low traffic, so non-persistent processes plus memcached shouldn't be too terrible, even if I get slashdotted. I just need to squeeze out as much as I can out of the ram I have. Swapping makes the Django requests painfully slow. I am running memcached, which does seem to help my sites go faster, but it isn't helping the memory footprint go down (obviously.) I'm also considering switching to lighttpd. I've read it has a smaller footprint than apache. I've also read that mod_wsgi performs better than mod_python. Please let me know if you have any other ideas! I'm also curious to know if anyone thinks that one of the things I mention trying would help or hurt. Thanks! Jeff Anderson
signature.asc
Description: OpenPGP digital signature