On Tue, Jan 14, 2014 at 7:48 AM, Mike Lovell <[email protected]> wrote:

> Apache2 has multiple methods of doing concurrency called Multi-Processing
> Modules. You'll might want to look at changing apache to use the worker mpm
> module instead of the default prefork mpm module.
> http://httpd.apache.org/docs/2.2/mpm.html is the starting place for the docs
> related to the various apache mpm modules. Prefork is going to use a new
> child process per connection where worker will spawn multiple processes but
> then also have multiple threads in those children to handle multiple
> connections. Though I'm not entirely sure how well worker handles various
> other plugins, such as mod_wsgi. So you'll probably want to do some research
> about worker with whatever infrastructure you're using for your drupal
> installation.
>
> It looks like there is a separate package for apache with prefork vs apache
> with worker in debian and ubuntu. To get the worker version, you'll need to
> install the apache2-mpm-worker package which will probably replace
> apache2-mpm-prefork.

While all of this is true, mod_php only works with
apache2-mpm-prefork. Using apache and mod_php on anything other than
dedicated hardware with lots of RAM is a losing proposition.

You *can* still use Apache and PHP together without losing this badly,
though.  If you switch to one of the more memory-efficient apache
MPMs, you will also need to switch to another method of running PHP.
What you probably want is PHP-FPM, which stands for FastCGI Process
Manager.  It basically maintains a small pool of PHP processes that
your Apache processes will talk to for PHP execution.  It means you
don't have the PHP runtime in every single Apache process, which makes
them far more lightweight, and you can use a more efficient MPM with
Apache as well.

You could also switch to nginx + php-fpm, but that requires learning
an entirely different way of configuring the web server and most PHP
apps you want to run assume you're using apache and come with apache
configuration instructions which you'll have to port yourself.  It's a
relatively efficient combination, but a lot more work.

I have no idea what you're doing with Drupal, but if you are not
really using the dynamic features (user management, user-generated
content/comments, etc) but are mostly using it to set up the framework
of a fairly static set of pages, you might want to consider a static
site generation toolkit like Jekyll or one of the many packages like
it.  You set up basic templates for the pages and then define the
content of the pages in their own files with Markdown formatting and
it stitches everything together into a set of static HTML and CSS
files for you.  You can then serve all your basic pages *very*
efficiently and let your node.js backend take care of all the dynamic
stuff.  No more PHP vulnerabilities!

Feel free to disregard that if you actually need all the stuff Drupal
does for you, but it is a bit of a heavy solution for something that's
not even the primary app for your site.

       --Levi

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to