Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Most efficient way to run Perl scripts on nginx server?

by ultranerds (Hermit)
on Apr 01, 2017 at 07:00 UTC ( [id://1186660]=perlquestion: print w/replies, xml ) Need Help??

ultranerds has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm currently battling with a REALLY frustrating bug with nginx and Apache 2.4 (as a proxy). We serve all the main content up with nginx, and then pass the Perl stuff to Apache, so we can make use of mod_perl. The problem is I'm having all kinds of issues with Apache gobbling up tons of CPU:

http://serverfault.com/questions/841786/apache-2-4-cpu-running-at-100-for-unknown-reason

So this has me asking.. do I need Apache?

Does anyone have input on the best way to run Perl scripts on a server with nginx? Is it better as:

1) nginx, with reverse proxy to Apache (where we have mod_perl setup)

OR

2) nginx, and using FastCGI to serve them up, like: https://www.linode.com/docs/websites/nginx/nginx-and-perlfastcgi-on-ubuntu-12-04-lts-precise-pangolin -ie don't even bother with Apache2 (this would remove the headache of having 2 systems running as well then!)

I just wanted to get a 2nd opinion from "the monks" before I started trying out the FastCGI option, as I've already spent far too much time on this :(

UPDATE: I thought I would just give it a quick test, and it does seem FastCGI with nginx is pretty slow :(

Exactly the same script:

704ms Apache2 with mod_perl
1144ms nginx with fastCGI


Thanks!

Andy
  • Comment on Most efficient way to run Perl scripts on nginx server?

Replies are listed 'Best First'.
Re: Most efficient way to run Perl scripts on nginx server?
by Your Mother (Archbishop) on Apr 01, 2017 at 15:24 UTC

    I recommend uWSGI. It is a deep and flexible application server and it can be built with a PSGI plugin for Perl. I am using it on linode for a couple of different applications on the same host.

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1186660]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2024-04-19 08:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found