Author: yiwangaffectionate
** Note! **
The test results depend heavily on the hardware/software configurations of the machine and vary with the configuration changes. Therefore:
This test result is for reference only *
Tested hardware:
CPU: Intel PII 300 (66x4.5)
Ram: 192 m
HD: IBM 20 GB (2 m cache)
Testing Software:
OS: slackware 7 (self-compiled 2.2.14 core)
Web: Apache 1.3.12 (standard modules are configured by default, and all modules are statically compiled)
PHP 4.0 RC1 (supported by MySQL)
Mod_perl 1.23 (default configuration, without everything = 1)
Apachejserv 1.1 (default configuration)
JDK: JDK 1.2.2
Jsdk: jsdk 2
JSP: gnujsp 1.0.0
JSP: gnujsp 1.0.0
In this test, Apache Connector (AB) is used. The command is as follows:
/Www/bin/AB-C 20-N 1000 cgi/Script URL
This command uses 20 concurrent connections to perform 1000 requests.
All tests are performed on the local machine, and all tests are performed five times repeatedly. After the maximum and minimum values are removed, the average value is obtained.
I tested CGI written in C and CGI written in Perl, and perl cgi, PHP, and JSP executed in mod_perl.
Various cgi/scripts output similar simple pages with the following content:
Html
Body
H1the XXXX hello program/H1
P
Hello XXXX world!
/Body
/Html
Test results (only the most representative requests per second is used to process requests per second)
Number of requests processed per second for CGI/script types
C CGI 128
Perl cgi 69
MoD _ Perl 223
Python 237
JSP 21
In addition to JSP, the performance of several other cgi/scripts is generally normal. The Perl program is interpreted and executed
When CGI is running, another fork process is required, so the slowest. Both mod_perl and PHP run directly in httpd.
Line scripts Save the consumption of fork, so it is much faster; C programs should be the fastest, but as CGI
The performance of a row is greatly reduced due to fork.
As for JSP... I think this result is not representative. After all, the testing machine only has MB of memory.
A Java account for 11 Mb. Moreover, the testing machine itself is a Web server, and there are several other tests
Ten httpd are running
However, in any case, running PHP and mod_perl on servers with low configurations is better than JSP in terms of performance.
Yes.
Attached test application:
C program Hello. c
# Include stdio. h
Int main (void)
{
Char s [] = "C cgi ";
Printf ("Content-Type: text/html ");
Printf ("html"
"Body"
"H1the c cgi hello program/H1"
"P"
"Hello % s world! "
"/Body"
"/Html", S );
Return 0;
}
Compile with GCC-O hello. C and put hello in the cgi-bin directory.
Perl program Hello. pl
#! /Usr/bin/perl
#! /Usr/bin/perl
$ S = "Perl cgi ";
Print "Content-Type: text/html ";
Print <done
Html
Body
H1the perl cgi hello program/H1
P
Hello $ s world!
/Body
/Html
Done
Put hello. pl in the cgi-bin directory for testing the perl cgi and mod_perl scripts.
PHP file hello. php
Html
Body
H1the PHP hello program/H1
<? $ S = "php";?>;
P
Hello <? Echo $ s?>; World!
/Body
/Body
/Html
JSP file hello. jsp
Html
Body
H1the JSP hello program/H1
P
<% String S = "jsp"; %>;
P
Hello <% = S %>; World!
/Body
/Html