I’m in the process of planning a web service, which will be written in C++. The goal is to be able to select more or less any web server to drive the service. For this to become true, I obviously have to choose a standardized interface between web servers and applications.
Well known methods that I’ve heard of are:
- CGI
- FastCGI
- WSGI
Now, as I have absolutely no experience on using those interfaces, I don’t really know what to choose. I do have some requirements though.
- needs to be reasonably fast (from what I’ve heard of, this pretty much rules out CGI)
- should be easily usable in a pure C/C++ environment (e.g. there should be libraries available)
- must provide support for HTTP 1.1 (dunno if that matters)
Thanks for any suggestions 🙂
WSGI is for Python apps; if your language is C++ this isn’t an option.
FCGI is a good way to go. An FCGI can be invoked as a standard CGI, convenient for debugging and testing, then run as an FCGI in production.
Performance of CGI vs. FCGI depends a lot on what you’re trying to do and the amount of traffic you expect. Tasks that have a lot of startup overhead benefit most from FCGI; the FCGI controller can be configured to spawn additional processes to handle heavy loads.
Practically any web server will run CGI with minimal configuration; you’ll likely need an additional module to run FCGI but that depends on the web server.
http://en.wikipedia.org/wiki/FastCGI