Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FastCGI or HTTP server for C++ daemon behind nginx proxy

Tags:

c++

http

fastcgi

For high performance application accessible over web interface, would it make sense to implement/reuse some http server or go with fastcgi? I was convinced that fcgi would be correct choice, but I come across https://ef.gy/fastcgi-is-pointless and now I'm not so sure..

HTTP doesn't allow handling multiple sessions at one time, but that could be solved with spawning multiple deamon and let nginx act as balancer. But it would probably be much easier to test.

On the other hand, fcgi seems like having all necessary high-performance parts already in place (multiplexing requests in one process, therefore easier to implement cache, ...).

Does HTTP have any advantage over FastCGI aside from being easier to debug?

NOTE: Security is not so much of an issue since either fcgi or http will run behind nginx proxy.

like image 914
graywolf Avatar asked Jul 15 '15 13:07

graywolf


People also ask

What is FastCGI in nginx?

Nginx fastcgi is used to translate requests of clients from an application server which was not handled the request of the client directly. Nginx FastCGI is the protocol that was based on the CGI which is earlier or it will contain the gateway of a common interface.

What is FastCGI server?

FastCGI is a binary protocol for interfacing interactive programs with a web server. It is a variation on the earlier Common Gateway Interface (CGI).


1 Answers

Acting as HTTP server will force you to implement some things which is unrelated to your app's business logic. This includes but not limited to: keep-alive, chunked encodings, decoding forms data and many other little or big things. I'd prefer to stick with fastcgi since its requires less knowledge about transport-level protocol.

like image 130
PSIAlt Avatar answered Sep 18 '22 00:09

PSIAlt