After the initial days where websites were static pages, the internet quickly moved to rendering dynamic data based on the user requests. This led to the rise of various languages and serverside components. FPM i.e. FastCGI Process Manager is a serverside component that allows the web server to render dynamic webpage in a fast and scalable way with quite a few advanced techniques.

What is FastCGI?

CGI i.e. Common Gateway Interface is a protocol for interfacing external applications with the web server. CGI applications run in separate processes and each process is started and terminated based on the need. FastCGI is a variation of CGI protocol and it aims to make the interaction of web server with external applications faster. This binary protocol achieves the aim by pre-spawning the processes and reusing them as much as possible. The requests coming to the web server are reverse proxied to the application via FPM, which processes the requests and sends the response back to the web server.

FPM i.e. FastCGI Process Manager helps web server handle huge number of requests easily.
FPM i.e. FastCGI Process Manager helps web server handle a huge number of requests easily.

So what is FPM?

As mentioned above, FastCGI aims to make the request processing faster. To achieve this, it creates a pool of processes to handle series of requests, instead of creating a new process for each request. These processes are not owned by the web server and hence it needs a manager component to manage all the processes. This is what FPM is.

FPM allows the user to configure various aspects of the pool such as minimum number of processes, the maximum number of processes, number of processes to be spawned and when to terminate the processes etc.

Typical ways how the use of FPM speeds up the processing:

  • Process pool with min and max threshold
  • Each process can handle multiple requests over its lifetime. This reduces the number of processes those are spawned as compared to the case where each process could handle only one request before terminating.

Most of the references to FPM, take you to PHP-FPM implementation which is a PHP implementation of FastCGI protocol. Nginx with PHP-FPM is a highly powerful combination used around the globe by administrators to serve some of the busy websites.

Related links:

Related Keywords

PHP, FPM, FastCGI, CGI, Apache, Nginx, mod_php, Programming, Architecture



Leave a Reply

Your email address will not be published. Required fields are marked *

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