Re: [modwsgi] django memory issues

2014-11-09 Thread sags
Hi Graham,

I am using apache version 2.2 and mod_wsgi 3.2

On doing htop, I am getting the following:
PID USER  PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command  
23309 apache 20   0  563M   70828  6632 S  0.0  1.8 0:00.38 
(wsgi:main)
23205 apache 20   0  668M   80128  7660 S  0.0  2.0 0:02.39 
(wsgi:main)
23204 apache 20   0  563M   70828  6632 S  0.0  1.8 0:02.18 
(wsgi:main)
23311 apache 20   0  668M   80128  7660 S  0.0  2.0 0:00.37 
(wsgi:main)
23294 apache 20   0  668M   81332  7656 S  0.0  2.1 0:00.39 
(wsgi:main)
23206 apache 20   0  668M  81332   7656 S  0.0  2.1 0:02.45 
(wsgi:main)




On Saturday, November 8, 2014 11:03:16 PM UTC-5, Graham Dumpleton wrote:


 On 09/11/2014, at 6:24 AM, sags sag...@gmail.com javascript: wrote:

 Hi Graham,

 I am been reading your blogs and posts on mod_wsgi configurations. We 
 build some programming modules using an open source django based 
 application originally developed for MOOCs. We modified the application 
 based on our requirements but we didn't change much underlying frame work 
 of that open source code.The application is running fine but server some 
 time crashed due to out of memory issue. At a time around 30 students use 
 this application in a class. We monitored, using free -m command, 
 approximately 30 students when using the application at the same time, the 
 memory consumption approximately goes down by 200-300 MB. But the problem 
 is once students log out from the sessions, the* memory doesn't seem to 
 get released*. Due to which the memory consumption goes on increasing 
 again and again. For the time being we have wrote a script to clear the 
 cache if memory goes below 500 MB using echo 1  /proc/ .../drop_caches and 
 it seems to be freeing lot of memory. Is there some permanent solution to 
 it. We are using red hat VM server for hosting our application. We except 
 more teachers using this application, which means traffic is going to be 
 high in future.

 FYI: We are using mod_wsgi deamon mode with processes = 2 and Threads = 15 

   

 Is it due to the django or could it be due to OS or httpd configuration 
 issues?

 I would appreciate your feedback on it.


 How are you monitoring memory usage and what processes are specifically 
 taking up the memory?

 I don't understand how:

 echo 1  /proc/sys/vm/drop_caches

 as described in:

 http://linux-mm.org/Drop_Caches

 can affect the run time memory usage of specific Python web application 
 processes.

 BTW, in monitoring memory used by Apache, ensure that if using mod_wsgi 
 daemon mode that you are using the option:

 display-name=%{GROUP}

 to the WSGIDaemonProcess directive.

 By doing this it will result in the process names as shown by 'ps' and 
 'htop' being the name of the mod_wsgi daemon process group name. This way 
 you can distinguish between normal Apache processes and the mod_wsgi daemon 
 process groups.

 For example, for:

 WSGIDaemonProcess mysite display-name=%{GROUP} processes=2 threads=15

 You will see in 'ps' out:

 httpd (or apache2 on some systems) running as root - Apache parent 
 process
 httpd (or apache2 on some systems) running as Apache user - Apache 
 child worker processes
 (wsgi:mysite) - mod_wsgi daemon process group processes

 if you are pinning it to an Apache processes, which of these is showing 
 increase memory usage.

 Also, what version of Apache and mod_wsgi are you using?

 Graham



-- 
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.


[modwsgi] django memory issues

2014-11-08 Thread sags
Hi Graham,

I am been reading your blogs and posts on mod_wsgi configurations. We build 
some programming modules using an open source django based application 
originally developed for MOOCs. We modified the application based on our 
requirements but we didn't change much underlying frame work of that open 
source code.The application is running fine but server some time crashed 
due to out of memory issue. At a time around 30 students use this 
application in a class. We monitored, using free -m command, approximately 
30 students when using the application at the same time, the memory 
consumption approximately goes down by 200-300 MB. But the problem is once 
students log out from the sessions, the* memory doesn't seem to get 
released*. Due to which the memory consumption goes on increasing again and 
again. For the time being we have wrote a script to clear the cache if 
memory goes below 500 MB using echo 1  /proc/ .../drop_caches and it seems 
to be freeing lot of memory. Is there some permanent solution to it. We are 
using red hat VM server for hosting our application. We except more 
teachers using this application, which means traffic is going to be high in 
future.

FYI: We are using mod_wsgi deamon mode with processes = 2 and Threads = 15 

  

Is it due to the django or could it be due to OS or httpd configuration 
issues?

I would appreciate your feedback on it.

Thanks 

-- 
You received this message because you are subscribed to the Google Groups 
modwsgi group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To post to this group, send email to modwsgi@googlegroups.com.
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.