This is an old revision of the document!
Request for Comments: FPM SAPI inclusion
- Version: 1.0
- Date: 2010-03-22
- Author: Antony Dovgal <tony.at.daylessday.dot.org>
- Status: Under Discussion
- First Published at: http://wiki.php.net/rfc/fpm
This RFC discusses FPM SAPI and its inclusion to the core PHP distribution.
FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features (mostly) useful for heavy-loaded sites.
These features include:
- advanced process management with graceful stop/start;
- ability to start workers with different uid/gid/chroot/environment, listening on different ports and using different php.ini (replaces safe_mode);
- stdout & stderr logging;
- emergency restart in case of accidental opcode cache destruction;
- accelerated upload support;
- “slowlog” - logging scripts (not just their names, but their PHP backtraces too, using ptrace and similar things to read remote process' execute_data) that are executed unusually slow;
- fastcgi_finish_request() - special function to finish request & flush all data while
continuing to do something time-consuming (video converting, stats processing etc.);
- dynamic/static child spawning
- basic SAPI status info (similar to Apache mod_status)
- XML-based config file which contains configuration for different process pools with different configuration settings (see this for example)
FPM uses BSD-licensed libevent (this is the only external requirement) to handle connections and manage its children.
Why do we need FPM?
FastCGI becomes more and more popular these days as people tend to realize that 'light' HTTP servers (lighttpd, nginx and the like) are much more efficient on heavy-loaded frontends than traditional Apache.
The FastCGI implementation in sapi/cgi requires third-party applications like spawn-fcgi or mod_fcgi to manage its processes and is a 'core' implementation of FastCGI protocol lacking a lot of features that are crucial for many complex real-life applications.
Proposal and Patch
FPM is ready to be merged from PHP_5_3_FPM branch in the official PHP SVN. All the FPM code is concentrated in sapi/fpm and no additional patches are required.
tony - 2010-03-22 - initial RFC version.