search by tags

for the user

adventures into the land of the command line

GI what?

What are all these things? I know they relate to serving dynamic web applications from a server, which can be written in different languages.

But I always wondered... what are they? What's the difference?

CGI (Common Gateway Interface)

Starts up a new process per request. Slow. The oldest one and supported by every server out of the box.

FastCGI (Fast Common Gateway Interface)

It's CGI, but as a long-running background process. Faster. There is no setup overhead for each request, but uses more memory. The web app can be written in any language, but the language just needs to have a library which handles the communication with the web server.

SCGI (Simple Common Gateway Interface)

A simpler FastCGI because it is designed to be easier to parse.

AJP (Apache JServ Protocol)

A Java FastCGI.

WSGI (Web Server Gateway Interface)

A WSGI server wraps a back-end process using one or more of the above protocols. Defined in PEP-333. When choosing a framework for web development it is a good idea to choose one which supports WSGI.

The big benefit of WSGI is the unification of the application programming interface. When your program is compatible with WSGI – which at the outer level means that the framework you are using has support for WSGI – your program can be deployed via any web server interface for which there are WSGI wrappers. You do not need to care about whether the application user uses mod_python or FastCGI or mod_wsgi – with WSGI your application will work on any gateway interface.