2013年9月26日星期四

Why freemarker slower than jsp ?

Yesterday I made ​​such a test, the test environment : struts2 + freemarker + tomcat6
declare two methods in action , other methods are the same, that is not the same as the final return
configured as :
1), $ {templePath} / vote/tmp1_vote.ftl
Obviously, here is the integration of struts2 freemarker
2), getRequest (). getRequestDispatcher (voteWrapper.getFilePath () + "/ vote/tmp1_vote.jsp"). forward (getRequest (), getResponse ());
return null;
this method in action using forward jumps .
then use linux in the ab testing tools for testing,
. / ab-n 10000-c 100 "http://118.118.110.167:8181/test/jsp/baseMgnt \! initPage2.action? object.objectId = 2717 & object.typeId = 1/4 "
. / ab-n 10000-c 100 "http://118.118.110.167:8181/test/jsp/baseMgnt \! initPage.action? object.objectId = 2717 & object.typeId = 1/4 "
surprising thing happened, was actually the result of the test :
first test results :
1) The tps is: 7000
2) The tps is: 14000
is to say , jsp freemarker efficient than twice as fast for a whole , with the expected result of this complete reversal , is not clear why the ? ? ?
second time, and increase the number of concurrent requests , the test results are both 14,000 estimated cache has a relationship with a
ftl and jsp content difference:
jsp using el expression
ftl own label use
exactly the same content .
------ Solution ---------------------------------------- ----
look , remark
------ Solution ----------------------------- ---------------
freemarker how to say what this thing ..
I use it , fm advantage is that you can customize the label , if it is a lot of similar structure of the page , then use fm can save a lot of duplicate code
However , fm interpretation speed is not very fast indeed , after all, this thing is too complicated, compared to the kind of label explaining who jsp

Then you test it ... wanted to tell you , the other you should spend more struts2 jsp page tags , struts2 tag is written with fm
you to write directly el expression , jsp itself does not perform many operations , of course, a very fast

velocity never used , do not comment on them

But honestly, even if a little slower , fm overall performance is worthy of recognition , nor is it unacceptable slow , is not it ? ~
------ Solution ------ --------------------------------------
FreeMarket static to write their own code, that is a CMS system , you go online to find a CMS system to know
------ Solution ------------------------- -------------------

==! seemingly more strenuous as it

------ For reference only ---------------------------------- -----
freemarker
Benefits:
1, can not write java code , you can achieve a strict separation mvc
2, the performance is very good
3, jsp tag support for good
4, built a large number of commonly used functions , easy to use
5, macro definitions ( like jsp tag ) is very convenient
6, using the expression language
Disadvantages:
1, is not an official standard
2, user groups and third-party tag library does not have much jsp

Performance : velocity should be the best , followed by the jsp, freemarker pages worst performance of ordinary , but in a complex pages ( including a large number of judgments, Date Amount formatted ) on the page , freemarker performance than using the tag and the el jsp good .


jsp we are most familiar with the technology
Benefits:
1, powerful, can write java code
2, support jsp tag (jsp tag)
3, support for Expression Language (el)
4, the official standard , wide user base , rich third-party jsp tag library
5, good performance. jsp compiled into class files execute , have a good performance
Disadvantages:
jsp no obvious shortcomings , have to pick the bones that point , because you can write java code , such as improper use mvc easy to destroy the structure .
------ For reference only ------------------------------------ ---
ls cattle b
------ For reference only ----------------------------- ----------
indeed cattle b Oh , O (∩ _ ∩) O
------ For reference only ------------- --------------------------
top about
------ For reference only ----- ----------------------------------

fm into static pages than jsp fast ah
------ For reference only ----------------------------------- ----

ask how to convert a static html?
------ For reference only -------------------------------------- -
? nobody knows you ?
------ For reference only ---------------------------- -----------
feeling is more complicated , if you want to use the CMS system is entirely possible to freemarker separated in a highly concurrent systems require high performance , freemarker truth is the raison d'etre What ? Really puzzling.
------ For reference only -------------------------------------- -
directly ftl alternative jsp
------ For reference only ----------------------------- ----------

I am now doing , ah, less efficiency Ay
------ For reference only ------- --------------------------------
I still like to use jsp
------ For reference only ---------------------------------------
some say csdn no master , I do not believe , oh master coming soon .
------ For reference only -------------------------------------- -
do not know too many things @
------ For reference only -------------------------- -------------
  This reply was moderator deleted at 2011-08-23 14:11:44

------ For reference only ---------------------------------- -----
continue waiting . . .
------ For reference only -------------------------------------- -
performance on freemarker skeptical
------ For reference only --------------------------- ------------
  This reply was moderator deleted at 2012-05-21 09:06:51

------ For reference only ---------------------------------- -----
freemarker jsp performance can be more than just static strange --- If you say the words after more than jsp , jsp can be static html and html to the time the performance is compared .
------ For reference only -------------------------------------- -
directly tell you the truth :
velocity, select it , you will not regret it.
------ For reference only -------------------------------------- -
is to learn about, new to fm, before all JSP

没有评论:

发表评论