On Oct 25, 11:32 pm, Michel Thadeu Sabchuk <[EMAIL PROTECTED]> wrote: > > Do you know which process in particular though are using up all the > > memory? > > The `top` command tells me that apache is taking the most slice of the > RAM. When I reach the high loads, there is between 40-50 subprocess of > httpd.
Running prefork I see. What I would suggest is on a separate box build up Apache with worker MPM and test your application thoroughly on it instead and see if it works. Although the guidance for Django is to use prefork and Django wasn't originally designed with multithreading in mind, there is currently no known problems with it running on multithreaded worker MPM and many people do just this. You obviously though need to confirm that your application layer is itself multithread safe first though. By using worker MPM instead of prefork MPM, you will immediately be able to drop the number of Apache child processes in use to a much lower number. This will drop back overall memory use significantly. If you are running into problems with memory swapping, this would help greatly to avoid that. > > If it is the Apache child process in which mod_python and your Django > > application is running are you taking measures like setting > > MaxRequestsPerThread directive to some non zero value so that the > > processes are recycled on a regular basis and not just growing and > > growing in size over time. Disabling keep alive or at least reducing > > the keep alive timeout can also be help in as much as holding down > > active memory and allowing more concurrent requests from different > > users without Apache having to launch new child processes. > > The KeepAlive is already disabled, I don´t have set > MaxRequestPerThread, whould you suggests me to set it? > > <IfModule prefork.c> > StartServers 5 > MinSpareServers 5 > MaxSpareServers 10 > ServerLimit 1600 > MaxClients 1500 > MaxRequestsPerChild 10000 Whoops, had a brain fade. Meant MaxRequestsPerChild which you do have set. The thread variant of that is BEOS specific and doesn't apply. > </IfModule> > > KeepAlive Off > MaxKeepAliveRequests 100 > KeepAliveTimeout 15 > > > > A friend told me that I can make python library shared. > > > If you track that one back far enough you will find me at the other > > end as I was the one who started that recommendation. I got sick of > > people complaining about mod_python using up so much memory when it > > was mostly to do with the Python installation not using a shared > > library and what happens when statically compiled object gets used in > > dynamically loadable modules. :-) > > :) ok, then I need to compile python with shared libraries and > recompile mod_python to link it with my new python environment? Recommended. > > Still not sure though what you think is causing the problems. Yes, you > > have high memory usage but what is using the memory? Is that leading > > onto swapping? > > Not all the time, once I have 4GB of ram the server don´t go to swap > almost all the time. I can´t tell preciselly if the server is onto > swapping when the server stucks. I will pay attention to this when the > problem occours again. I´m not a server expert, is this top output > normal? > > Cpu(s): 7.5% us, 1.3% sy, 0.0% ni, 91.0% id, 0.0% wa, 0.1% hi, > 0.1% si > > us is the user cpu usage, sy is system ok? What is id? Is it normal to > have it at higher levels? Two other things to look at. First is you can run: vmstat 5 The si/so columns of that will show whether it is swapping. The other thing is to run: netstat -a This will show state of active socket connections, one possibility is you are getting a lot of connections stuck in i/o wait type states and running out of resources and/or Apache stuck waiting for old connections to close down. > > If you can indicate whether it is Apache itself, the > > Django application, the database etc, will help as far as giving > > further suggestions. > > I don´t have any performance meter, I thinking on put a script making > a log of a ps command and analyses that result until a crash, do you > recommends me any performance test tool? The ones above are simple ones to try, others may be able to suggest others for Linux. I don't use Linux that much so not sure what is available these days. > > BTW, as far as using mod_python, you might want to also experiment > > with mod_wsgi. For your sort of high performance web site, you would > > most likely use it in embedded mode and so not much different to > > mod_python in that respect, but mod_wsgi does have a smaller memory > > footprint and lower per request overhead. > > I see your posts ;), I can give it a try. But I want to fight the real > problem reather to waste time on something that can help but not solve > my problem. If I use mod_wsgi I need to compile python with shared > libraries too? Shared library again recommended. Depending on what you load is like to the Django application, one of the benefits of mod_wsgi is that you can delegate the application off to some number of daemon processes (ie., FASTCGI like). This takes the application out of the main Apache child processes and may cause less issues for serving up of static files such as media files. Also, if you are stuck with needing to still support non threaded PHP code, you can push the Django instance into small number of multithread mod_wsgi daemon processes and still leave Apache as prefork MPM so you can run PHP code. Because the Django instance isn't bloating out the prefork Apache child processes, will again cut back on overall memory usage. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---