Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
thank you stonecolddevin & sundialsvc4.
You inspired me to look at other options, and I decided to load test all of them with a simple script that connects to a MySQL database to select some UTF8 data, and return it.
I did the test twice. I included a big Perl module (~650KB) in the second test to check if the compilation phase makes sense.
All of the configurations properly returned the UTF8 text.
I did the test on an 8-core Intel 3770 with 16GB of RAM (which was not a bottleneck). OS: FreeBSD 10.0.

I'm curious to hear about what your opinion is of the below results. I find the number of Apache 2.4/FCGI too good to be true, but could not find any errors. Maybe somebody can replicate the test?

100 concurrent requests with ~10KB script: Requests Correct Requests Error AVG_msec Apache 2.4/FCGI 202510 0 14 Apache 2.4/FastCGI/Plack 25584 0 116 Plack standalone 17012 0 175 Apache 2.2/mod_perl 1828 1128 185 100 concurrent requests with ~650KB script: Requests Correct Requests Error AVG_msec Apache 2.4/FCGI 55697 0 52 Apache 2.4/FastCGI/Plack 13971 0 213 Plack standalone 13042 0 228 Apache 2.5/mod_perl 1689 0 217

See here the used scripts, and configuration.

Apache/FCGI script
#!/usr/bin/perl # added to httpd.conf: # LoadModule fcgid_module libexec/apache24/mod_fcgid.so # <IfModule mod_fcgid.c> # AddHandler fcgid-script .fcgi # </IfModule> # # Load testing is done with the following command: # http_load -parallel 100 -seconds 30 ./URLs.txt use FCGI; use DBI; use Encode; $| = 1; binmode STDOUT, ":utf8"; my $request = FCGI::Request(); while($request->Accept() >= 0) { my ($dbh,$select,$body,@row); binmode STDOUT, ":utf8"; $body = "Content-type:text/html; charset=utf-8\r\n\r\n"; $body .= '<html><head><meta http-equiv="Content-Type" content="te +xt/html; charset=utf-8" /></head><body>'; $dbh = DBI->connect('DBI:mysql:database=testdatabase:host=<hostn +ame>:<port>:','root','<password>',{mysql_enable_utf8 => 1}) or die ' +Could not connect'; # connect to the database $select = $dbh->prepare('SELECT testvalue FROM utf8test'); $select->execute; while(@row = $select->fetchrow_array) { $body .= "$row[0]<br>\n"; } $body .= '</body></html>'; $body = encode_utf8($body); print $body; }

Apache/FastCGI/Plack script
#!/usr/bin/env plackup -s FCGI # lines added to httpd.conf: # LoadModule fastcgi_module libexec/apache24/mod_fastcgi.so # FastCgiExternalServer /directory/fcgiplack.fcgi -socket /tmp/fcgi.so +ck # Alias /myapp/ /directory/fcgiplack.fcgi # # plack command: # plackup -s FCGI --listen /tmp/fcgi.sock /directory/fcgiplack.fcgi # # URL used: http://<hostname>/myapp/ use FCGI; use DBI; use Encode; $| = 1; binmode STDOUT, ":utf8"; my $app = sub { my ($env,$dbh,$select,$body,@row); $env = shift; $body = '<html><head><meta http-equiv="Content-Type" content="tex +t/html; charset=utf-8" /></head><body>'; $dbh = DBI->connect('DBI:mysql:database=testdatabase:host=<hostn +ame>:<port>:','root','<password>',{mysql_enable_utf8 => 1}) or die ' +Could not connect'; # connect to the database $select = $dbh->prepare('SELECT testvalue FROM utf8test'); $select->execute; while(@row = $select->fetchrow_array) { $body .= "$row[0]<br>\n"; } $body .= '</body></html>'; $body = encode_utf8($body); return [200,['Content-Type' => 'text/html', charset => 'utf-8'],[$b +ody]]; };

Plack standalone: the same script as Apache/FastCGI/Plack
The command that I used to run it: perl ./fcgiplack.fcgi &> fcgiplack.log &

Apache/mod_perl:
#!/usr/bin/perl use DBI; use Encode; $| = 1; binmode STDOUT, ":utf8"; main(); sub main { my ($dbh,$select,$body,@row); binmode STDOUT, ":utf8"; $body = "Content-type:text/html; charset=utf-8\r\n\r\n"; $body .= '<html><head><meta http-equiv="Content-Type" content="tex +t/html; charset=utf-8" /></head><body>'; $dbh = DBI->connect('DBI:mysql:database=testdatabase:host=<hostn +ame>:<port>:','root','<password>',{mysql_enable_utf8 => 1}) or die ' +Could not connect'; # connect to the database $select = $dbh->prepare('SELECT testvalue FROM utf8test'); $select->execute; while(@row = $select->fetchrow_array) { $body .= "$row[0]<br>\n"; } $body .= '</body></html>'; #$body = encode_utf8($body); print $body; return 1; }

SQL script to create the used database:
/* MySQL 5.6 */ CREATE DATABASE IF NOT EXISTS `testdatabase` /*!40100 DEFAULT CHARACTE +R SET utf8 */; CREATE TABLE IF NOT EXISTS `utf8test` ( `testvalue` char(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; /*!40000 ALTER TABLE `utf8test` DISABLE KEYS */; INSERT INTO `utf8test` (`testvalue`) VALUES ('????'), ('???????'), ('?????????'), ('Ceština'), ('Türkçe');

Initial post with title: New version of Mod_perl Dear respected Perl monks,

I have a mod-perl site that I want to continue using, but my distro doesn't distribute the mod-perl package anymore because there is none available that works with Apache 2.4. It turns out that the loyal mod_perl development team cannot release a compatible version due to a lack of testers.

Can somebody help by assisting them in submitting a bug report?

In reply to 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, details, 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, summary, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others goofing around in the Monastery: (3)
    As of 2025-06-23 21:36 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?
      erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.