mpm-worker

17 posts / 0 new
Last post
#1 Tue, 07/20/2010 - 09:28
pixel_paul
pixel_paul's picture

mpm-worker

Hi,

Before I waste too much more time searching around for this, is it possible to run virtualmin's apache with mpm-worker?

Thanks,

Paul

Tue, 07/20/2010 - 09:33
andreychek

Hi Paul,

Yeah, I believe mpm-worker works well with CGI and FCGID.

I've heard some stories about it not working well with things like mod_php.

If you have your sites set to use CGI and/or FCGID, you should be in good shape!

-Eric

Tue, 07/20/2010 - 10:15 (Reply to #2)
pixel_paul
pixel_paul's picture

Hi Eric,

All sites are running with FCGID.

So all I will need to do is uncomment this line:

HTTPD=/usr/sbin/httpd.worker

in

/etc/sysconfig/httpd

Am I correct in thinking that I would then need to manually recompile php for this to work?

Thanks,

Paul

Tue, 07/20/2010 - 10:20
andreychek

Howdy,

I'm not familiar with the process of moving from prefork to worker mode on CentOS.

However, I don't believe such a switch should require you to make any changes to PHP if mod_php isn't in use.

In theory, it should just be a matter of reconfiguring Apache to use worker mode instead of prefork -- and once you do that, it should work without needing to reconfigure or recompile anything.

Since you aren't using the PHP Apache module (mod_php), PHP shouldn't care how it's being called by Apache... it's just a command line program that Apache calls.

-Eric

Tue, 07/20/2010 - 10:41
pixel_paul
pixel_paul's picture

I've got a test Virtualmin GPL 3.79 system set up and I have uncommented the line in /etc/sysconfig/httpd with apache stopped, but when I start it again I get:

Starting httpd: [Tue Jul 20 16:39:22 2010] [crit] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe.  You need to recompile PHP.
Pre-configuration failed
[FAILED]

The php version I am using is from the vmbleed repo, php 5.2.11-1.el5.vmbleed

Perhaps I'm missing something somewhere?

Thanks,

Paul

Tue, 07/20/2010 - 10:46
andreychek

It sounds like, although you're not using mod_php, it's still being loaded into Apache.

You may need to remove mod_php from your Apache config.

-Eric

Tue, 07/20/2010 - 11:12
pixel_paul
pixel_paul's picture

I don't see mod_php in the apache config.

The only line is

LoadModule php5_module modules/libphp5.so

in /etc/httpd/conf.d/php.conf

Thanks,

Paul

Tue, 07/20/2010 - 11:37
andreychek

Yup, that's the mod_php module.

So long as nothing in any of your sites or the Apache config is using any mod_php functionality, you should be able to simply comment that line out and restart Apache.

-Eric

Wed, 07/21/2010 - 04:14 (Reply to #8)
pixel_paul
pixel_paul's picture

Hi Eric,

That has worked, certianly in terms of php not using mod_php, however when I type

/usr/sbin/httpd -l

I get

core.c
prefork.c
http_core.c
mod_so.c

Should I not expect to see

worker.c

present?

Wed, 07/21/2010 - 08:12
andreychek

What does your process list look like? If you run "ps auxw | grep http", what do you see?

-Eric

Wed, 07/21/2010 - 08:22
pixel_paul
pixel_paul's picture

Hi Eric,

Magic!

ps auxw | grep http

root     30046  0.0  0.9  12808  5044 ?        Ss   10:01   0:00 /usr/sbin/httpd.worker

So it looks like worker.c is active.

Thanks again for your insight and info into this!

Cheers,

Paul

Wed, 07/21/2010 - 08:33
andreychek

Yup, that looks good!

I believe what's happening there is that while Apache is running "httpd.worker", the command you were running on the command line is "/usr/sbin/httpd -l", rather than "/usr/sbin/httpd.worker -l".

That does appear to be working well though.

Be sure to let us know any thoughts you have on the performance differences between the two, I'd be curious to hear how that's working out for you.

-Eric

Wed, 07/21/2010 - 08:41 (Reply to #12)
pixel_paul
pixel_paul's picture

Yep, hit the nail on it's head:

/usr/sbin/httpd.worker -l
Compiled in modules:
  core.c
  worker.c
  http_core.c
  mod_so.c

The reason I'm trying this is because I have an 4 core server (8 threads), and am interested in seeing what difference this makes to performance.

It's actually so easy to switch between the prefork and worker that I should be able to get some performance info.

Thanks again,

Paul

Sun, 06/03/2012 - 12:16
khinton

Eric-if it were possible for virtualmin users to contact each other somehow on these forums without publicly sending out stuff I would, but I think that this "centtavirla" person who posted here may be another automatic spam user. I've never heard of a centtavirla before, anyhow. Thanks!

Mon, 06/04/2012 - 10:29 (Reply to #14)
andreychek

That is indeed spam... I've blocked the user and removed their post.

There unfortunately isn't a private message option... though I usually do remove spam once I see it, I just wasn't around most of the weekend :-)

Thanks for the heads up though!

-Eric

Tue, 03/26/2013 - 13:47
GIADOM

Hi all,

Centos 6 / Plesk 11

I uncomment Line HTTPD=/usr/sbin/httpd.worker

in

/etc/sysconfig/httpd

and get this error in Plesk on starting httpd (Apache)

Cannot start/stop/restart service: Starting httpd: httpd.worker: Syntax error on line 221 of /etc/httpd/conf/httpd.conf: Syntax error on line 9 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5-zts.so into server: /etc/httpd/modules/libphp5-zts.so: cannot open shared object file: No such file or directory [FAILED]

so i install - libphp5-zts.so with # yum install php-zts after this no errors on start of Apache but # httpd -V shows "Server MPM: Prefork"

# httpd -V
Server version: Apache/2.2.15 (Unix)
Server built:   Feb 22 2013 11:19:58
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
Architecture:   64-bit
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/httpd"
-D SUEXEC_BIN="/usr/sbin/suexec"
-D DEFAULT_PIDLOG="run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"

m I still running prefork ???

this Order # ps auxw | grep http shows

# ps auxw | grep http
root      9783  0.0  0.7 236700 16552 ?        Ss   19:05   0:00 /usr/sbin/httpd.worker
apache    9788  0.0  0.2 230660  5144 ?        S    19:05   0:00 /usr/sbin/httpd.worker
apache    9789  0.0  1.3 2226944 27368 ?       Sl   19:05   0:00 /usr/sbin/httpd.worker
root     10051  0.0  0.0 103240   832 pts/0    S+   19:21   0:00 grep http
Tue, 03/26/2013 - 14:42 (Reply to #16)
andreychek

Howdy,

What you're seeing when running "httpd -V" is just the default.

The config file you changed, /etc/sysconfig/httpd, is what changes that default when the init script is run.

So it looks like you did everything correctly.

What you're seeing in your process list is correct -- that the httpd.worker process means you're using the threaded "worker" mode, and not the pre-fork mode.

-Eric

Topic locked