Springmvc + freemarker and servlet Performance Comparison

Source: Internet
Author: User

In order to better test the fairness, the message. flt is replaced with a space.


Html code
<Html> <body> <p> This is my message: <br >$ {message} </p> </body>
<Html> <body> <p> This is my message: <br >$ {message} </p> </body>

 


Compile servlet
Java code
Package com. AB. test;

Import java. io. IOException;

Import javax. servlet. ServletOutputStream;
Import javax. servlet. http. HttpServlet;
Import javax. servlet. http. HttpServletRequest;
Import javax. servlet. http. HttpServletResponse;

Public class ABTestServlet extends HttpServlet {
Public void service (HttpServletRequest request, HttpServletResponse response)
Throws IOException {
String message = (String) request. getParameter (& quot; message & quot ;);
ServletOutputStream out = response. getOutputStream ();
Out. print (& quot; This is my message: & quot; + message + & quot ;);
}
}
Package com. AB. test;

Import java. io. IOException;

Import javax. servlet. ServletOutputStream;
Import javax. servlet. http. HttpServlet;
Import javax. servlet. http. HttpServletRequest;
Import javax. servlet. http. HttpServletResponse;

Public class ABTestServlet extends HttpServlet {
Public void service (HttpServletRequest request, HttpServletResponse response)
Throws IOException {
String message = (String) request. getParameter (& quot; message & quot ;);
ServletOutputStream out = response. getOutputStream ();
Out. print (& quot; This is my message: & quot; + message + & quot ;);
}
}


Then test with AB

Environment for my notebook T420 i5 560 m 4g xp system resin open 1G memory

This is what servlet does for multiple times.

D: TDDOWNLOAD & gt; ab-n 10000-c 60 http://www.lantii.com/abtest? Message = 1111
This is apachetings, Version 2.0.41-dev apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.lantii.com (be patient)
Completed1000 requests
Completed2000 requests
Completed3000 requests
Completed4000 requests
Completed5000 requests
Completed6000 requests
Completed7000 requests
Completed8000 requests
Completed9000 requests
Finished 10000 requests


Server Software: Resin/3.1.10
Server Hostname: www.lantii.com
Server Port: 80

Document Path:/abtest? Message = 1111
Document Length: 61 bytes

Concurrency Level: 60
Time taken for tests: 2.31250 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1590000 bytes
HTML transferred: 610000 bytes
Requests per secondd: 4923.08 [#/sec] (mean)
Time per request: 12.188 [MS] (mean)
Time per request: 0.203 [MS] (mean, internal SS all concurrent requests)
Transfer rate: 764.06 [Kbytes/sec] canceled ed

Connection Times (MS)
Min mean [+/-sd] median max
Connect: 0 0 1.3 0 15
Processing: 0 11 6.4 15 15
Waiting: 0 8 7.5 15 15
Total: 0 11 6.3 15

Percentage of the requests served within a certain time (MS)
50% 15
66% 15
75% 15
80% 15
90% 15
95% 15
98% 15
99% 15
100% 15 (longest request)

Springmvc is


[Code = & quot; java & quot;] D: TDDOWNLOAD & gt; AB-n 10000-c 60 http://www.lantii.com/message/1111
This is apachetings, Version 2.0.41-dev apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking www.lantii.com (be patient)
Completed1000 requests
Completed2000 requests
Completed3000 requests
Completed4000 requests
Completed5000 requests
Completed6000 requests
Completed7000 requests
Completed8000 requests
Completed9000 requests
Finished 10000 requests


Server Software: Resin/3.1.10
Server Hostname: www.lantii.com
Server Port: 80

Document Path:/message/1111
Document Length: 61 bytes

Concurrency Level: 60
Time taken for tests: 3.187500 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2020000 bytes
HTML transferred: 610000 bytes
Requests per secondd: 3137.26 [#/sec] (mean)
Time per request: 19.125 [MS] (mean)
Time per request: 0.319 [MS] (mean, internal SS all concurrent requests)
Transfer rate: 618.67 [Kbytes/sec] canceled ed

Connection Times (MS)
Min mean [+/-sd] median max
Connect: 0 0 1.5 0 15
Processing: 0 18 6.8 15 46
Waiting: 0 17 6.4 15 46
Total: 0 18

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.