World Library  
Flag as Inappropriate
Email this Article

FastCGI

Article Id: WHEBN0030872021
Reproduction Date:

Title: FastCGI  
Author: World Heritage Encyclopedia
Language: English
Subject: Common Gateway Interface, Web2py, Nginx, Java servlet, PHP
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

FastCGI

FastCGI is a binary 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 separate processes, 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 process creation and destruction overhead becomes significant. 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. Apache modules such as mod_perl and mod_php appeared around the same time, and they also quickly gained popularity. Today, all of these various approaches (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.[1]

To service an incoming request, the web server sends environment information and the page request itself to a FastCGI process over a socket (in the case of local FastCGI processes on the web server) or TCP connection (for remote FastCGI processes in a server farm). Responses are returned from the process to the web server over the same connection, and the web server subsequently delivers that response to the end-user. The connection may be closed at the end of a response, but both the web server and the FastCGI service processes persist.[2]

Each individual FastCGI process can handle many requests over its lifetime, thereby avoiding the overhead of per-request process creation and termination. Processing of multiple requests simultaneously can be achieved in several ways: by using a single connection with internal multiplexing (i.e. multiple requests over a single connection); by using multiple connections; or by a combination of these techniques. Multiple FastCGI servers can be configured, increasing stability and scalability.

Web site administrators and programmers can find that the separation of web applications from the web server in FastCGI has many 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 enables the implementation of per-application / hosting service security policies, which is an important requirement for ISPs and web hosting companies.[3] Different types of incoming requests can be distributed to specific FastCGI servers which have been equipped to handle those particular types of requests efficiently.

Web Servers that implement FastCGI

Note: unless stated, completeness of FastCGI implementation is unknown

Language bindings for the FastCGI API

FastCGI can be implemented in any language that supports network sockets. (Since "FastCGI is a protocol, not an implementation," it is not tightly bound to any language at all.) APIs exist[14] for:

Recent frameworks such as Ruby on Rails, Catalyst, Django, Kepler and Plack allow use with either the embedded interpreters (mod_ruby, mod_perl, mod_python or mod_lua, for example), or FastCGI.

References

  1. ^ "FastCGI Specification". Open Market, Inc. 1996. 
  2. ^ "FastCGI:A High-Performance Web Server Interface". Open Market, Inc. 1996. Retrieved 4 October 2010. 
  3. ^ Paul Heinlein (1 November 1998). "FastCGI: Persistent Applications for Your Web Server". Linux Journal. Retrieved 4 October 2010. 
  4. ^ FastCGI apache module mod_fcgid
  5. ^ Debian bug #450748: Please add support for TCP/IP FastCGI servers
  6. ^ Issues with Apache 2.4 and PHP-FPM
  7. ^ libapache-mod-fastcgi on Github
  8. ^ FastCGI – The Forgotten Treasure/ Section 2.3.
  9. ^ FastCGI for Cherokee
  10. ^ FastCGI HOWTO for Hiawatha
  11. ^ FastCGI for Lighttpd
  12. ^ "FastCGI Extension for IIS6.0 - RTM". FastCGI for IIS. Microsoft. 2008-02-28. Retrieved 2008-02-29. 
  13. ^ OpenBSD's httpd(8) initial commit
  14. ^ Application Libraries / Development Kits
  15. ^ Matreshka
  16. ^ ExtPascal
  17. ^ How to use FastCGI from Common Lisp
  18. ^ Goanna Eiffel
  19. ^ jFastCGI, a Java Servlet implementing FastCGI protocol
  20. ^ node-fastcgi npm package
  21. ^ There are a number of FastCGI modules for Perl: FCGI (a compiled module written in C), FCGI::Async (for asynchronous FastCGI applications), AnyEvent::FCGI (for AnyEvent-based applications), FCGI::EV (for EV-based applications), CGI::Fast (Perl CGI-like interface for FastCGI), FCGI::Client (a FastCGI client library), and Net::FastCGI (constants and functions to build and parse FastCGI messages).
  22. ^ FasterCGI with HHVM
  23. ^ REAL Studio Web Edition, builds web apps called via FastCGI

External links

  • FastCGI specification
  • FastCGI Web Site
  • mod_fastcgi – FastCGI module for Apache 1.x and 2.x supporting external applications
  • mod_fcgid - a FastCGI module for Apache 2.x
  • Microsoft FastCGI
  • Apache v2.x mod_proxy FastCGI Module
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.