Skip to main content


Home FastCGI

FastCGI

FastCGI definition

FastCGI is a protocol designed to improve the speed and efficiency of web servers when they’re handling requests for dynamic content. It replaced the older Common Gateway Interface (CGI).

See also: web server, dynamic URL, dynamic website

How does FastCGI work?

FastCGI works independently of specific web server implementations. It also supports various programming languages commonly used for web development, making it a versatile choice for different web server environments.

Unlike CGI, which spawns a new process for each web request, FastCGI keeps a pool of processes running continuously. These processes wait for requests, handle them, and then wait for the next request rather than shutting down after a single use. This method significantly reduces the overhead from creating and destroying processes for each request and leads to faster response times and better scalability, especially under high-traffic conditions.

When a web server receives a request for a resource that requires processing (like a PHP script), it forwards it to a FastCGI process. It is already in memory and ready to execute, so it processes the request and returns the generated dynamic content (like HTML) back to the web server.