nginx and Perl: FastCGI vs reverse proxy (PSGI/Starman)

A very popular choice for running Perl web applications these days seems to be behind a nginx webserver proxying requests to either a FastCGI daemon or a PSGI enabled webserver (e.g. Starman).

There have been lots of question as to why one would do this in general (e.g. Why use nginx with Catalyst/Plack/Starman?) and the answers seem to apply in both cases (e.g. allow nginx to serve static content, easy restart of application server, load balancing, etc.)

However, I am specifically interested in the pros/cons of using FastCGI vs a reverse-proxy approach. It seems that Starman is widely considered to be the fastest and best Perl PSGI application/web server out there, and I am struggling to see any advantages to using FastCGI at all. Both approaches seem to support:

  • UNIX domain sockets aswell as TCP sockets
  • fork/process manager style servers aswell as non-blocking event-based (e.g. AnyEvent) servers.
  • Signal handling/graceful restart
  • PSGI

Similarly, nginx configuration for either option is very similar.

So why you would choose one over the other?

19
задан Community 23 May 2017 в 10:29
поделиться