Request for a feature for switching between Apache Worker and Prefork modes

Before diving into experiments I'd like to hear *min team's advice on how to properly switch from Apache prefork to worker mode on CentOS 7.x based system. In particular, I'd like to get what Eric said on https://www.virtualmin.com/node/27691 confirmed once again - do we indeed remove the "virtualmin-base" package? And what about Hal9000's unanswered question there:

However several packages remain in the autoremove state, which i don't feel very comfortable with.

I'd like to do this switch scrupulously and only in the recommended by your team, guys, so to avoid problems in the future.

Status: 
Active

Comments

Howdy,

That works differently on Debian/Ubuntu, than it does on CentOS.

And actually, it's a bit easier now on Debian/Ubuntu now, for those it's just a matter of running "apt-get install apache2-mpm-worker".

I hadn't tried that on CentOS recently -- looking into it, it looks like they've made it a config option on CentOS 7.

Take a look at the "/etc/httpd/conf.modules.d/00-mpm.conf" file. You should be able to comment out the "prefork" LoadModule line, and uncomment the "worker" LoadModule line.

Note that mod_php doesn't typically work with the worker mode. I suspect you'll end up needing to disable that as well.

Once you disable mod_php, all of the "php_value" and "php_admin_value" lines in your Apache config will stop working.

What you'll need to do is go through the config, and comment each of those out.

Things should work fine after commenting those out though.

I see. Do you guys ever plan to make switching by one-lick style possible through UI?

So far that's not something we've discussed, so it probably won't happen in the near future.

It's not too difficult to do the above steps though, the hardest part is in commenting out those various lines.

Category: Support request » Feature request
It's not too difficult to do the above steps though, the hardest part is in commenting out those various lines.

I believe so.

However, it would be really nice if Virtualmin had the native option to easily change from one mode to another. Our research on the subject matter shows that while Apache prefork is ok for smaller projects for larger setups it is recommended to go Apache worker. So I believe if Virtualmin is also meant to be successful in becoming hosting companies' choice of a control panel and not only of individual users, then it has to offer this feature natively. I would even fancy that Apache Worker should become the default one as it promises more efficient utilization of resources, so all Virtualmin community would gain.

So I am turning this to feature request if you don't mind. I understand that it might be realized not very soon, but please at least consider of doing this sometime in the future.

Title: What is a proper way of switching to Apache Worker from Prefork? » Request for a feature for switching between Apache Worker and Prefork modes

We'll look into it, however the lack of compatability with mod_php is probably a dealbreaker for most people.

Jamie,

For most people could be, but from a hosting provider's perspective we should be able to provide customers any mode they request.

Eric,

You said:

Note that mod_php doesn't typically work with the worker mode. I suspect you'll end up needing to disable that as well. Once you disable mod_php

How do we disable mod_php in proper way not to break anything on Virtualmin? Is running "yum remove mod_php" would be ok?

Looking into it, it looks like the PHP config now tests to see whether it's the prefork or worker mode that's enabled, before attempting to load mod_php.

It won't try to load mod_php if it's using the worker mode.

That means switching to the worker mode should actually work just fine with mod_php installed.

Smaller CentoOS 7.x sites may want to use worker mode. The quality of service module mod_qos feature set is limited when deployed under prefork mode.