struts2的性能爲什麼這麼差,有性能測試截圖

最近覺得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包如下

<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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章