FastCGI

FastCGI

FastCGI is a protocol for interfacing interactive programs with a web server. FastCGI is a variation on the earlier Common Gateway Interface (CGI); FastCGI's main aim is to reduce the overhead associated with interfacing the web server and CGI programs, allowing a server to handle more web page requests at once.

History

CGI is a protocol for interfacing external applications to web servers. CGI applications run in a separate process, which is created at the start of each request and torn down at the end. This "one process per request" model makes CGI programs very simple to implement, but limits efficiency and scalability. At high loads, the operating system process creation and destruction overhead becomes significant and limits scalability. In addition, the CGI process model limits resource reuse techniques (such as reusing database connections, in-memory caching, etc.).

To address the scalability shortcomings of CGI, Open Market 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's proprietary, in-process API (NSAPI) for developing Web applications.

Although initially developed by Open Market, FastCGI was implemented by a number of other webserver makers. The FastCGI approach, however, competed against other techniques which also aimed to speed and simplify server-subprogram communications, but which didn't follow the CGI paradigm. Apache modules such as mod_perl and mod_php appeared around the same time and seemed to be even better replacements for CGI, allowing closer integration with the core webserver.

Implementation details

Instead of creating a new process for every request, FastCGI can use a single persistent process which handles many requests over its lifetime. Processing of multiple requests simultaneously is achieved either by using a single connection with internal multiplexing (ie. multiple requests over a single connection) and/or by using multiple connections. Many such processes can exist, something that can increase stability and scalability. FastCGI also allows programs to get the web server to do certain simple operations, like reading in a file, before the request is handed over. Environment information and page requests are sent from the web server to the process over a TCP connection (for remote processes) or Unix domain sockets (for local processes). Responses are returned from the process to the web server over the same connection. The connection may be closed at the end of a response, but the web server and the process are left standing.

Many web site administrators and programmers are finding that the separation of web applications from the web server in FastCGI (and the simpler SCGI) has many desirable advantages over embedded interpreters (mod_perl, mod_php, etc.). This separation allows server and application processes to be restarted independently — an important consideration for busy web sites. It also facilitates per-application security policies — important for ISPs and web hosting companies.

Web Servers that implement FastCGI

:"Note: unless stated, completeness of FastCGI implementation is unknown"
* Abyss Web Server
* Apache HTTP Server "(partial)"
** Implemented by either of the third-party modules mod_fastcgi or mod_fcgid
** Multiplexing of requests through a single connection is prohibited by Apache's design [ [http://cryp.to/publications/fastcgi/#AEN147 FastCGI – The Forgotten Treasure/ Section 2.3.] ] , so this isn't supported
* Cherokee HTTP Server [ [http://www.cherokee-project.com/doc/FastCGI.html FastCGI for Cherokee] ]
* Hiawatha webserver [ [http://hiawatha.leisink.org/index.php?page=hiawatha&subpage=howto#fastcgi FastCGI HOWTO for Hiawatha] ]
** Loadbalancing FastCGI support
** Supports chrooted FastCGI servers
* Lighttpd [ [http://trac.lighttpd.net/trac/wiki/Docs:ModFastCGI FastCGI for Lighttpd] ] "(partial)"
** Multiplexing of requests through a single connection is not implemented
* LiteSpeed Web Server
* Microsoft IIS [cite web
url=http://www.iis.net/fastcgi
title=FastCGI Extension for IIS6.0 - RTM
work=FastCGI for IIS
accessdate=2008-02-29
date=2008-02-28
publisher=Microsoft
]
* Kerio WebSTAR
* Nginx
* Open Market Web Server
* Roxen Web Server
* Sun Java System Web Server
* Zeus Web Server

Language bindings for the FastCGI API

FastCGI can be implemented in any language that supports sockets. APIs existFact|date=May 2007 for:
* Borland Delphi/FreePascal at [http://extpascal.googlecode.com ExtPascal]
* C / C++
* Chicken Scheme
* Common Lisp: CLISP and CMUCL
* D programming language
* Guile Scheme
* Goanna Eiffel
* Haskell
* HP BASIC for OpenVMS
* Java
* Lua
* Ocaml
* Mono XSP
* Perl [ [http://search.cpan.org/~lds/CGI.pm-3.29/CGI/Fast.pm CGI Interface for FastCGI] ]
* PHP
* Roadsend PHP
* Python
* Ruby
* SmallEiffel
* Smalltalk: FasTalk and Dolphin Smalltalk
* TCL

FastCGI has enabled web application portability; in contrast, applications developed for embedded interpreters (such as mod_python ) are often tightly bound to the Apache API. Recent frameworks such as Ruby on Rails, Catalyst, Django and Kepler allow use with either the embedded interpreters (mod_ruby , mod_perl, mod_python or mod_lua, respectively) or with FastCGI.

References

External links

* [http://www.fastcgi.com/devkit/doc/fcgi-spec.html FastCGI specification]
* [http://www.fastcgi.com/ FastCGI Web Site]
* [http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html mod_fastcgi – FastCGI module for Apache 1.x]
* [http://fastcgi.coremail.cn/ mod_fcgid – a FastCGI module for Apache 2.x]
* [http://www.iis.net/default.aspx?tabid=1000051 Microsoft FastCGI]
* [http://mproxyfcgi.sourceforge.net/ Apache v2.x mod_proxy FastCGI Module]
* [http://xzdev.com/nginx_fastcgi.html FastCGI C Example ]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • FastCGI — ist ein Standard für die Einbindung externer Software zur Generierung dynamischer Webseiten in einem Webserver. FastCGI ist vergleichbar zum Common Gateway Interface (CGI), wurde jedoch entwickelt, um dessen Performance Probleme zu umgehen.… …   Deutsch Wikipedia

  • FastCGI — est une technique permettant la communication entre un serveur HTTP et un logiciel indépendant. Traditionnellement, les applications Web ont utilisé la Common Gateway Interface (CGI) qui exécute un nouveau processus à chaque requête. La… …   Wikipédia en Français

  • FastCGI — Saltar a navegación, búsqueda FastCGI es una alternativa al CGI estándar, cuya diferencia radica principalmente en el hecho de que el servidor crea un único proceso persistente por cada programa FastCGI en lugar de uno por cada solicitud del… …   Wikipedia Español

  • FastCGI — es una alternativa al CGI estándar, cuya diferencia radica principalmente en el hecho de que el servidor crea un único proceso persistente por cada programa FastCGI en lugar de por cada solicitud del cliente …   Enciclopedia Universal

  • FastCGI — Интерфейс FastCGI клиент серверный протокол взаимодействия веб сервера и приложения, дальнейшее развитие технологии CGI. По сравнению с CGI является более производительным и безопасным. FastCGI снимает множество ограничений CGI программ.… …   Википедия

  • FastCGI — s. FCGI …   Acronyms

  • FastCGI — s. FCGI …   Acronyms von A bis Z

  • Comparison of server-side JavaScript solutions — This is a list of Server side JavaScript solutions. Contents 1 Server side JavaScript use 2 See also 3 External links 4 References …   Wikipedia

  • CGI-Script — Das Common Gateway Interface (CGI) – in etwa Allgemeine Vermittlungsrechner Schnittstelle – ist ein Standard für den Datenaustausch zwischen einem Webserver und dritter Software, die Anfragen bearbeitet. CGI ist eine schon länger bestehende… …   Deutsch Wikipedia

  • Common Gateway Interface — This article is about the interface between a web server and an external application. For the term CGI in computer graphics, see Computer generated imagery. The Common Gateway Interface (CGI) is a standard (see RFC 3875: CGI Version 1.1) method… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”