Hi,

I seem to be having a performance issue in some of my Struts 2 actions. On
several of my pages, I render a couple of drop down tags in my output page.
I populate the drop down tags by instantiating an <s:bean/> tag and invoking
the methods in the bean to call an EJB service and populating a collection
property from the results. The collection is then passed to a <s:select/>
tag for rendering. The JSP looks something like this: <s:bean
name="com.valueObject.PayerAccountsWithBalance" id="payerAccount"> <s:param
name="transType">9</s:param> <s:param name="initClass"></s:param> </s:bean>
<s:select label ="Transfer From / Pay By Account" name
="selectedFromAccount" value ="selectedFromAccount" required ="true" list =
"#payerAccount.accountsList" listKey = "key" listValue= "value" headerKey
="-1" headerValue="Please Select" cssClass ="clsSelectedOpt accountType" id
="selectedFromAccount" /> com.valueObject.PayerAccountsWithBalance is just a
normal Java bean with methods "setTransType()", "setInitClass()" and
"getAccountsList()" exposed. I populate the accounts list by calling an EJB
service. I chose to do it this way instead of populating the collection in
the action class itself because I felt that the populating of the collection
was not really related to the core business logic of the action itself.
Functionally, this works great and up till recently, it was working fine in
production as well. But people started complaining about load times of the
action. Upon investigating, I found that under peak loads, my action was
taking up to 200 seconds to complete loading. The pattern is inconsistent. I
could be getting a 3-8 second response on the action for 5 consecutive users
and then it jumps to over 100 seconds for a couple of users before dropping
back down again. I had initially thought that my EJBs were the bottleneck
but after I played around with the logs, I don't think so. I placed a log
statement at the last line of the action class and the first line of the
setTransType() method in PayerAccountsWithBalance and found that when a
significant delay happens, there was a very big delay gap between the action
and the bean. The context look up for the EJB only happens in setInitClass()
so it looks more like the container was waiting for a new instance of
PayerAccountsWithBalance to be created. Since the number of
PayerAccountsWithBalance instances that is needed is roughly commensurate
with the number of action class instances, I'm not sure what kind of tuning
is necessary for me to achieve this. Does anybody else have this problem?
The version of Struts2 deployed in production is 2.0.11. Thanks! Wong

Reply via email to