I'm a bit hazy on how to switch from prefork MPM to worker MPM.

Since results from Paul's apache2 -V command seem to show his apache
server
was compilted with the prefork option, does this indicate a
recompilation to
include worker.c?



On Aug 13, 5:56 am, Graham Dumpleton <graham.dumple...@gmail.com>
wrote:
> You should be able to get list of modules actually being load by using
> the -M command to Apache. Thus:
>
>   apache2 -M
>
> Now. I am going to go through things to try as a series of emails over
> time as don't have state of mind now to try and do it all at once.
>
> First up. If not using PHP then disable mod_php.
>
> Second, now that you have got rid of mod_php, switch Apache
> installation from prefork MPM to worker MPM.
>
> Third, since you are using mod_wsgi daemon mode, ensure that mod_wsgi
> doesn't unnecessarily enable Python interpreters in Apache child
> processes. For that read:
>
>  http://blog.dscpl.com.au/2009/11/save-on-memory-with-modwsgi-30.html
>
> Changing from prefork to worker MPM and ensuring the Python
> interpreters aren't initialised when not needed, will cut down on
> memory footprint in the Apache child processes which do the proxying
> to mod_wsgi daemon mode processes. This is because instead of
> potentially up to 150 processes under excessive load, you would at
> most have 6 processes. You have so few now because each of those 6 can
> handle 25 concurrent requests in worker MPM where as prefork needed a
> separate process for each request.
>
> To try and gauge progress on this before you start, change:
>
>   WSGIDaemonProcess site-1 user=my-user group=www-data threads=25
>
> to:
>
>   WSGIDaemonProcess site-1 user=my-user group=www-data threads=25
> display-name=%{GROUP}
>
> When you do a 'ps' now, the mod_wsgi daemon processes will be named
> '(wsgi:site-1)' and can be distinguished easily from Apache root and
> child process.
>
> Use 'ps' to look at number of processes and sizes before making the
> other changes above. For example, on my Mac OS X box with prefork I
> see:
>
> $ ps auxwwww | egrep 'httpd|USER' | grep -v grep
> USER       PID  %CPU %MEM      VSZ    RSS   TT  STAT STARTED      TIME COMMAND
> _www     58942   0.0  0.1  2440732   2184   ??  S     7:31am   0:08.82
> /usr/sbin/httpd -D FOREGROUND
> _www     58941   0.0  0.1  2440732   2184   ??  S     7:31am   0:08.83
> /usr/sbin/httpd -D FOREGROUND
> _www     58940   0.0  0.1  2440732   2196   ??  S     7:31am   0:08.79
> /usr/sbin/httpd -D FOREGROUND
> _www     58937   0.0  0.1  2440732   2184   ??  S     7:30am   0:08.82
> /usr/sbin/httpd -D FOREGROUND
> root     58908   0.0  0.0  2439768   1208   ??  Ss    7:30am   0:01.97
> /usr/sbin/httpd -D FOREGROUND
> _www     61069   0.0  0.1  2440732   2232   ??  S    11:22am   0:05.44
> /usr/sbin/httpd -D FOREGROUND
> _www     60310   0.0  0.1  2440732   2184   ??  S     9:47am   0:06.62
> /usr/sbin/httpd -D FOREGROUND
>
> You would grep for 'apache2' and not 'httpd'.
>
> The 'root' owned process is the Apache parent process and the rest are
> the Apache child processes proxying to the mod_wsgi daemon processes
> and which would also be handling static file handling if Apache being
> used for that.
>
> Remember to check this when traffic flowing and now just when idle as
> Apache will dynamically create more and more processes to meet demand.
> You can read a bit about that at:
>
>  http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usa...
>
> So, disable PHP, switch to worker MPM and disable interpreter
> initialisation in embedded mode and restrict code execution in
> embedded mode just to catch and configuration stuff ups.
>
> Then capture 'ps' output and post both so can compare.
>
> BTW, out of the modules you are loading into Apache, if you can say
> which you think you are using. I note for example that rpaf is being
> loaded. Are you actually using that?
>
> After we look at results for changes above, then we can look at what
> is the minimum set of Apache modules you need and strip those back.
>
> Graham
>
> On 13 August 2011 05:21, Paul Walsh <paulywa...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Oh, ok, to check MPM on Ubuntu was as simple as apache2 -V.
> > That shows me:
> > Server MPM:     Prefork
> >   threaded:     no
> >     forked:     yes (variable process count)
> > Server compiled with....
> >  -D APACHE_MPM_DIR="server/mpm/prefork"
> >  -D APR_HAS_SENDFILE
> >  -D APR_HAS_MMAP
> >  -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
> >  -D APR_USE_SYSVSEM_SERIALIZE
> >  -D APR_USE_PTHREAD_SERIALIZE
> >  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
> >  -D APR_HAS_OTHER_CHILD
> >  -D AP_HAVE_RELIABLE_PIPED_LOGS
> >  -D DYNAMIC_MODULE_LIMIT=128
> >  -D HTTPD_ROOT="/etc/apache2"
> >  -D SUEXEC_BIN="/usr/lib/apache2/suexec"
> >  -D DEFAULT_PIDLOG="/var/run/apache2.pid"
> >  -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
> >  -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
> >  -D DEFAULT_ERRORLOG="logs/error_log"
> >  -D AP_TYPES_CONFIG_FILE="mime.types"
> >  -D SERVER_CONFIG_FILE="apache2.conf"
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "modwsgi" group.
> > To view this discussion on the web visit
> >https://groups.google.com/d/msg/modwsgi/-/_jUgBgryjacJ.
> > To post to this group, send email to modwsgi@googlegroups.com.
> > To unsubscribe from this group, send email to
> > modwsgi+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/modwsgi?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to modwsgi@googlegroups.com.
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to