Why pre fork?

11 posts / 0 new
Last post
#1 Fri, 02/22/2013 - 15:00
nibb

Why pre fork?

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.

Fri, 02/22/2013 - 15:30
andreychek

Howdy,

It's no problem to disable pre-fork. I don't use that on my own Virtualmin server.

Apache's mod_php module is installed as part of Virtualmin's automated installation, which only works with pre-fork mode (since PHP isn't thread-safe).

However, if you wish to switch to a different MPM, it's just a matter of first disabling mod_php. Once you do that, you can enable an MPM such as worker.

-Eric

Sat, 02/23/2013 - 07:31 (Reply to #2)
nibb

But will not that break Virtualmin functionality?

I read problems here in the forums of users that tried to switch, but they where 2 to 3 years old posts. Not sure if this has changed by now.

I don´t want to lose any Virtualmin integration or render some specific feature useless.

Also, as far as my experience goes, you should not just change the MPM that like you suggested. Its suggested to recompile the web server again.

You just switched without recompiling Apache? How long are you running it like that?

Sat, 02/23/2013 - 23:04
nibb

I researched a bit more and it seems you can just switch to it, because checking Apache which comes with Virtualmin it supports worker as well.

Its seems yum uses pre-fork as default and the the OS itself will default to pre-fork which then makes sense. I just thought this was a particular choice from Virtualmin but it seems this is not the case and today in 2013 pre-fork still seems to be the default.

I checked some cPanel servers I had lying around and indeed, this where also pre-fork, even when I was almost sure I changed them. But now that I remember, I got segfault all over with popular PHP scripts, so I changed back. This was some years back and im wondering how well worker is running this days.

It seems while PHP works fine, you can not guarantee this for its modules and libraries.

andreychek, I guess you run worker with fcgi correct? I also run fcgi, but since my main importance is PHP I was wondering if you hit so far any module or PHP library that does not work. I assume worker with fcgi is safe, as PHP runs its own process.

Maybe you can comment if you run into any issues so far.

Sun, 02/24/2013 - 18:33
drori
xxx@yyyy ~> grep -ri fork /etc/apache2/*
/etc/apache2/apache2.conf:# prefork MPM
/etc/apache2/apache2.conf:<IfModule mpm_prefork_module>

That's it - no other mentions of "fork" there (I hope my quick-and-dirty check means anything :))

We're running a 2-months old ubuntu 12.04, with fresh virtualmin that was installed about then.

I have drupals, wordpresses, djangos, and some other hand-written junk, on a totally standard LAMP setup.

Sun, 02/24/2013 - 23:22
andreychek

andreychek, I guess you run worker with fcgi correct? I also run fcgi, but since my main importance is PHP I was wondering if you hit so far any module or PHP library that does not work. I assume worker with fcgi is safe, as PHP runs its own process.

I haven't run into any problems with either FCGID or CGI when using Worker mode.

That's it - no other mentions of "fork" there (I hope my quick-and-dirty check means anything :))

On Ubuntu, you can determine which mode you're using with this command:

dpkg -l 'apache2-mpm*'

Mon, 02/25/2013 - 15:57 (Reply to #6)
drori

un apache2-mpm (no description available) un apache2-mpm-event (no description available) un apache2-mpm-itk (no description available) ii apache2-mpm-prefork 2.2.22-1ubuntu1.2 Apache HTTP Server - traditional non-threaded model un apache2-mpm-worker (no description available)

My websites have all low traffic, so i'm not super concerend , but memory is an issue here, so thanks for the tips.

Mon, 02/25/2013 - 19:48 (Reply to #7)
nibb

Well apache mpm-event is even more new than worker. Its actually more like in a beta and you should not use it production servers.

Workers is supposed to be better for ram and lower resources, can handle more traffic with the same resources, but is not as stable as pre-fork, even while I don´t think you will have any problems with it.

For low traffic pre-fork will work just fine.

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

Installing Apache MPM Worker forces the removeal of virtualmin-base.

I installed Virtualmin using the install.sh script.

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/16336

Mon, 01/06/2014 - 14:24
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.

Fri, 04/25/2014 - 09:38
amityweb

I came here with the same question... when I enabled worker, I did not have to disable mod_php. It does not look like mod_php is being used, all the servers I create use FastCGI by default.

So is it still the case that Virtualmin uses mod_php by default? Because I havent had to disable it like some website say I need to, so I couldnt have been using it?

Switching to worker is as easy as:

yum install php-zts Uncommenting HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd service httpd restart

So I wonder why its not default if its supposed to be better.

Topic locked