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
####
#!/usr/bin/perl
# added to httpd.conf:
# LoadModule fcgid_module libexec/apache24/mod_fcgid.so
#
# AddHandler fcgid-script .fcgi
#
#
# 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 .= '';
$dbh = DBI->connect('DBI:mysql:database=testdatabase:host=::','root','',{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]
\n";
}
$body .= '';
$body = encode_utf8($body);
print $body;
}
##
##
#!/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.sock
# Alias /myapp/ /directory/fcgiplack.fcgi
#
# plack command:
# plackup -s FCGI --listen /tmp/fcgi.sock /directory/fcgiplack.fcgi
#
# URL used: http:///myapp/
use FCGI;
use DBI;
use Encode;
$| = 1;
binmode STDOUT, ":utf8";
my $app = sub {
my ($env,$dbh,$select,$body,@row);
$env = shift;
$body = '';
$dbh = DBI->connect('DBI:mysql:database=testdatabase:host=::','root','',{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]
\n";
}
$body .= '';
$body = encode_utf8($body);
return [200,['Content-Type' => 'text/html', charset => 'utf-8'],[$body]];
};
##
##
#!/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 .= '';
$dbh = DBI->connect('DBI:mysql:database=testdatabase:host=::','root','',{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]
\n";
}
$body .= '';
#$body = encode_utf8($body);
print $body;
return 1;
}
##
##
/* MySQL 5.6 */
CREATE DATABASE IF NOT EXISTS `testdatabase` /*!40100 DEFAULT CHARACTER 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');