Tomcat性能测试

测试环境

  • OS: Linux Red Hat 4.4.7-11
  • Memery: 16G
  • CPU: 4 Processor(Intel(R) Xeon(R))
  • JDK:1.8
  • Web服务器r: Tomcat 7.x
  • 测试工具: Jmeter-2.9
  • Monitor Tools: jconsole,jvisualvm,jstat

Prepare

 Run a simple servlet  at the Server container,as exclude Application delay,It just return a echo word.


Reference

  • Cient Thread: Mock User Request
  • Average: Response Time,unit:ms
  • Throughput: Query per Second,The formula is: Throughput = (number of requests) / (total time).
  • Maxthreads:The maximum num of connections that the server will accept and process.

Case 1

Server parameters as default

maxThread: 200

Client Thread Average 
Throughput 
load average 
100 230 
422 
<1
500 317 1545 <1 
1000 382 2415 <1 
1500 3269 197 <1

As the table shows,The Throughput increase  with the client's increase.But it decrease obviousely when client num over 1000.

Check the server,we can see every work thread is busy


Case 2

maxThread:  500

Client Thread
Average
Throughput
load average
500 257 1935 <3
1000 322 3086 <3 
1500 417 3458 <3 
2000 584 2815 <3 
3000 886 2487 <3 

Case 3

maxThread: 5000

Client Thread
Average
Throughput
load average
100 217 450 <2
500 219 2240 <2 
1000 310 105 <2 

When the client over 1000,The Client Http tools appear many error logs,It shows "client  Non HTTP response message: Read timed out",

check the tomcat log to get the error:

java.lang.OutOfMemoryError: unable to create new native thread  
    at java.lang.Thread.start0(Native Method)  
    at java.lang.Thread.start(Thread.java:691)  
    at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:949)  
    at java.util.concurrent.ThreadPoolExecutor.processWorkerExit(ThreadPoolExecutor.java:1017)  
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1163)  
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)  
    at java.lang.Thread.run(Thread.java:722)  

It shows The maxTheads number  exceed the limiting  Number of Processes Available,The CentOs  max user processes default is 1024,update the param 
 at file /etc/security/limits.d/90-nproc.conf as following,

*  soft   nofile 65536

*  hard   nofile 65536

*  soft   nproc  10240

*  hard   nproc  10240

Case 4

continue the test,

maxThread: 5000

Client Thread
Average
Throughput
load average
500 198 2171 <3
1000 199 4087 <3 
1500 211 5106 <3 
2000 220 5820 <3 

Case 5

1.update the JVM options 

JAVA_OPTS="$JAVA_OPTS -Xms3g -Xmx5g -Xss512K -XX:PermSize=256m -XX:MaxPermSize=512m "

2.maxThread: 5000

Client Thread
Average
Throughput
maxThreads
load average
500 
201 6926 
5000 
3.6
1000 
220 8122 5000 
4.02
1500 
348 8238 5000 
4.3
2000 446 7869 5000 
8.2

Now,Check the  JVM,


It seam there's enought Memory,and The GC frequency is not hight,So exclude the VM Memory factor, And As the case 5 shows,

Load is over the CPU max load,It have arrive the bottleneck of system.


  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值