BBS水木清华站∶精华区

发信人: midi (迷笛), 信区: Java        
标  题: Re: CGI, mod_perl, PHP, JSP性能实测比较[转] (转载) 
发信站: BBS 水木清华站 (Fri May  5 23:18:01 2000) 
 
这有什么好苦闷的呢? 
好吧,我做了个大符合的测试,在Netscape Enterprise Server 4.0 for Linux上 
静态html: 
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> 
<html> 
<head> 
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
   <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; U) [Netscape]"> 
</head> 
<body> 
 
<center><font size=+2>Netscape Enterprise Server 4.0 Servlets SDK</font></center> 
 
<hr WIDTH="100%"> 
<br>The following is a set of samples and example components, plugins and 
technologies supported by Netscape Enterprise Server 4.0 Servlet Engine.&nbsp; 
This includes binaries, all code, a build enviroment and instructions on 
how to install and run. 
 
</body> 
</html> 
 
一,将其直接欢名做readme.html 
二,将其直接换名做readme.jsp 
三,将其直接用在cgi程序中。 
 
测试一,静态连接,共5000个请求,并发500个: 
 
ab -n 5000 -c 500 http://localhost/jspa/readme.html 
This is ApacheBench, Version 1.3c <$Revision: 1.38 $> apache-1.3 
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 
Copyright (c) 1998-1999 The Apache Group, http://www.apache.org/ 
 
Server Software:        Netscape-Enterprise/4.1 
Server Hostname:        localhost 
Server Port:            80 
 
Document Path:          /jspa/readme.html 
Document Length:        613 bytes 
 
Concurrency Level:      500 
Time taken for tests:   14.355 seconds 
Complete requests:      5000 
Failed requests:        0 
Total transferred:      4350350 bytes 
HTML transferred:       3193730 bytes 
Requests per second:    348.31 
Transfer rate:          303.05 kb/s received 
 
Connnection Times (ms) 
              min   avg   max 
Connect:        2   848  9188 
Processing:     4   377   252 
Total:          6  1225  9440 
 
测试二,JSP,5000个请求,并发500个: 
ab -n 5000 -c 500 http://localhost/jspa/readme.jsp 
This is ApacheBench, Version 1.3c <$Revision: 1.38 $> apache-1.3 
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 
Copyright (c) 1998-1999 The Apache Group, http://www.apache.org/ 
 
Server Software:        Netscape-Enterprise/4.1 
Server Hostname:        localhost 
Server Port:            80 
 
Document Path:          /jspa/readme.jsp 
Document Length:        614 bytes 
 
Concurrency Level:      500 
Time taken for tests:   19.738 seconds 
Complete requests:      5000 
Failed requests:        0 
Total transferred:      4107353 bytes 
HTML transferred:       3204466 bytes 
Requests per second:    253.32 
Transfer rate:          208.09 kb/s received 
 
Connnection Times (ms) 
              min   avg   max 
Connect:        5   757  9382 
Processing:   113   977   899 
Total:        118  1734 10281 
 
测试三,CGI,5000个请求,并发500个 
Fail掉了,我没耐心,重启了机器,因为硬盘狂转了一分钟。 
 
将并发用户转为50, 
Requests per second分别为: 
static HTML: 823.18 
JSP: 361.93 
对比在重符合情况下静态HTML和JSP的差距348.31/253.32=1.37:1 
轻负荷:823.18/361.93=2.27:1 
可以看出JAVA Servlet在重符合下的优势。 
 
同一台机器,运行Apache,静态HTML的反应: 
500并发用户时327.27 
50时:522.52 
 
 
 
 
【 在 maht (Trill-TimeKiller) 的大作中提到: 】 
 这次,我用过IBM和Sun(Blackdown)的,Inprise不知道怎样, 
 也试过Native/Green,奇怪的是Native和Green的区别很小 
 在这个样的测试中由于JSP页面很小,所以出现这样的情况 
 结果是内存富裕,用不到64M,而CPU是瓶颈 
 这样,我相信可能是一个重要的影响,我想搞出个每次都是不一样的 
 来比较,不被cache,这样比较才有意义 
 你的测试我看过,所以我才认为他的那个是很有问题的。 
 但是还是很郁闷 
 
 
-- 
※ 修改:·midi 於 May  5 23:19:40 修改本文·[FROM:  159.226.41.166] 
※ 来源:·BBS 水木清华站 smth.org·[FROM: 159.226.41.166] 

BBS水木清华站∶精华区