What is Fast CGI?
Fast CGI (F-CGI) is a binary network protocol used as an interface between an application server and a web server. The network protocol has a similar functionality to the traditional Common Gateway Interface (CGI). The goal in developing the Fast protocol was to circumvent the performance problems of CGI and provide a high-performance Web protocol.[su_list icon=”icon: commenting-o” icon_color=”#187bc0″ indent=”-5″]
Functionality at a glance
The communication is realized connectionless as well as packet-oriented with the web server. Each data packet is provided with the following information in the header:
- the exact protocol version
- the message type
- the request ID
- the length of the subsequent data
The CGI environment variables, among other things, can also be transported as part of a data packet. The request ID makes it possible to distinguish between several clients so that they can be served simultaneously. In contrast to traditional CGI, multiple clients can be served by using a single program instance.
As soon as a web page based on CGI is called, the responsible web server starts the process of the CGI application and closes it again at the end of the request. Since in many cases the applications are written in a scripting language, such as PHP or Perl the corresponding interpreter must be loaded with each call. With traditional CGI, this call takes some time and often lasts longer than the actual execution of the application. The result is a correspondingly large overhead.
Another problem with CGI is the fact that a separate interpreter has to be loaded for each request of the server. If there are several requests at the same time, several copies of the interpreter are loaded into the server’s memory. This can quickly lead to an overload and a crash of the system on heavily loaded web servers.
In direct comparison to classic CGI, with Fast-Common Gateway Interface the executing application with the interpreter is only loaded with the first request. After that it can be used for processing further requests. It makes no difference whether the requests come from the same or different clients. Another distinguishing feature is reflected in the fact that the entire communication with the web server is not realized via environment variables. Instead, TCP network connections or Unix Domain Sockets (UDS) are used.
Fast CGI and Dynamic Web Sites
Fast Common Gateway Interface is the predecessor of dynamic websites. The protocol was primarily developed for data transfer on the World Wide Web, which is why it is now considered obsolete and outdated in the context of dynamic websites. Compared to current solutions, which make it relatively easy to create dynamic websites, F-CGI offers no advantages. Dynamic websites based on the LAMP Stacks offer, for example, a good user experience as well as first-class performance and can also be developed and maintained relatively easily with the available tools.
Fast CGI is a high-performance network protocol that is based on the Common Gateway Interface web technology and is primarily used as an interface between the application server and the web server.
Do you have any more questions?