Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 History  





2 Implementation details  





3 Web servers that implement FastCGI  





4 Language bindings for its API  





5 References  





6 External links  














FastCGI






Català
Čeština
Deutsch
Español
فارسی
Français

Italiano
Nederlands

Polski
Русский
Українська

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




Print/export  



















Appearance
   

 






From Wikipedia, the free encyclopedia
 


This is an old revision of this page, as edited by DragonHawk (talk | contribs)at16:53, 1 May 2022 (External links: Clean up. Use citation templates for normalization, formatting, detail. Remove duplicates. Preemptive archive link for Microsoft and their URL-of-the-month club.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff)  Previous revision | Latest revision (diff) | Newer revision  (diff)

FastCGI is a binary protocol for interfacing interactive programs with a web server. It is a variation on the earlier Common Gateway Interface (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 (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 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 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 application programming interfaces (APIs) (Netscape Server Application Programming Interface (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 and mod_php appeared around the same time, and gained popularity quickly. As of 2020, 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.[1]

To service an incoming request, the web server sends environment variable information and the page request to a FastCGI process over either a Unix domain socket, a named pipe, or a Transmission Control Protocol (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. The connection may be closed at the end of a response, but both web server and 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 multiple requests concurrently can be done in several ways: by using one connection with internal multiplexing (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_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 types of requests efficiently.

Web servers that implement FastCGI

Note: unless stated, completeness of FastCGI implementation is unknown

Language bindings for its 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 one language. Application programming interfaces (APIs) exist for:[18]

  • Delphi, Lazarus Free Pascal[20]
  • C, C++
  • Chicken Scheme
  • Common Lisp[21]
  • D
  • Eiffel[22]
  • Erlang
  • GnuCOBOL
  • Go
  • Guile Scheme
  • Haskell
  • VSI BASIC for OpenVMS
  • Java[23][12]
  • Lua
  • node.js[24]
  • OCaml
  • Perl[25]
  • PHP (via php-fpm,[26]orHipHop for PHP[27])
  • Python
  • Ruby
  • Rust[28]
  • SmallEiffel
  • Smalltalk: FasTalk and Dolphin Smalltalk
  • Tcl
  • WebDNA
  • Vala (via C bindings)
  • Xojo (formerly Realbasic, REAL Studio)[29]
  • 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. Archived from the original on 19 January 2016.
  • ^ "FastCGI:A High-Performance Web Server Interface". Open Market, Inc. 1996. Archived from the original on 1 October 2010.
  • ^ Heinlein, Paul (1 November 1998). "FastCGI: Persistent Applications for Your Web Server". Linux Journal. Retrieved 4 October 2010.
  • ^ FastCGI apache module mod_fcgid
  • ^ Debian bug #450748: Please add support for TCP/IP FastCGI servers
  • ^ Issues with Apache 2.4 and PHP-FPM
  • ^ libapache-mod-fastcgi on Github
  • ^ "FastCGI – The Forgotten Treasure/ Section 2.3". Archived from the original on 2010-02-08. Retrieved 2006-02-21.
  • ^ Caddy User Guide – FastCGI
  • ^ FastCGI for Cherokee
  • ^ FastCGI howto for Hiawatha
  • ^ a b FastCGI Support in Jetty
  • ^ FastCGI for Lighttpd
  • ^ "FastCGI Extension for IIS6.0 – RTM". FastCGI for IIS. Microsoft. 2008-02-28. Retrieved 2008-02-29.
  • ^ "FastCGI Nginx module ngx_http_fastcgi_module". nginx.org. NGINX, Inc. Retrieved 20 June 2021.
  • ^ OpenBSD's httpd(8) initial commit
  • ^ "Archived copy". Archived from the original on 2018-01-21. Retrieved 2016-09-19.{{cite web}}: CS1 maint: archived copy as title (link)
  • ^ Application Libraries, Development Kits
  • ^ Matreshka
  • ^ ExtPascal
  • ^ How to use FastCGI from Common Lisp
  • ^ Goanna Eiffel
  • ^ jFastCGI, a Java Servlet implementing FastCGI protocol
  • ^ node-fastcgi npm package
  • ^ There are several 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).
  • ^ http://php.net/manual/en/install.fpm.php
  • ^ FasterCGI with HHVM
  • ^ Several Rust crates exist: A listener implementation is fastcgi, and fastcgi-client is a client implementation.
  • ^ REAL Studio Web Edition, builds web apps called via FastCGI Archived 2011-02-08 at the Wayback Machine
  • External links


    Retrieved from "https://en.wikipedia.org/w/index.php?title=FastCGI&oldid=1085641460"

    Category: 
    Web technology
    Hidden categories: 
    CS1 maint: archived copy as title
    Webarchive template wayback links
    Articles with short description
    Short description is different from Wikidata
    Articles lacking in-text citations from June 2010
    All articles lacking in-text citations
    Articles containing potentially dated statements from 2020
    All articles containing potentially dated statements
     



    This page was last edited on 1 May 2022, at 16:53 (UTC).

    This version of the page has been revised. Besides normal editing, the reason for revision may have been that this version contains factual inaccuracies, vandalism, or material not compatible with the Creative Commons Attribution-ShareAlike License.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki