Introduction to FastCGI
Before we begin, you should know that (as the name suggests) FastCGI is actually a variation of CGI. Therefore, explaining CGI first is in order. The improvements introduced by FastCGI are detailed in the following sections.
Understanding the CGI mechanism
The original purpose of a web server was merely to respond to requests from clients by serving files located on a storage device. The client sends a request to download a file and the server processes the request and sends the appropriate response: 200 OK if the file can be served normally, 404 if the file was not found, and other variants, as illustrated in the following diagram:

This mechanism has been in use since the beginning of the World Wide Web and it still is. However, as stated before, static websites are being progressively abandoned at the expense of dynamic ones that contain scripts that are processed by applications such as PHP and Python among others. The web serving mechanism thus evolved into the following...