I'm currently developing highload project, i need to use C/FastCGI/nginx combination.
The problem is, i need my FastCGI application to run in threads/processes.
I know two ways to do that:
1) Compile program and than use spawn-fcgi to fork processes. (I can't use this one)
2) Run FCGX_Init()
, than pre-fork to 10 processess BEFORE while (FCGX_Accept_r(&request) >= 0)
3) Run pthreads AFTER while (FCGX_Accept_r(&request) >= 0)
So, my question is: whis is the fastest way to run fastcgi application. Can I pre-fork fastcgi application after this:
int sock = FCGX_OpenSocket(":9000", 10);
FCGX_InitRequest(&request, sock, 0);
Can 10 processes listen to single socket ? Do i have to use threads, if i have N processes running ? Is this will be enough ?