hi,
 
I wrote a page with php and servlet and tried to compare their performance. I tried all the methods (using connection pool, even cache the whole page),  to improve to the performance of servlet, but it still slower than php. I read a lot of articals about servlet, and they all say that servlet is faster than cgi. Can anyone tell me why?
 
ps:I cannot post the source code here,  exceeds 300 lines.
check out my page for more detail. http://achilles.stachanov.com/~alvin/lab/phpvsservlet/ ( I put all the source code there).
 
result (tested with suse linux 6.1, blackdown jdk1.1.7, jserv 1.0b5, mysql, mm jdbc driver , php3 and jmeter(random delay with gaussian distribution, average delay=300, dalay deviation=100.0)):
1, just display a date:       
php->average 175 ms, servlet->average  178 ms
 
2, Get data from mysql and format a new page:   
php->average 175 ms, servlet->average  241 ms
(why average time of php does change?????)
 
3, Using Connectionpool,
servlet->average 232 ms
servlet (Use StringBuffer first, and then pw.println(buffer.toString())->average 220 ms
servlet (cache the whole page) -> servlet 185
 
4, change the no of threads in JMeter to 20,
php->average 190 ms, servlet->average  546 ms .....Why?????
 
What wrong? Anyone did this type of test before? Is it the problem of jdk, jserv or.....? How can I improve the preformance?
If I have to use linux, is that mean I better use php? Php is easy to use and runs faster.
 
alvin

Reply via email to