FastCGI is an extension of Common Gateway Interface (CGI) that was developed by a now-defunct company called Open Market. FastCGI is freely available as an open standard. It addresses certain shortcomings in CGI that limit performance.
Unlike CGI, FastCGI does not create a new process for each request, thus minimizing the overhead of process creation and destruction each time a request is received. This overhead can be circumvented by using Application Program Interfaces (APIs) such as Netscape Server Application Programming Interface (NSAPI) or Internet Server Application Programming Interface (ISAPI), but because these are proprietary, there are an additional learning curve and limitations in supported languages to be considered. Another shortcoming of CGI is the fact that certain cases for reuse can not be obtained, such as connections to databases or caching techniques. Request handling can be as much as 30 times faster using FastCGI over conventional CGI.
With FastCGI, multiple requests can be handled over a single connection, which is known as multiplexing. Alternatively, multiple connections can be used. Requests are transmitted using File Transfer Protocol (FTP) or sockets. The same connection is then used to return the response.
Although the connection might be closed at this point, the web server and the process still persist. This offers many advantages. For example, it means that the server and application process can be shut down or restarted separately.
FastCGI was originally developed by Open Market and implemented in its web server offering. The interface can be implemented on any server, however, and it was soon in place on a number of other industry web servers. FastCGI is highly compatible with distributed computing, so a FastCGI application can be running on a separate server to the web serve. This offers all of the advantages of enhancing the availability of systems, of improving scalability and of increasing system security because the components are isolated. By using remote FastCGI, there is less administration because the internal network can handle the running of applications.
Just as a CGI application can generate a response from a Hypertext Transfer Protocol (HTTP) request, so too can FastCGI. It also handles tasks such as verifying authentication and converting data types. These tasks are handled using roles, which can be added and extended freely.
FastCGI is simple to understand and will run with almost any programming language. Processes are isolated, so servers can not be crashed by application-specific issues. Any application built with the FastCGI framework is backward with old servers running CGI. Furthermore, the application library is designed to make the migration of CGI applications simple.