FastCGI is a
binary protocol
A communication protocol is a system of rules that allows two or more entities of a communications system to transmit information via any kind of variation of a physical quantity. The protocol defines the rules, syntax, semantics and synchroni ...
for interfacing interactive programs with a
web server
A web server is computer software and underlying hardware that accepts requests via HTTP (the network protocol created to distribute web content) or its secure variant HTTPS. A user agent, commonly a web browser or web crawler, initi ...
. It is a variation on the earlier
Common Gateway Interface
In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program, typically to process user requests.
Such programs are often written in a scripting language and are commonly re ...
(CGI). FastCGI's main aim is to reduce the overhead related to interfacing between web server and CGI programs, allowing a server to handle more web page requests per unit of time.
History
Common Gateway Interface
In computing, Common Gateway Interface (CGI) is an interface specification that enables web servers to execute an external program, typically to process user requests.
Such programs are often written in a scripting language and are commonly re ...
(CGI) is a protocol for interfacing external applications to web servers. CGI applications run in separate
processes
A process is a series or set of activities that interact to produce a result; it may occur once-only or be recurrent or periodic.
Things called a process include:
Business and management
*Business process, activities that produce a specific se ...
, which are created at the start of each request and torn down at the end. This "one new process per request" model makes CGI programs very simple to implement, but limits efficiency and scalability. At high loads, the
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs.
Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
overhead for process creation and destruction becomes significant. Also, the CGI process model limits resource reuse methods, such as reusing database connections, in-memory caching, etc.
To address the scalability shortcomings of CGI,
Open Market
The term open market is used generally to refer to an economic situation close to free trade. In a more specific, technical sense, the term refers to interbank trade in securities.
In economic theory
Economists judge the "openness" of markets a ...
developed FastCGI and first introduced it in their webserver product in the mid-1990s. Open Market originally developed FastCGI in part as a competitive response to
Netscape
Netscape Communications Corporation (originally Mosaic Communications Corporation) was an American independent computer services company with headquarters in Mountain View, California and then Dulles, Virginia. Its Netscape web browser was on ...
's proprietary, in-process
application programming interfaces (APIs) (
Netscape Server Application Programming Interface
The Netscape Server Application Programming Interface (NSAPI) is an application programming interface for extending server software, typically web server software.
History
NSAPI was initially developed by Rob McCool at Netscape for use in Nets ...
(NSAPI)) for developing Web applications.
While developed first by Open Market, FastCGI was then implemented by several other webserver makers. However, its approach competed against other methods to speed and simplify server-subprogram communication.
Apache HTTP Server modules such as
mod_perl
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, U ...
and
mod_php
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, U ...
appeared around the same time, and gained popularity quickly. , all of these various methods, including CGI, remain in common use.
Implementation details
Instead of creating a new process for each request, FastCGI uses persistent processes to handle a series of requests. These processes are owned by the FastCGI server, not the web server.
To service an incoming request, the web server sends
environment variable
An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP env ...
information and the page request to a FastCGI process over either a
Unix domain socket
A Unix domain socket aka UDS or IPC socket ( inter-process communication socket) is a data communications endpoint for exchanging data between processes executing on the same host operating system. It is also referred to by its address family AF_U ...
, a
named pipe
In computing, a named pipe (also known as a FIFO for its behavior) is an extension to the traditional pipe concept on Unix and Unix-like systems, and is one of the methods of inter-process communication (IPC). The concept is also found in OS/ ...
, or a
Transmission Control Protocol
The Transmission Control Protocol (TCP) is one of the main protocols of the Internet protocol suite. It originated in the initial network implementation in which it complemented the Internet Protocol (IP). Therefore, the entire suite is common ...
(TCP) connection. Responses are returned from the process to the web server over the same connection, and the web server then delivers that response to the
end user
In product development, an end user (sometimes end-user) is a person who ultimately uses or is intended to ultimately use a product. The end user stands in contrast to users who support or maintain the product, such as sysops, system administrat ...
. The connection may be closed at the end of a response, but both web server and FastCGI service processes persist.
Each individual FastCGI process can handle many requests over its lifetime, thereby avoiding the overhead of per-request process creation and termination. Processing multiple requests concurrently can be done in several ways: by using one connection with internal
multiplexing
In telecommunications and computer networking, multiplexing (sometimes contracted to muxing) is a method by which multiple analog or digital signals are combined into one signal over a shared medium. The aim is to share a scarce resource - a ...
(i.e., multiple requests over one connection); by using multiple connections; or by a mix of these methods. Multiple FastCGI servers can be configured, increasing stability and scalability.
Web site administrators and programmers can find that separating web applications from the web server in FastCGI has many advantages over embedded interpreters (
mod_perl
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, U ...
,
mod_php
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, U ...
, etc.). This separation allows server and application processes to be restarted independently – an important consideration for busy web sites. It also enables the implementation of per-application, hosting service security policies, which is an important requirement for ISPs and web hosting companies.
Different types of incoming requests can be distributed to specific FastCGI servers which have been equipped to handle those types of requests efficiently.
Web servers that implement FastCGI
:''Note: unless stated, completeness of FastCGI implementation is unknown''
*
Apache HTTP Server ''(partial)''
** Implemented by . This module used to be third-party, but was granted to
The Apache Software Foundation
The Apache Software Foundation (ASF) is an American nonprofit corporation (classified as a 501(c)(3) organization in the United States) to support a number of open source software projects. The ASF was formed from a group of developers of the ...
(ASF) as an Apache Server subproject in 2009, shepherded by Chris Darroch. It only supports Unix domain sockets, no TCP sockets.
** A third-party module is also being used. For a while, this module no longer compiled properly under Apache 2.4.x, although that problem has been solved with a fork of the original project.
** Multiplexing of requests through one connection is prohibited by Apache 1.x design, so this isn't supported
** In Apache 2.4, was added, supporting TCP FastCGI servers.
*
Caddy
Caddy may refer to:
* Caddie, also spelled caddy, a golfer's assistant
* A shopping caddy
* A box or bin, such as a "green bin" for food waste
* Caddy (bridge), an assistant to a tournament director
* Caddy (surname)
* Caddy (given name)
* C ...
*
Cherokee
The Cherokee (; chr, ᎠᏂᏴᏫᏯᎢ, translit=Aniyvwiyaʔi or Anigiduwagi, or chr, ᏣᎳᎩ, links=no, translit=Tsalagi) are one of the indigenous peoples of the Southeastern Woodlands of the United States. Prior to the 18th century, th ...
*
Hiawatha
Hiawatha ( , also : ), also known as Ayenwathaaa or Aiionwatha, was a precolonial Native American leader and co-founder of the Iroquois Confederacy. He was a leader of the Onondaga people, the Mohawk people, or both. According to some accou ...
** Loadbalancing FastCGI support
** Supports chrooted FastCGI servers
*
Jetty
A jetty is a structure that projects from land out into water. A jetty may serve as a breakwater, as a walkway, or both; or, in pairs, as a means of constricting a channel. The term derives from the French word ', "thrown", signifying somet ...
[FastCGI Support in Jetty](_blank)
/ref>
* Kerio WebSTAR
Kerio Technologies, Inc. is a former technology company specializing in collaboration software and unified threat management for small and medium organizations. Founded in 2001, Kerio is headquartered in San Jose, California. In January 2017, GFI ...
* Lighttpd
lighttpd (pronounced "lighty") is an open-source web server optimized for speed-critical environments while remaining standards-compliant, secure and flexible. It was originally written by Jan Kneschke as a proof-of-concept of the c10k problem � ...
* LiteSpeed Web Server
LiteSpeed Web Server (LSWS) is proprietary web server software. It is the 4th most popular web server, estimated to be used by 10% of websites as of July 2021. LSWS is developed by privately held LiteSpeed Technologies. The software uses the sa ...
* Microsoft IIS
Internet Information Services (IIS-pronounced 2S, formerly Internet Information Server) is an extensible web server software created by Microsoft for use with the Windows NT family. IIS supports HTTP, HTTP/2, HTTPS, FTP, FTPS, SMTP and ...
* Nginx
Nginx (pronounced "engine x" ) is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Igor Sysoev and publicly released in 2004. Nginx is free and open-source software ...
* NaviServer
NaviServer is a high performance web server written in C and Tcl. It can be easily extended in either language to create web sites and services; there are over 35 modules available (including database integration or protocol support for UDP, SM ...
* Oracle iPlanet Web Server
Oracle iPlanet Web Server (OiWS) is a web server designed for medium and large business applications. Previous versions were marketed as Netscape Enterprise Server, iPlanet Web Server, Sun ONE Web Server, and Sun Java System Web Server.
Oracle ...
* OpenBSD
OpenBSD is a security-focused operating system, security-focused, free and open-source, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by fork (software development), forking N ...
's
* Open Market
The term open market is used generally to refer to an economic situation close to free trade. In a more specific, technical sense, the term refers to interbank trade in securities.
In economic theory
Economists judge the "openness" of markets a ...
web server
* Resin
In polymer chemistry and materials science, resin is a solid or highly viscous substance of plant or synthetic origin that is typically convertible into polymers. Resins are usually mixtures of organic compounds. This article focuses on n ...
web and application server
* Roxen
Roxen () is a medium-sized lake in south-central Sweden, east of Lake Vättern, part of the waterpath Motala ström and the Göta Canal. South of Lake Roxen is the city Linköping.
Roxen, especially the western parts, is very good for birdwatch ...
web server
* ShimmerCat
ShimmerCat was a web server designed from ground-up for HTTP/2 and written in Haskell; it now appears to be an image optimization and distribution service. The purported purpose of the server was to take full advantage of HTTP/2 features, includ ...
web server
* Zeus Web Server
Zeus Web Server is a discontinued proprietary high-performance web server for Unix and Unix-like platforms (including Solaris, FreeBSD, HP-UX and Linux). It was developed by Zeus Technology, a software company located in Cambridge, England tha ...
Language bindings for its API
FastCGI can be implemented in any language that supports network socket
A network socket is a software structure within a network node of a computer network that serves as an endpoint for sending and receiving data across the network. The structure and properties of a socket are defined by an application programmin ...
s. Since "FastCGI is a protocol, not an implementation," it is not tightly bound to any one language. Application programming interfaces (APIs) exist for:Application Libraries, Development Kits
/ref>
Recent frameworks such as Ruby on Rails
Ruby on Rails (simplified as Rails) is a server-side web application framework written in Ruby under the MIT License. Rails is a model–view–controller (MVC) framework, providing default structures for a database, a web service, and web ...
, Catalyst
Catalysis () is the process of increasing the rate of a chemical reaction by adding a substance known as a catalyst (). Catalysts are not consumed in the reaction and remain unchanged after it. If the reaction is rapid and the catalyst recyc ...
, Django, Kepler and Plack allow use with either the embedded interpreters ( mod_ruby, mod_perl
Mod, MOD or mods may refer to:
Places
* Modesto City–County Airport, Stanislaus County, California, US
Arts, entertainment, and media Music
* Mods (band), a Norwegian rock band
* M.O.D. (Method of Destruction), a band from New York City, U ...
, mod_python
mod_python is an Apache HTTP Server module that integrates the Python programming language with the server. It is intended to provide a Python language binding for the Apache HTTP Server.
When mod_python released it was one of the more efficient ...
or mod_lua, for example), or FastCGI.
References
External links
* — fork/mirror of old FastCGI website
**
* — Old FastCGI home page, as it appeared when working
* Implementations
** — Implementation for Apache httpd
** — Implementation for Microsoft IIS
** — Experimental implementation for Apache 2.x mod_proxy
{{DEFAULTSORT:Fastcgi
Web technology