Notes on PHP handlers

Comparison Graph

DSOCGISUPHPFASTCGI
Low CPU usage
Low Memory consumption
Runs PHP as site owner instead of Apache

only w/ suEXEC
Good security

Reference from: http://boomshadow.net/tech/php-handlers/

 

PHP-FPM (reference)

PHP-FPM = all fcgid + advantage of a shared APC cache for all processes.

mod_php vs FastCGI (reference)

1.

when use mod_php, apache use less memory then FastCGI process
However, apache use less memory when using FastCGI which apache can process more static file requests

Apache pre-fork <= higher when many static files requested
fcgi 15 processes * (40 MB – 21 MB shared) + 21 MB shared + (20 Apache procs * 6 MB [120MB]) = 426 MB

Apache threaded MPM-Worker
fcgi 15 processes * (40 MB – 21 MB shared) + 21 MB shared + (10 Apache procs * 25 MB [250MB]) = 556 MB

mod_php 26 processes * (26 MB – 13 MB shared) + 13 MB shared = 351 MB

2. the number of MySQL threads went down dramatically, because only PHP processes will connect to it, and not every Apache process. Reduced from 15 connections to 1-2 connections

3. the number of network connections inside the server reduced from 1400 to around 200

Leave a Reply

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.