Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Performance comparison Apache/FastCGI/Plack vs Apache/FCGI vs Plack standalone vs Apache/mod_perl (was "New version of Mod_perl")

by vincent_veyron (Sexton)
on Feb 02, 2015 at 23:25 UTC ( [id://1115327]=note: print w/replies, xml ) Need Help??


in reply to Performance comparison Apache/FastCGI/Plack vs Apache/FCGI vs Plack standalone vs Apache/mod_perl (was "New version of Mod_perl")

Yuk : Apache 2.2/mod_perl 1828 1128 185

Not sure what those 1128 errors are, but your script does not make use of connection caching, so you are creating a new connection every time. You should use Apache::DBI or connect_cached to make use of persistent connections; the handler I pasted below generates 260 pages per second on my 3 year old laptop (3.8ms/request).

You can also use a proxy (e.g. nginx) in front of mod_perl to serve pages to slow client; see : http://perl.apache.org/docs/1.0/guide/strategy.html (old doc but the principle is still valid).

That still leaves the problem regarding apache 2.4. Is it not possible to install/build 2.2 on your distribution, while you wait for mod_perl to be ready?

package Carnet::bench ; use lib qw(/home/lib); use strict ; use warnings ; use Apache2::Const -compile => qw( OK REDIRECT ) ; sub handler { my $r = shift ; my $dbh = DBI->connect_cached( "DBI:Pg:dbname=xyz", 'john', undef, + { PrintError => 1, RaiseError => 1, AutoCommit => 1, pg_bool_tf => 1 } ) or die "Cannot connect to db" ; my $sql = 'select name from names' ; my $data_set = $dbh->selectall_arrayref($sql) ; my $list ; for ( @{$data_set} ) { $list .= '<li>' . $_->[0] . '</li>' ; } my $content = '<html><body><ul>' . $list . '</ul></body></html>' ; $r->content_type('text/html; charset=utf-8') ; print $content ; return Apache2::Const::OK ; } 1 ;


libremen.com : legal case, contract and insurance claim management software
  • Comment on Re: Performance comparison Apache/FastCGI/Plack vs Apache/FCGI vs Plack standalone vs Apache/mod_perl (was "New version of Mod_perl")
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1115327]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-26 00:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found