There's official FastCGI specification and quite old library on fastcgi.com site.
There are also some interesting posts on IIS page in the subject:
http://blogs.iis.net/yaminij/archive/2009/01/08/getting-started-with-writing-a-fastcgi-client-application-fastcgi-test-client.aspx
http://blogs.iis.net/rickjames/archive/2007/02/04/fake-fastcgi-web-server.aspx
Everything looks promising, except connection with IIS over FastCGI assuming multithreaded approach.
There's no problem to handle requests from IIS in app process one by one and lets FastCGI IIS module to spawn new processes if necessary, each handle one request at a time.
Managing processes/threads on fastcgi application side (and not on www server side) gives some additional benefits, some operations (eg. config parsing, decoding licence file, etc...) can be done once and other processes/threads can make use of them.
Going into details ....
Using FastCGI on *nix platform application can handle concurrent requests that way:
socket() / bind() / listen()
// BEGIN thread 1
accept()
// END thread 1
// BEGIN thread 2
accept()
// END thread 2
Unfortunately, using IIS FastCGI module, I can't find proper solution to handle multiple concurrent requests with single process (without spawning new processes by IIS FastCGI module or just to decrease its number).
I can get two things from FastCGI module on application side:
(Let's focus on pipes and leave tcp kind of sockets for a moment...)
1. handle – created using CrateNamedPipe() by IIS FastCGI module
Expand|Select|Wrap|Line Numbers
- HANDLE hPipe;
- hPipe = GetStdHandle( STD_INPUT_HANDLE );
Expand|Select|Wrap|Line Numbers
- getenv("_FCGI_X_PIPE_")
Is there any way to get more handle points to go into multithreaded application version ?
Is there any other way to play with FastCGI IIS module to handle concurrent requests by one application process ?
Is it possible with IIS FastCGI module at all, to handle multiple requests without spawning new app processes by IIS FastCGI module (or just to decrease number of spawning processes) ?
Can I create a named pipe (multiple handle) on application side and pass its name somehow to the IIS module ?
Can I create a new handle to named pipe with given by _FCGI_X_PIPE_ name on application side ?
I've checked several configuration on *nix environments and each of them can handle requests that way... (one application process can handle concurrent multiple requests so it's not necessary to always spawn new app process to handle concurrent request)
- Apache + mod_fastcgi (but not mod_fcgi)
- Nginx
- lighttpd
Does anyone can point me in to the right direction ?
Any help appreciated.