adamarc has asked for the wisdom of the Perl Monks concerning the following question:
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?
See here the used scripts, and configuration.
Apache/FCGI script
Apache/FastCGI/Plack script
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:
SQL script to create the used database:
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?
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 ('????'), ('???????'), ('?????????'), ('Cetina'), ('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?
- install httpd 2.4 and checkout the RC1 version of mod_perl at https://svn.apache.org/repos/asf/perl/modperl/trunk/
- run "perl Makefile.pl" ;-)
- submitting results to the developers mailing list.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: New version of Mod_perl
by stonecolddevin (Parson) on Jan 29, 2015 at 20:48 UTC | |
by adamarc (Initiate) on Jan 29, 2015 at 21:34 UTC | |
by stonecolddevin (Parson) on Jan 29, 2015 at 21:56 UTC | |
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 | |
Re: New version of Mod_perl
by sundialsvc4 (Abbot) on Jan 29, 2015 at 23:30 UTC | |
by Ea (Chaplain) on Feb 04, 2015 at 08:51 UTC | |
by Anonymous Monk on Feb 04, 2015 at 10:05 UTC |
Back to
Seekers of Perl Wisdom