On Aug 10, 6:07 am, Jumpfroggy <rocketmonk...@gmail.com> wrote:
> I'm hosting a bunch of django apps on a shared host with 80MB of
> application memory (Webfaction in this case). I've got a bunch of
> apps that are very infrequently used, but need to be online. I've
> already changed the httpd.conf:
> ServerLimit 1
> Instead of the default "ServerLimit 2". With the default, each app
> spawns 3 apache processes; one manager, 2 worker processes. With
> ServerLimit 1, there is only a manager and a single worker. This cuts
> down on a lot for low-traffic sites.
>
> However, I'd like to see what the bare minimum memory usage can be.
> I've made sure DEBUG = False. I also separated the static media to a
> separate server with MEDIA_ROOT and MEDIA_URL. When I first start
> apache, the manager and worker processes use about 3MB (RSS) each.
> After the first access with a browser, the manager stays the same but
> the worker uses 16MB and stays there until apache is restarted.
>
> Ideally, I'd love it if the memory usage go back to the initial state
> (3MB) after a period of inactivity. I'm curious; what is being stored
> in memory? Are there other things I can do to reduce memory usage?
>
> The one thing I've seen is the "MaxRequestsPerChild" apache setting.
> As far as I can tell, it'll recreate the worker process after X
> requests. But this seems like it might adversely affect performance,
> since I need something time-based, and not # requests based. With
> MaxRequestsPerChild, I'm guessing if I set it to 10 but only had 9
> requests, it would sit there using up memory until the tenth request,
> which is not ideal. With MaxRequestsPerChild set to 1, I'd be
> guaranteed low memory usage but would also recreate the worker process
> for each request, which seems like a bad idea.
>
> My goal is to have many apps running at bare-minimum memory usage, and
> only the frequently accessed sites taking up ~16MB memory each. And
> when the active sites are dormant (late at night, etc), I'd like those
> to lower their memory use as well. Is there any way to do this?
>
> Thanks! (and apologies if I've missed some obvious documentation...
> I've gone through a few guides, but nothing seems to have helped).
Replace use of mod_python with mod_wsgi. Ensure you use prefork MPM
for Apache and delegate Django instances to run in mod_wsgi daemon
mode process. Having done that, you can use inactivity-timeout option
for mod_wsgi daemon processes to have the process restarted and
returned to low memory footprint idle process after no use for a
while.
Note, just ensure you don't keep loading mod_python after having
switched to mod_wsgi as mod_python will still consume some extra
memory when not in use.
Graham
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---