Using worker in apache instead of prefork

13 posts / 0 new
Last post
#1 Sat, 11/20/2010 - 04:38
daysonp

Using worker in apache instead of prefork

I saw this discussion long time ago, but I couldn't jump to any conclusion on that thread.

Since I'm running my virtual servers under php with fcgid, I guess I should be running apache with worker mpm for better performance.

How do I switch to apache2-mpm-worker without messing anything with virtualmin / webmin?

I was thinking


aptitude remove apache2-mpm-prefork
aptitude install apache2-mpm-worker

Should this be enough?

Sat, 11/20/2010 - 04:53
Locutus

I'm feeling in an experimental mood and will test this on my development virtual machine. :)

Sat, 11/20/2010 - 05:05
daysonp

Locutus, my favorite!

Please let me know how it goes and whether I'm doing the right thing by switching across to worker. Also, removing prefork will remove mod_php5, so I'd also like to know if that will cause any configuration problems in virtualmin or elsewhere.

Awaiting your reply!

Sat, 11/20/2010 - 05:07
Locutus

Yep, you got that right, it will remove mod_php5, which is the first problem I encounter. Let's see how Vmin reacts when I force it to do that. :)

(I personally use Apache with mod_php5 so that I can use XCache, so unfortunately mpm_worker is not a productive option for me.)

Sat, 11/20/2010 - 05:18
Locutus

Well, looks okay so far. No Vmin dependencies for mod_php5 or mpm_prefork or other stuff broken.

Only thing I had to change was remove "php_value memory_limit +32M" from the Apache config of my test domain. It got added there due to an entry in the template, section Apache Website. Not sure if I had added that myself or if it was there by default.

And of course change any domains that use mod_php to FCGId before you replace the packages. :)

Sat, 11/20/2010 - 05:37
Locutus

I did some performance measurements with the mpm-worker. My usual quick test here is a freshly installed MediaWiki and requesting the "System messages" page four times per second.

CPU usage of one 2.8 GHz Core i7 is at 65%. Memory usage is 30 MB for the "php5-cgi" process which serves the requests.

Values for mpm-prefork are roughly the same though. I suppose, to really test the difference between the two mpms, it's required to test non-php stuff. :)

Sat, 11/20/2010 - 05:44
Locutus

CPU load and memory requirements for a static page are negligible for my test with about 30 requests per second, both for mpm-worker and mpm-prefork. CPU is at 0-1%, memory does not increase beyond the initial usage.

So I suppose any difference between the two mpms will be noticeable only under considerably high loads.

Sat, 11/20/2010 - 05:50
daysonp

Locutus, why can't I reply here? Every comment is going into moderation.

Thanks, I'm going to try installing now and will provide any outcome of my migration to mpm worker here.

Sat, 11/20/2010 - 08:24
daysonp

Ok works! Just one command did it all

aptitude install apache2-mpm-worker

There is no need to do an aptitude remove

Thanks Locutus!

Sat, 11/20/2010 - 08:41
Locutus

Yeah it'll probably perform auto-resolution of dependency errors, and remove the conflicting package "apache2-mpm-prefork". In the GUI, it'll show that as first resolution option when you do it manually.

You're welcome!

Wed, 01/01/2014 - 17:15
bionitech

This thread is three years old and still unresolved as far as I can tell.

I installed Virtualmin using the install.sh script.

I am trying to install apache-mpm-worker, and it is forcing me to uninstall virtualmin-base.

https://www.virtualmin.com/node/16963#comment-75232
"There will be a second script which converts a virtualmin-base install into a virtualmin-configure system without breaking anything (hopefully)."

Is this still the plan? Any progress?

I would consider this issue a major bug. Virtualmin DOES NOT depend on libapache2-mod-php5, so it should not be listed as a dependency.

Being unable to use mpm-worker makes Virtualmin USELESS for anything other than low-traffic sites.

https://www.virtualmin.com/node/25497

nibb Posted: Fri, 2013-02-22 15:00

Why does Virtuamin uses apache in pre-fork as default?

This is awful. Its not 2005 anymore. Most web servers use worker today. Not only it consumes less RAM but allows more traffic to be handled.

Pre-fork cannot scale in traffic.

Based on this, Virtualmin would only be suited for very low traffic websites and servers. Its not fully using the potential from Apache as a web server.

This behaviour should really change in the future. Or in either case, users should have the option when installing it or after it to decide which mode to use.

I searched the forums a bit and its seems you cannot use worker even if you want because it conflicts and creates problems with virtualmin itself.

Honestly, this could be a huge reason not to use Virtualmin. Virtualmin is supposed to be for hosting, to host multiple virtual hosts. But if you are limit into traffic you can handle with Apache it does not make to much sense.

---

I've tried the following work-around and it seems to have worked. This issue still needs to be dealt with though. Users shouldn't have to hunt through forums to find a work-around that is still experimental.


# aptitude -s remove virtualmin-base
The following packages will be REMOVED:
procmail-wrapper{u} usermin-virtual-server-theme{u} virtualmin-base
webmin-security-updates{u} webmin-virtual-server{u} webmin-virtual-server-theme{u}
webmin-virtualmin-awstats{u} webmin-virtualmin-dav{u} webmin-virtualmin-htpasswd{u}
webmin-virtualmin-mailman{u} webmin-virtualmin-svn{u}
0 packages upgraded, 0 newly installed, 11 to remove and 57 not upgraded.
Need to get 0 B of archives. After unpacking 11.2 GB will be freed.

aptitude unmarkauto procmail-wrapper usermin-virtual-server-theme virtualmin-base webmin-security-updates webmin-virtual-server webmin-virtual-server-theme webmin-virtualmin-awstats webmin-virtualmin-dav webmin-virtualmin-htpasswd webmin-virtualmin-mailman webmin-virtualmin-svn

# aptitude -s remove virtualmin-base The following packages will be REMOVED:
virtualmin-base
0 packages upgraded, 0 newly installed, 1 to remove and 58 not upgraded.
Need to get 0 B of archives. After unpacking 73.7 kB will be freed.

aptitude remove libapache2-mod-php5

aptitude install apache2-mpm-worker

(other references)
http://www.virtualmin.com/node/16963
http://www.virtualmin.com/node/17298
http://www.virtualmin.com/node/25497

Mon, 01/06/2014 - 12:42
Chris_C

Just tried this on debian 6 squeeze. Works well.

  1. aptitude install apache2-mpm-worker

  2. accept the proposed solution which is to remove apache2-mpm-prefork and libapache2-mod-php5

  3. apache2 fails to start up. go into each .htaccess and .conf file that it complains about, and comment out the php_* directives which are no longer valid.

  4. service apache2 start and it works!

Mon, 01/06/2014 - 14:22
bionitech

Hmmm..I must have pulled an old version of virtualmin-base when rolling Debian 7 support. Oops. I'm gonna have to make a virtualmin-configure package, as I'd intended to do in the past (I ended up not doing it because it introduces some other complexities that I don't like)...the workaround is still the same, though.

Joe has identified the issue and is working to resolve it.

https://www.virtualmin.com/node/16963#comment-75232

Thank you Joe.