最近觉得struts2性能感觉好差,然后就对struts2和springMVC3分别作了以下性能测试,结果太让人吃惊了!
机器配置是 T6600 + 2G内存
执行一条最简单的查询语句,500线程
select * from folder where fid = '1' order by orderNum
struts2 + spring3 + hibernate 的测试结果
[img]http://dl.iteye.com/upload/attachment/257409/35cc5aaf-e6c3-3c0e-bb87-edf4b45bbc37.png[/img]
struts2 + spring3 + mock对象的测试结果
[img]http://dl.iteye.com/upload/attachment/257454/8bf62537-bf6a-3937-80eb-d6493de8dd83.png[/img]
spring3 MVC + hibernate 的测试结果
[img]http://dl.iteye.com/upload/attachment/257413/4273bf8c-b8ea-31bd-8f49-79e6c9dbcbb8.png[/img]
最后是spring3 MVC + jdbc 的测试结果
[img]http://dl.iteye.com/upload/attachment/257411/7733a748-9ec6-3ff9-a9e9-4122a5eda7db.png[/img]
根据最后两种情况可以看到 hibernate 对性能的损失尚可接受,但是struts2的性能为什么和 spring3 MVC 差这么多 -_-b
最后附上struts2官方的helloWorld例子程序的测试结果
[img]http://dl.iteye.com/upload/attachment/258086/83dd1f7f-e869-34d5-ada8-11dbe2749046.png[/img]
性能也不容乐观。。。。。。
这个是官方的helloworld例子使用的jar包如下
然后是我的 struts.xml 配置文件,log 也已经设置到 ERROR 级别
机器配置是 T6600 + 2G内存
执行一条最简单的查询语句,500线程
select * from folder where fid = '1' order by orderNum
struts2 + spring3 + hibernate 的测试结果
[img]http://dl.iteye.com/upload/attachment/257409/35cc5aaf-e6c3-3c0e-bb87-edf4b45bbc37.png[/img]
struts2 + spring3 + mock对象的测试结果
[img]http://dl.iteye.com/upload/attachment/257454/8bf62537-bf6a-3937-80eb-d6493de8dd83.png[/img]
spring3 MVC + hibernate 的测试结果
[img]http://dl.iteye.com/upload/attachment/257413/4273bf8c-b8ea-31bd-8f49-79e6c9dbcbb8.png[/img]
最后是spring3 MVC + jdbc 的测试结果
[img]http://dl.iteye.com/upload/attachment/257411/7733a748-9ec6-3ff9-a9e9-4122a5eda7db.png[/img]
根据最后两种情况可以看到 hibernate 对性能的损失尚可接受,但是struts2的性能为什么和 spring3 MVC 差这么多 -_-b
最后附上struts2官方的helloWorld例子程序的测试结果
[img]http://dl.iteye.com/upload/attachment/258086/83dd1f7f-e869-34d5-ada8-11dbe2749046.png[/img]
性能也不容乐观。。。。。。
这个是官方的helloworld例子使用的jar包如下
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.1.8.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
</dependencies>
然后是我的 struts.xml 配置文件,log 也已经设置到 ERROR 级别
<struts>
<constant name="struts.devMode" value="false" />
<package name="basicstruts2" extends="struts-default">
<!-- If no class attribute is specified the framework will assume success and
render the result index.jsp -->
<!-- If no name value for the result node is specified the success value is the default -->
<action name="index">
<result>/index.jsp</result>
</action>
<!-- If the URL is hello.action the call the execute method of class HelloWorldAction.
If the result returned by the execute method is success render the HelloWorld.jsp -->
<action name="hello" class="org.apache.struts.helloworld.action.HelloWorldAction" method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>