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

In reply to 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
in thread Performance comparison Apache/FastCGI/Plack vs Apache/FCGI vs Plack standalone vs Apache/mod_perl (was "New version of Mod_perl") by adamarc

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.