Re: Performance issue with nested iterator

2012-07-05 Thread Łukasz Lenart
Thanks! The latest version of S2 is already using 2.3.19


Kind regards
-- 
Łukasz
mobile +48 606 323 122 http://www.lenart.org.pl/
Warszawa JUG conference - Confitura http://confitura.pl/


2012/7/5 Miguel Almeida :
> I believe I've found the culprit.
> While the problem is present in commit
> https://github.com/mmalmeida/struts-performance/commit/aba93098174c8c8c1684ffdd9bf332b212a893a
>  , it's not present in the latest commit if you turn devMode to false.
>
> The issue was the freemarker version 2.3.9 in that commit. Updating to
> 2.3.19 makes performance normal again (the complete project needed
> freemarker, hence the direct dependency reference in the pom).
>
> While I don't know what changed between these freemarker versions,
> apparently the problem was there.
>
> Miguel Almeida
>
> On Thu, 2012-07-05 at 13:16 +0100, Miguel Almeida wrote:
>
>> Sorry, I sent the email before explaining.
>>
>> The repo has a maven project that I stripped down to the most basic to
>> show the issue. Notice the iterator in index.jsp.
>>
>> I tried to remove every unused configuration, file and dependency to
>> make the project as simple as possible.
>>
>> The original project is using tiles, so I kept it there. However, I
>> don't think it's being used in the web workflow I created (which just
>> goes to index.jsp).
>>
>> Is there anything there that might explain this slowness?
>>
>> Cheers,
>>
>> Miguel Almeida
>>
>> On Thu, 2012-07-05 at 13:05 +0100, Miguel Almeida wrote:
>>
>> > Sure, Lukas:
>> >
>> > https://github.com/mmalmeida/struts-performance
>> >
>> >
>> >
>> > On Thu, 2012-07-05 at 06:48 +0200, Lukasz Lenart wrote:
>> >
>> > > Could you post somewhere (GitHub) the whole code base ?
>> > >
>> > >
>> > > Regards
>> >
>> >
>>
>>
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with nested iterator

2012-07-05 Thread Miguel Almeida
I believe I've found the culprit.
While the problem is present in commit
https://github.com/mmalmeida/struts-performance/commit/aba93098174c8c8c1684ffdd9bf332b212a893a
 , it's not present in the latest commit if you turn devMode to false. 

The issue was the freemarker version 2.3.9 in that commit. Updating to
2.3.19 makes performance normal again (the complete project needed
freemarker, hence the direct dependency reference in the pom).

While I don't know what changed between these freemarker versions,
apparently the problem was there.

Miguel Almeida

On Thu, 2012-07-05 at 13:16 +0100, Miguel Almeida wrote:

> Sorry, I sent the email before explaining.
> 
> The repo has a maven project that I stripped down to the most basic to
> show the issue. Notice the iterator in index.jsp.
> 
> I tried to remove every unused configuration, file and dependency to
> make the project as simple as possible.
> 
> The original project is using tiles, so I kept it there. However, I
> don't think it's being used in the web workflow I created (which just
> goes to index.jsp).
> 
> Is there anything there that might explain this slowness?
> 
> Cheers,
> 
> Miguel Almeida
> 
> On Thu, 2012-07-05 at 13:05 +0100, Miguel Almeida wrote:
> 
> > Sure, Lukas:
> > 
> > https://github.com/mmalmeida/struts-performance
> > 
> > 
> > 
> > On Thu, 2012-07-05 at 06:48 +0200, Lukasz Lenart wrote:
> > 
> > > Could you post somewhere (GitHub) the whole code base ?
> > > 
> > > 
> > > Regards
> > 
> > 
> 
> 




Re: Performance issue with nested iterator

2012-07-05 Thread Miguel Almeida
Sorry, I sent the email before explaining.

The repo has a maven project that I stripped down to the most basic to
show the issue. Notice the iterator in index.jsp.

I tried to remove every unused configuration, file and dependency to
make the project as simple as possible.

The original project is using tiles, so I kept it there. However, I
don't think it's being used in the web workflow I created (which just
goes to index.jsp).

Is there anything there that might explain this slowness?

Cheers,

Miguel Almeida

On Thu, 2012-07-05 at 13:05 +0100, Miguel Almeida wrote:

> Sure, Lukas:
> 
> https://github.com/mmalmeida/struts-performance
> 
> 
> 
> On Thu, 2012-07-05 at 06:48 +0200, Lukasz Lenart wrote:
> 
> > Could you post somewhere (GitHub) the whole code base ?
> > 
> > 
> > Regards
> 
> 




Re: Performance issue with nested iterator

2012-07-05 Thread Miguel Almeida
Sure, Lukas:

https://github.com/mmalmeida/struts-performance



On Thu, 2012-07-05 at 06:48 +0200, Lukasz Lenart wrote:

> Could you post somewhere (GitHub) the whole code base ?
> 
> 
> Regards




Re: Performance issue with nested iterator

2012-07-04 Thread Lukasz Lenart
Could you post somewhere (GitHub) the whole code base ?


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue using tag

2009-11-03 Thread musomesa

Since it is not happening consistently and seems to happen more under load it
could well be that the instantiation of an object is triggering a 
garbage collection so it might be unrelated to the  itself and more to
hanging onto some other objects for too long.


Chris


-Original Message-
From: Musachy Barroso 
To: Struts Users Mailing List 
Sent: Tue, Nov 3, 2009 8:04 am
Subject: Re: Performance issue using  tag



I would suggest you to use a profiler to find out for sure what is
aking the time.  You can use VisualVM which comes with java 6 or the
xcellent jrockit mission control(free as well).
musachy
On Mon, Nov 2, 2009 at 2:50 PM, CS Wong  wrote:
 Hi, thanks for answering, I noticed that the quoted text in your reply
 seemed to be garbled so I guess something screwed up when I sent in my
 question. I've pasted my original question in a pastebin here (
 http://paste2.org/p/495951) so that you can read it better. Sorry for any
 inconvenience caused.

 Well, I don't want to be an ass, Musachy, but I think I can prove that the
 EJB is not the problem. I've timed the logs precisely and the delay happens
 before the EJB invocation. Here's an example:

   1. At the end of the action class, just before returning SUCCESS, I made
   a log statement. This occurs at 10:03:07.
   2. After the log statement, I immediately return SUCCESS.
   3. The next logged line would be from PayerAccountsWithBalance bean
   itself.
   4. setTransType() is just a normal setter method that assigns the input
   to a private attribute (differs from what I said below, sorry my mistake)
   5. setInitClass() has the lines that I pasted in a pastebin here:
   http://paste2.org/p/495948
   6. Line 9 of the code pasted is where I make my call to the EJB, yet, the
   time recorded for line 4, which is a log statement, is at 10:05:23!
   7. This means that, over 2 minutes has passed between when the action
   class completed its execution and when the bean was instantiated and reach
   the log statement. And this is definitely before the EJB call.
   8. So this would exclude the possibility that the delay was caused by the
   EJB lookup / execution

 I hope my analysis above is correct. Hope someone with more experience can
 provide their input here as I'm really getting pasted about the performance
 issue on a daily basis.

 Thanks!
 Wong


 On Tue, Nov 3, 2009 at 6:27 AM, Musachy Barroso  wrote:

> It is the same struts code running all the time, so it should as
> fast(or slow) every time. The only thing that changes is the call to
> the EJB, so I would bet that the problem is there.
>
> musachy
>
> On Mon, Nov 2, 2009 at 9:57 AM, CS Wong  wrote:
> > 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  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 
> > tag for rendering. The JSP looks something like this:  > name="com.valueObject.PayerAccountsWithBalance" id="payerAccount">
>  > name="transType">9 
> 
> >  > ="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, 

Re: Performance issue using tag

2009-11-02 Thread Musachy Barroso
I would suggest you to use a profiler to find out for sure what is
taking the time.  You can use VisualVM which comes with java 6 or the
excellent jrockit mission control(free as well).

musachy

On Mon, Nov 2, 2009 at 2:50 PM, CS Wong  wrote:
> Hi, thanks for answering, I noticed that the quoted text in your reply
> seemed to be garbled so I guess something screwed up when I sent in my
> question. I've pasted my original question in a pastebin here (
> http://paste2.org/p/495951) so that you can read it better. Sorry for any
> inconvenience caused.
>
> Well, I don't want to be an ass, Musachy, but I think I can prove that the
> EJB is not the problem. I've timed the logs precisely and the delay happens
> before the EJB invocation. Here's an example:
>
>   1. At the end of the action class, just before returning SUCCESS, I made
>   a log statement. This occurs at 10:03:07.
>   2. After the log statement, I immediately return SUCCESS.
>   3. The next logged line would be from PayerAccountsWithBalance bean
>   itself.
>   4. setTransType() is just a normal setter method that assigns the input
>   to a private attribute (differs from what I said below, sorry my mistake)
>   5. setInitClass() has the lines that I pasted in a pastebin here:
>   http://paste2.org/p/495948
>   6. Line 9 of the code pasted is where I make my call to the EJB, yet, the
>   time recorded for line 4, which is a log statement, is at 10:05:23!
>   7. This means that, over 2 minutes has passed between when the action
>   class completed its execution and when the bean was instantiated and reach
>   the log statement. And this is definitely before the EJB call.
>   8. So this would exclude the possibility that the delay was caused by the
>   EJB lookup / execution
>
> I hope my analysis above is correct. Hope someone with more experience can
> provide their input here as I'm really getting pasted about the performance
> issue on a daily basis.
>
> Thanks!
> Wong
>
>
> On Tue, Nov 3, 2009 at 6:27 AM, Musachy Barroso  wrote:
>
>> It is the same struts code running all the time, so it should as
>> fast(or slow) every time. The only thing that changes is the call to
>> the EJB, so I would bet that the problem is there.
>>
>> musachy
>>
>> On Mon, Nov 2, 2009 at 9:57 AM, CS Wong  wrote:
>> > 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  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 
>> > tag for rendering. The JSP looks something like this: > > name="com.valueObject.PayerAccountsWithBalance" id="payerAccount">
>> > > name="transType">9 
>> 
>> > > > ="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 

Re: Performance issue using tag

2009-11-02 Thread CS Wong
Hi, thanks for answering, I noticed that the quoted text in your reply
seemed to be garbled so I guess something screwed up when I sent in my
question. I've pasted my original question in a pastebin here (
http://paste2.org/p/495951) so that you can read it better. Sorry for any
inconvenience caused.

Well, I don't want to be an ass, Musachy, but I think I can prove that the
EJB is not the problem. I've timed the logs precisely and the delay happens
before the EJB invocation. Here's an example:

   1. At the end of the action class, just before returning SUCCESS, I made
   a log statement. This occurs at 10:03:07.
   2. After the log statement, I immediately return SUCCESS.
   3. The next logged line would be from PayerAccountsWithBalance bean
   itself.
   4. setTransType() is just a normal setter method that assigns the input
   to a private attribute (differs from what I said below, sorry my mistake)
   5. setInitClass() has the lines that I pasted in a pastebin here:
   http://paste2.org/p/495948
   6. Line 9 of the code pasted is where I make my call to the EJB, yet, the
   time recorded for line 4, which is a log statement, is at 10:05:23!
   7. This means that, over 2 minutes has passed between when the action
   class completed its execution and when the bean was instantiated and reach
   the log statement. And this is definitely before the EJB call.
   8. So this would exclude the possibility that the delay was caused by the
   EJB lookup / execution

I hope my analysis above is correct. Hope someone with more experience can
provide their input here as I'm really getting pasted about the performance
issue on a daily basis.

Thanks!
Wong


On Tue, Nov 3, 2009 at 6:27 AM, Musachy Barroso  wrote:

> It is the same struts code running all the time, so it should as
> fast(or slow) every time. The only thing that changes is the call to
> the EJB, so I would bet that the problem is there.
>
> musachy
>
> On Mon, Nov 2, 2009 at 9:57 AM, CS Wong  wrote:
> > 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  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 
> > tag for rendering. The JSP looks something like this:  > name="com.valueObject.PayerAccountsWithBalance" id="payerAccount">
>  > name="transType">9 
> 
> >  > ="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
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: Performance issue using tag

2009-11-02 Thread Musachy Barroso
It is the same struts code running all the time, so it should as
fast(or slow) every time. The only thing that changes is the call to
the EJB, so I would bet that the problem is there.

musachy

On Mon, Nov 2, 2009 at 9:57 AM, CS Wong  wrote:
> 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  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 
> tag for rendering. The JSP looks something like this:  name="com.valueObject.PayerAccountsWithBalance" id="payerAccount">  name="transType">9  
>  ="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
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-11 Thread fireapple



newton.dave wrote:
> 
> 
>> "" doesn't work at
>> all.
> 
> Stream it from an action/servlet/etc?
> 
> Dave
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

Yes, I streamed it from an action. However, I could show the above table
using an action to stream images.
-- 
View this message in context: 
http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23981525.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-10 Thread Dave Newton

fireapple wrote:

Any way to resolve the security issue? If the user save the portrait in the
hard drive(outside of app), I couldn't find a way to display it using URL. 


"" doesn't work at all.


Stream it from an action/servlet/etc?

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Performance issue with large data(such as images)

2009-06-10 Thread fireapple



Security Management wrote:
> 
> I have had problems when trying to show a bunch of thumbnails, because you
> have a URL that points to an action in your jsp that causes a database hit
> to pull the image.  If I'm trying to show 150 thumbnails, the page takes
> forever to load due to the db connections.  Any solution to that?  I'm
> using
> DBCP
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 
I also use the URL that points to an action in my jsp, such as:

http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23969896.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-10 Thread fireapple



Richard Sayre wrote:
> 
> I should have also mentioned that there are security issues with
> persisting to the hard drive.
> 
> I would recommend saving to the database and loading the images as
> needed.  Do not save them to session.  I do not think you will have a
> performance problem.
> 
> Rich
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

Any way to resolve the security issue? If the user save the portrait in the
hard drive(outside of app), I couldn't find a way to display it using URL. 

"" doesn't work at all.
-- 
View this message in context: 
http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23969795.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Performance issue with large data(such as images)

2009-06-10 Thread Security Management
I should have also mentioned that there are security issues with
persisting to the hard drive.

I would recommend saving to the database and loading the images as
needed.  Do not save them to session.  I do not think you will have a
performance problem.

Rich

I have had problems when trying to show a bunch of thumbnails, because you
have a URL that points to an action in your jsp that causes a database hit
to pull the image.  If I'm trying to show 150 thumbnails, the page takes
forever to load due to the db connections.  Any solution to that?  I'm using
DBCP

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Performance issue with large data(such as images)

2009-06-10 Thread Mitchell, Steven
This is a little off topic, but can anybody recommend a photo resizing utility 
to run after the upload?  I too have a need to allow the user to upload a user 
photo, which could be stored in a BLOB, but I know it is not that simple.  Many 
sites do post processing to adjust the image resolution, size or even type, and 
some allow the user to crop the image as well. I'm curious if anybody has 
experience with an open source photo manipulation framework that plays well 
with Struts 2.

Steve Mitchell
http://www.Byteworksinc.com 

-Original Message-
From: Richard Sayre [mailto:richardsa...@gmail.com] 
Sent: Wednesday, June 10, 2009 12:41 PM
To: Struts Users Mailing List
Subject: Re: Performance issue with large data(such as images)

>Thanks, Rich,

I''m happy to help.

> If I use BLOB, I have to make a lot of change to my code. Therefore, I have
> to persist it as String. I used base64 to encode and decode the byte[] into
> String. Because I resize the images to small ones. I use a VARCHAR length
> about 10k~20k to persist the String.

Thats fine, if you don't want to do a hugh code change then keep it the same

> "How often do you need to load all 300 images?  If it is forum style I
> would imangine a limited number of posting per page say max 20.  So
> the would be a maximum of 20 images per page load."
> If this is true, which method is the best among the above three?

Which method is 'best' depends on what you want. For fast access and
low memory - persist to hard drive

> "If you must use the least amount of memory as possible, persist the
> images to the hard drive and store the file reference to the url in
> the database.  "
> If I want to persist images to the hard drive of server. Shall I persist the
> data inside WAR or outside? Because user can change their portrait, does it
> mean it must be persisted outside WAR?

No just make a base dir in your app called 'userAvatar' or something
similar.  Then persist the image as user_.gif ( = the user
id).  When they chage their image override the file.

Also as stated by Pawel, make sure you have a performance problem
before you try to solve a performance problem.

> --
> View this message in context: 
> http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23948048.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


--
NOTICE:  This electronic mail message and any attached files are confidential.  
The information is exclusively for the use of the individual or entity intended 
as the recipient.  If you are not the intended recipient, any use, copying, 
printing, reviewing, retention, disclosure, distribution or forwarding of the 
message or any attached file is not authorized and is strictly prohibited.  If 
you have received this electronic mail message in error, please advise the 
sender by reply electronic mail immediately and permanently delete the original 
transmission, any attachments and any copies of this message from your computer 
system. Thank you.

==


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-10 Thread Richard Sayre
I should have also mentioned that there are security issues with
persisting to the hard drive.

I would recommend saving to the database and loading the images as
needed.  Do not save them to session.  I do not think you will have a
performance problem.

Rich

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-10 Thread Richard Sayre
>Thanks, Rich,

I''m happy to help.

> If I use BLOB, I have to make a lot of change to my code. Therefore, I have
> to persist it as String. I used base64 to encode and decode the byte[] into
> String. Because I resize the images to small ones. I use a VARCHAR length
> about 10k~20k to persist the String.

Thats fine, if you don't want to do a hugh code change then keep it the same

> "How often do you need to load all 300 images?  If it is forum style I
> would imangine a limited number of posting per page say max 20.  So
> the would be a maximum of 20 images per page load."
> If this is true, which method is the best among the above three?

Which method is 'best' depends on what you want. For fast access and
low memory - persist to hard drive

> "If you must use the least amount of memory as possible, persist the
> images to the hard drive and store the file reference to the url in
> the database.  "
> If I want to persist images to the hard drive of server. Shall I persist the
> data inside WAR or outside? Because user can change their portrait, does it
> mean it must be persisted outside WAR?

No just make a base dir in your app called 'userAvatar' or something
similar.  Then persist the image as user_.gif ( = the user
id).  When they chage their image override the file.

Also as stated by Pawel, make sure you have a performance problem
before you try to solve a performance problem.

> --
> View this message in context: 
> http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23948048.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-09 Thread Paweł Wielgus
Hi All,
just as a side note,
300 users is a very small quantity of users.
So i would recomend to check if there is a performance problem at all.

Best greetings,
Paweł Wielgus.


2009/6/9 Jim Collings :
> Can't put em in your database as BLOB's with all the other user info?
>
> On Tue, Jun 9, 2009 at 4:26 PM, Dave Newton wrote:
>> fireapple wrote:
>>>
>>> If I want to persist images to the hard drive of server. Shall I persist
>>> the
>>> data inside WAR or outside? Because user can change their portrait, does
>>> it
>>> mean it must be persisted outside WAR?
>>
>> You can't write stuff into your WAR.
>>
>> Dave
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-09 Thread Jim Collings
Can't put em in your database as BLOB's with all the other user info?

On Tue, Jun 9, 2009 at 4:26 PM, Dave Newton wrote:
> fireapple wrote:
>>
>> If I want to persist images to the hard drive of server. Shall I persist
>> the
>> data inside WAR or outside? Because user can change their portrait, does
>> it
>> mean it must be persisted outside WAR?
>
> You can't write stuff into your WAR.
>
> Dave
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-09 Thread Dave Newton

fireapple wrote:

If I want to persist images to the hard drive of server. Shall I persist the
data inside WAR or outside? Because user can change their portrait, does it
mean it must be persisted outside WAR?


You can't write stuff into your WAR.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-09 Thread fireapple



Richard Sayre wrote:
> 
> You should persist the images as bytes, in a binary field or something
> similar.
> 
>> 1. Because the image is large, it's not efficient to store it in
>> objects(beans).
> 
> Well this depends on the Bean.  Is the bean stored in session?  If yes
> then it will take up some memory.  If you dont have alot of memory I
> would not recommend this.
> 
>> 2. Because I have many users(say 300), if I store all the maps(userId and
>> image) in the session, the session will be huge.
> 
> Again if your requirement is low memory usage then dont store large
> objects in momory for a long time
> 
>> 3. Because I have many users(say 300), if I access the db for each user's
>> image, the worse case is I will have to access db for 300 times.
> 
> Well this is the trade off Memory vs Resources to Connect to a DB.
> Even if the images are not stored in session they will still be held
> in memory when getting them from the DB.
> 
> How often do you need to load all 300 images?  If it is forum style I
> would imangine a limited number of posting per page say max 20.  So
> the would be a maximum of 20 images per page load.
> 
> You could also Store the images in the hard drive of the server, and
> store a URL to the image in the database.  This would reduce the
> memory overhead.  Did you try to do any test to see what the impact of
> retrieveing the data from the database is?
> 
> If you must use the least amount of memory as possible, persist the
> images to the hard drive and store the file reference to the url in
> the database.  Or even store the images as userId_avatar.gif.  That
> way you can link the file to a user id and have no need to store the
> url.  Use a base directory for storing the images.
> 
> Before you guess if something is a performance issue, you should test
> to see what the actual cost of each method of image storing and
> retrival is.
> 
> Rich
> 
> 

Thanks, Rich, 

"You should persist the images as bytes, in a binary field or something
similar."
If I use BLOB, I have to make a lot of change to my code. Therefore, I have
to persist it as String. I used base64 to encode and decode the byte[] into
String. Because I resize the images to small ones. I use a VARCHAR length
about 10k~20k to persist the String.

"How often do you need to load all 300 images?  If it is forum style I
would imangine a limited number of posting per page say max 20.  So
the would be a maximum of 20 images per page load."
If this is true, which method is the best among the above three?

"If you must use the least amount of memory as possible, persist the
images to the hard drive and store the file reference to the url in
the database.  "
If I want to persist images to the hard drive of server. Shall I persist the
data inside WAR or outside? Because user can change their portrait, does it
mean it must be persisted outside WAR?


-- 
View this message in context: 
http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23948048.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue with large data(such as images)

2009-06-09 Thread Richard Sayre
You should persist the images as bytes, in a binary field or something similar.

> 1. Because the image is large, it's not efficient to store it in
> objects(beans).

Well this depends on the Bean.  Is the bean stored in session?  If yes
then it will take up some memory.  If you dont have alot of memory I
would not recommend this.

> 2. Because I have many users(say 300), if I store all the maps(userId and
> image) in the session, the session will be huge.

Again if your requirement is low memory usage then dont store large
objects in momory for a long time

> 3. Because I have many users(say 300), if I access the db for each user's
> image, the worse case is I will have to access db for 300 times.

Well this is the trade off Memory vs Resources to Connect to a DB.
Even if the images are not stored in session they will still be held
in memory when getting them from the DB.

How often do you need to load all 300 images?  If it is forum style I
would imangine a limited number of posting per page say max 20.  So
the would be a maximum of 20 images per page load.

You could also Store the images in the hard drive of the server, and
store a URL to the image in the database.  This would reduce the
memory overhead.  Did you try to do any test to see what the impact of
retrieveing the data from the database is?

If you must use the least amount of memory as possible, persist the
images to the hard drive and store the file reference to the url in
the database.  Or even store the images as userId_avatar.gif.  That
way you can link the file to a user id and have no need to store the
url.  Use a base directory for storing the images.

Before you guess if something is a performance issue, you should test
to see what the actual cost of each method of image storing and
retrival is.

Rich

On Tue, Jun 9, 2009 at 12:49 PM, fireapple wrote:
>
> Firstly, I persist the portraits (images) of all users in the db as Strings
> (large one, say length 5000). Then, I want to get the String and display the
> portraits of users on the web page(like a topic in a forum). Here I know
> three solutions but none of them is efficient:
> 1. Because the image is large, it's not efficient to store it in
> objects(beans).
> 2. Because I have many users(say 300), if I store all the maps(userId and
> image) in the session, the session will be huge.
> 3. Because I have many users(say 300), if I access the db for each user's
> image, the worse case is I will have to access db for 300 times.
>
> Is there any solution (such as a design pattern or interceptor) for this
> performance issue? Many thanks!
> --
> View this message in context: 
> http://www.nabble.com/Performance-issue-with-large-data%28such-as-images%29-tp23945029p23945029.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re : Performance issue

2009-01-07 Thread François Rouxel
Are you using many interceptors?

  




- Message d'origine 
De : Pierre Thibaudeau 
À : Struts Users Mailing List 
Envoyé le : Mardi, 6 Janvier 2009, 16h19mn 36s
Objet : Re: Performance issue

Yes the model is *exactly* the same in the two cases.  In fact, both
S1 and S2 exist concurrently in the same Tomcat application.

Each test is run using JMeter, with 10 users who randomly try to
access one of 42 different pages involving 10 different types of
results (that is, roughly speaking, 10 different JSPs, abstracting
from the fact that each page is really composed of 6 or 7 different
JSP tiles).  In total, roughly 1,600 pages were queried for each test.
Moreover, each test was performed after re-starting Tomcat, once the
pages had been warmed up.

My last post in this thread was fairly extreme, and I felt the need to
make new tests that relied on fewer assumptions and more on hard
facts.  So I modified the pages tested as best I could, in order to
make the respective S1 pages and S2 pages as close to identical as
possible.  In particular, this meant beefing up my old S1 pages,
adding to them some of the more recent sections that existed only in
the S2 version:  mostly (but not exclusively) a lot of javascrip/dojo
stuff, which is not interpreted anyway by JMeter. (I don't rely on S2
for dojo, but provide my own; and yes, I package and shrinksafe it).

Since my original timing for S1 pages were so ridiculously low (often
under 10 ms!!!), the new beefed-up S1 pages were bound to be
significantly slower.
On average, with the beefed-up pages, S1 pages take 74 ms to load.

Since last running the S2 tests (about 4 days ago), I did a fair
amount of optimizing and I replaced the most obvious  by
 in about half of the JSPs. I therefore re-ran the tests just
before writing this current post.
There is a marked improvement and, on average, S2 pages load in 169 ms.

In other words, I may have been a little (!) hasty in posting my
previous statement! (*blushing*)  My apologies to all the people who
care about S2!!!
We are happily very far from the apocalyptic 30x factor that I had
previously observed.  (Some tests last week were showing averages of
580 ms per S2-page!)

As I am under pressure, I may not have time immediately to set up a
new test to compare the most recent result with the case of S2 pages
that entirely rely on , though that would be very
enlightening.  If I can get round to it, I promise to post the
results!

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2009-01-06 Thread stanlick
This test sounds about as straightforward as parallel parking a freight
train on a one lane road.


RE: Performance issue

2009-01-06 Thread Andy

I would be interested in seeing new benchmark results if anyone happens to 
generate some.  Might want to avoid database-based tests due to caching.  
> Date: Tue, 6 Jan 2009 16:19:36 -0500> From: pierre.thibaud...@gmail.com> To: 
> user@struts.apache.org> Subject: Re: Performance issue> > Yes the model is 
> *exactly* the same in the two cases. In fact, both> S1 and S2 exist 
> concurrently in the same Tomcat application.> > Each test is run using 
> JMeter, with 10 users who randomly try to> access one of 42 different pages 
> involving 10 different types of> results (that is, roughly speaking, 10 
> different JSPs, abstracting> from the fact that each page is really composed 
> of 6 or 7 different> JSP tiles). In total, roughly 1,600 pages were queried 
> for each test.> Moreover, each test was performed after re-starting Tomcat, 
> once the> pages had been warmed up.> > My last post in this thread was fairly 
> extreme, and I felt the need to> make new tests that relied on fewer 
> assumptions and more on hard> facts. So I modified the pages tested as best I 
> could, in order to> make the respective S1 pages and S2 pages as close to 
> identical as> possible. In particular, this meant beefing up my old S1 
> pages,> adding to them some of the more recent sections that existed only in> 
> the S2 version: mostly (but not exclusively) a lot of javascrip/dojo> stuff, 
> which is not interpreted anyway by JMeter. (I don't rely on S2> for dojo, but 
> provide my own; and yes, I package and shrinksafe it).> > Since my original 
> timing for S1 pages were so ridiculously low (often> under 10 ms!!!), the new 
> beefed-up S1 pages were bound to be> significantly slower.> On average, with 
> the beefed-up pages, S1 pages take 74 ms to load.> > Since last running the 
> S2 tests (about 4 days ago), I did a fair> amount of optimizing and I 
> replaced the most obvious  by>  in about half of the JSPs. I 
> therefore re-ran the tests just> before writing this current post.> There is 
> a marked improvement and, on average, S2 pages load in 169 ms.> > In other 
> words, I may have been a little (!) hasty in posting my> previous statement! 
> (*blushing*) My apologies to all the people who> care about S2!!!> We are 
> happily very far from the apocalyptic 30x factor that I had> previously 
> observed. (Some tests last week were showing averages of> 580 ms per 
> S2-page!)> > As I am under pressure, I may not have time immediately to set 
> up a> new test to compare the most recent result with the case of S2 pages> 
> that entirely rely on , though that would be very> enlightening. If I 
> can get round to it, I promise to post the> results!> > 
> -> To 
> unsubscribe, e-mail: user-unsubscr...@struts.apache.org> For additional 
> commands, e-mail: user-h...@struts.apache.org> 
_
It’s the same Hotmail®. If by “same” you mean up to 70% faster.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_122008

Re: Performance issue

2009-01-06 Thread Pierre Thibaudeau
Yes the model is *exactly* the same in the two cases.  In fact, both
S1 and S2 exist concurrently in the same Tomcat application.

Each test is run using JMeter, with 10 users who randomly try to
access one of 42 different pages involving 10 different types of
results (that is, roughly speaking, 10 different JSPs, abstracting
from the fact that each page is really composed of 6 or 7 different
JSP tiles).  In total, roughly 1,600 pages were queried for each test.
 Moreover, each test was performed after re-starting Tomcat, once the
pages had been warmed up.

My last post in this thread was fairly extreme, and I felt the need to
make new tests that relied on fewer assumptions and more on hard
facts.  So I modified the pages tested as best I could, in order to
make the respective S1 pages and S2 pages as close to identical as
possible.  In particular, this meant beefing up my old S1 pages,
adding to them some of the more recent sections that existed only in
the S2 version:  mostly (but not exclusively) a lot of javascrip/dojo
stuff, which is not interpreted anyway by JMeter. (I don't rely on S2
for dojo, but provide my own; and yes, I package and shrinksafe it).

Since my original timing for S1 pages were so ridiculously low (often
under 10 ms!!!), the new beefed-up S1 pages were bound to be
significantly slower.
On average, with the beefed-up pages, S1 pages take 74 ms to load.

Since last running the S2 tests (about 4 days ago), I did a fair
amount of optimizing and I replaced the most obvious  by
 in about half of the JSPs. I therefore re-ran the tests just
before writing this current post.
There is a marked improvement and, on average, S2 pages load in 169 ms.

In other words, I may have been a little (!) hasty in posting my
previous statement! (*blushing*)  My apologies to all the people who
care about S2!!!
We are happily very far from the apocalyptic 30x factor that I had
previously observed.  (Some tests last week were showing averages of
580 ms per S2-page!)

As I am under pressure, I may not have time immediately to set up a
new test to compare the most recent result with the case of S2 pages
that entirely rely on , though that would be very
enlightening.  If I can get round to it, I promise to post the
results!

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re : Performance issue

2009-01-06 Thread François Rouxel
Is is the same model behind the MVC?

fr/

  




- Message d'origine 
De : Pierre Thibaudeau 
À : Struts Users Mailing List 
Envoyé le : Mardi, 6 Janvier 2009, 13h09mn 39s
Objet : Re: Performance issue

From the comparison I made on my own system, S2 is overall about 30 to
60 times slower than S1.  This is based on comparing a number of pages
(repeatedly, testing with JMeter, etc.);  the pages being compared
are, admittedly not 100% identical, but abstracting from the specific
differences, the performance of S2 is still more than one order of
magnitude behind what I had come to expect from S1.

I don't think I would ever want to go back to S1, given S2's
advantages.  But now that we are nearing production, S2's performance
is giving me headaches!

2008/12/13 yorlick kilroy wrote:
> The bottleneck is OGNL.
> I replaced the struts2 tags with JSTL Core
> This made loading my jsps almost 20 times faster!!!
> I mainly did this replacing in jsps that produce lots of output. I
> still use struts2 tags in jsps where I process forms and other small
> jsps.

I am following your lead and reverting to , and even removing
them altogether when the tag merely produces an HTML element such as
---I never use anything but the simple theme, as I rely
entirely on CSS and not on tables.

Two tags however seem very difficult to avoid:   and .


My application is entirely i18lized, so I rely heavily on those
resources. Since I use Spring, however, I am very tempted to use
Spring's resources feature and therefore Spring's tags to deal with
it;  I have no idea how fast they are, but it can't be worse than
S2s... (Unfortunately, Spring's resources are not customized to S2's
model-driven actions...) That would probably involve an unpleasant
amount of refactorization, but if it's worth it, I'll do it! Any
comment on this?


That's a tough one.  I may have to write my own OGNL-less version of
that tag...  Suggestions for a simpler alternative?

All in all, it seems to me that this performance issue could easily be
the death of S2 (which would be a real shame).  Two alternatives
present themselves:
* Making a version of S2 that doesn't necessarily rely on OGNL.
* Making OGNL ten times faster.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2009-01-06 Thread Musachy Barroso
60 times slower? I am expecting S2 to be slower that S1 but 60 times
sounds weird to me. The other thing that sounds weird is the huge
difference between 30 and 60 times.

musachy

On Tue, Jan 6, 2009 at 1:09 PM, Pierre Thibaudeau
 wrote:
> From the comparison I made on my own system, S2 is overall about 30 to
> 60 times slower than S1.  This is based on comparing a number of pages
> (repeatedly, testing with JMeter, etc.);  the pages being compared
> are, admittedly not 100% identical, but abstracting from the specific
> differences, the performance of S2 is still more than one order of
> magnitude behind what I had come to expect from S1.
>
> I don't think I would ever want to go back to S1, given S2's
> advantages.  But now that we are nearing production, S2's performance
> is giving me headaches!
>
> 2008/12/13 yorlick kilroy wrote:
>> The bottleneck is OGNL.
>> I replaced the struts2 tags with JSTL Core
>> This made loading my jsps almost 20 times faster!!!
>> I mainly did this replacing in jsps that produce lots of output. I
>> still use struts2 tags in jsps where I process forms and other small
>> jsps.
>
> I am following your lead and reverting to , and even removing
> them altogether when the tag merely produces an HTML element such as
> ---I never use anything but the simple theme, as I rely
> entirely on CSS and not on tables.
>
> Two tags however seem very difficult to avoid:   and .
>
> 
> My application is entirely i18lized, so I rely heavily on those
> resources. Since I use Spring, however, I am very tempted to use
> Spring's resources feature and therefore Spring's tags to deal with
> it;  I have no idea how fast they are, but it can't be worse than
> S2s... (Unfortunately, Spring's resources are not customized to S2's
> model-driven actions...) That would probably involve an unpleasant
> amount of refactorization, but if it's worth it, I'll do it! Any
> comment on this?
>
> 
> That's a tough one.  I may have to write my own OGNL-less version of
> that tag...  Suggestions for a simpler alternative?
>
> All in all, it seems to me that this performance issue could easily be
> the death of S2 (which would be a real shame).  Two alternatives
> present themselves:
> * Making a version of S2 that doesn't necessarily rely on OGNL.
> * Making OGNL ten times faster.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2009-01-06 Thread Pierre Thibaudeau
>From the comparison I made on my own system, S2 is overall about 30 to
60 times slower than S1.  This is based on comparing a number of pages
(repeatedly, testing with JMeter, etc.);  the pages being compared
are, admittedly not 100% identical, but abstracting from the specific
differences, the performance of S2 is still more than one order of
magnitude behind what I had come to expect from S1.

I don't think I would ever want to go back to S1, given S2's
advantages.  But now that we are nearing production, S2's performance
is giving me headaches!

2008/12/13 yorlick kilroy wrote:
> The bottleneck is OGNL.
> I replaced the struts2 tags with JSTL Core
> This made loading my jsps almost 20 times faster!!!
> I mainly did this replacing in jsps that produce lots of output. I
> still use struts2 tags in jsps where I process forms and other small
> jsps.

I am following your lead and reverting to , and even removing
them altogether when the tag merely produces an HTML element such as
---I never use anything but the simple theme, as I rely
entirely on CSS and not on tables.

Two tags however seem very difficult to avoid:   and .


My application is entirely i18lized, so I rely heavily on those
resources. Since I use Spring, however, I am very tempted to use
Spring's resources feature and therefore Spring's tags to deal with
it;  I have no idea how fast they are, but it can't be worse than
S2s... (Unfortunately, Spring's resources are not customized to S2's
model-driven actions...) That would probably involve an unpleasant
amount of refactorization, but if it's worth it, I'll do it! Any
comment on this?


That's a tough one.  I may have to write my own OGNL-less version of
that tag...  Suggestions for a simpler alternative?

All in all, it seems to me that this performance issue could easily be
the death of S2 (which would be a real shame).  Two alternatives
present themselves:
* Making a version of S2 that doesn't necessarily rely on OGNL.
* Making OGNL ten times faster.

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-15 Thread Steven Yang
I had encountered similar problem a while back in Webwork.I believe its
OGNL's problem as well. However, in most of my other projects using WebWork,
I had no performance problem. I believe it has something to do with some jar
files included in the project. I have not got a chance to find out which jar
is having conflict with OGNL. I do not believe OGNL is anything bad to be
included with Struts2, it's great, but maybe there is just some conflicts
with other programs. To solve it, I simply used JSTL tags just like kilroy.


Re: Performance issue

2008-12-13 Thread yorlick kilroy
but then howcome I'm getting such immense perfomace increases. I did a
bit of profiling in eclpise IDE and it turned out that OGNL is the
main performance killer ?

On Sat, Dec 13, 2008 at 11:53 PM, Dave Newton  wrote:
> --- On Sat, 12/13/08, yorlick kilroy wrote:
>> since I'm replacing all struts2 accessor tags and expressions
>> in my jsps I use the '$' instead of the '%' and '#'.
>
> If you're accessing value stack objects via ${...} it's still OGNL under the 
> hood--the S2 request wrapper will look for objects on the value stack first 
> then go to the default JEE scopes.
>
> Dave
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-13 Thread Dave Newton
--- On Sat, 12/13/08, yorlick kilroy wrote:
> since I'm replacing all struts2 accessor tags and expressions 
> in my jsps I use the '$' instead of the '%' and '#'.

If you're accessing value stack objects via ${...} it's still OGNL under the 
hood--the S2 request wrapper will look for objects on the value stack first 
then go to the default JEE scopes.

Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-13 Thread yorlick kilroy
since I'm replacing all struts2 accessor tags and expressions in my
jsps I use the '$' instead of the '%' and '#'. Obviously there are
convenience drawbacks such as the  tags that let you push a
value onto the ognl stack but the performance advantages overweigh the
conveniences that struts2 tags offer you.

On Sat, Dec 13, 2008 at 6:45 PM, Dave Newton  wrote:
> --- On Sat, 12/13/08, yorlick kilroy wrote:
>> Any way heres what I did. I replaced the struts2 tags
>> with JSTL Core tags: [...]
>
> Are you accessing value stack objects via JSP 2.0 EL's ${...} notation, or 
> have you put values into a JEE scope?
>
> Dave
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-13 Thread Dave Newton
--- On Sat, 12/13/08, yorlick kilroy wrote:
> Any way heres what I did. I replaced the struts2 tags 
> with JSTL Core tags: [...]

Are you accessing value stack objects via JSP 2.0 EL's ${...} notation, or have 
you put values into a JEE scope?

Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-13 Thread yorlick kilroy
Hi Hardik,

I had exactly the same problem with struts2. I wrote a struts2 webapp
that produces a huge amount of output in JSPs. My JSPs took about 10
seconds to produce the content. The bottleneck is OGNL. OGNL has an
extremely poor performance. Struts2 is an excellent framework but the
struts2 team shouldn't have integrated OGNL. Imho OGNL should be taken
out of the struts2 package.

Any way heres what I did. I replaced the struts2 tags with JSTL Core
tags: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html

It was a very easy task as the syntax of Core is very similar to
struts2 taglib. This made loading my jsps almost 20 times faster!!!
I mainly did this replacing in jsps that produce lots of output. I
still use struts2 tags in jsps where I process forms and other small
jsps. Try it, youll be amazed!

Cheers,
--- Ognl-Hater :-))

On Sat, Dec 13, 2008 at 6:11 PM, Dave Newton  wrote:
> --- On Sat, 12/13/08, Hardik Shah wrote:
>> [...] i dont know how to turn on profiliing [...]
>
> http://struts.apache.org/2.0.14/docs/profiling.html
>
> Dave
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-13 Thread Dave Newton
--- On Sat, 12/13/08, Hardik Shah wrote:
> [...] i dont know how to turn on profiliing [...]

http://struts.apache.org/2.0.14/docs/profiling.html

Dave


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-13 Thread Hardik Shah

Thanks For Showing interest ,but i dont know how to turn on profiliing
,please help me
i think its takes data from database in real speed but when trying to
display in new browser window 
takes time,i dont think time spent in action processing

Thnaks 

Hardik 




Hi Hardik,
what takes this time, page rendering in browser or result processing
or maybe You are talking about action processing time?
Also You can turn on profiling in struts2 to see how much time is spent
where.

Best greetings,
Paweł Wielgus.


-- 
View this message in context: 
http://www.nabble.com/Performance-issue-tp20949820p20991993.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Performance issue

2008-12-10 Thread Paweł Wielgus
Hi Hardik,
what takes this time, page rendering in browser or result processing
or maybe You are talking about action processing time?
Also You can turn on profiling in struts2 to see how much time is spent where.

Best greetings,
Paweł Wielgus.

2008/12/11 Hardik Shah <[EMAIL PROTECTED]>:
>
> hi
>
> i have use struts 2.0.11.2 and sitemesh for my project
>
> it all works fine but it kills performance
>
> i  can not fiind where the problem,so i am write here ,it might somebody
> help me
>
>
> i am opening new window using javascript
>
> str="ViewWorkspaceUserRights.do?workSpaceId="+workSpaceId+"&userCode="+userId;
> win3
> =window.open(str,"ThisWindow","toolbar=no,directories=no,menubar=no,scrollbars=yes,height=700,width=1000,resizable=no,titlebar=no
> top=100")
>
> in jsp of new window i have used s:iterator tag
>
> there are approximately more than 500 records for display in table
>
> but it takes more than 1 minute
>
> ,there is no problem at database side
>
>
> plese help me if anybody can do
> --
> View this message in context: 
> http://www.nabble.com/Performance-issue-tp20949820p20949820.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Performance issue

2007-01-05 Thread Daniel Chacón Sánchez

Thanks again Leon :)

2007/1/4, Leon Rosenberg <[EMAIL PROTECTED]>:


there are 4 scopes or visibilities/lifecycles of attributes in the
servlet/jsp world.

page : the jsp page, same as local variable in a class.
request: the duration of the request over multiple pages
session: the duration of the user session, over multiple requests
application scope: the whole webapp.

However, talking about one of these scopes, you are always talking
about _one_ server and _one_ webapp.

So the application scope is something which belong to a) webapp and b)
server in first line.

As for multi-server environment - there are a lot of details here, and
I don't really know whether yours handle application scope like a
cluster-scope or not.
I would assume that each server has its own copy created at the start
of the server / deployment of the application.

In my world, if I'd have to implement this requirement I would select
one of two choices:

In both:  Create a service which manages the data and speaks to the db.

Option 1. A thread in the application (or timer event, or scheduler)
checks periodically (depending on the requirements it could be 1
minute or 15) with the service whether the local data is still
up-to-date. This can be done by comparing version numbers or creation
timestamps. If not the data in the application scope gets replaced.

Option 2. Service distributes new versions of the data via some
publisher/subscriber mechanism, like JMS, CORBA
Event/NotificationService, or something you develop yourself. The
subscriber resides in the webserver and puts updated data into the
local application scope.

Option 3. You may also use whatever capabilities your environment has,
if any. But I'd be very careful with loadbalancing and scope
distribution, 99.99% of what I saw sofar sucked badly.

regards
Leon







On 1/4/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> Thanks Leon!!!
>
> Ok I made it using the servletcontext like you have said :-), with this
>
> servlet.getServletContext().setAttribute("objHospital", objHospital);
>
> All works fine, even if the user made a mistake :)
>
> One question:
>
> 1- I dont understand something about the servletContext, which is the
> problem of have multiple-server configuration? In both servers the data
is
> store in the servlet context right? I guess the problem is that in some
> moment the objHospital in one server is diferent to the objHospital in
other
> server because it change in the database? Or that the actions of one war
> don´t have the same servlet context that the actions on other war? I
really
> don´t understand this, can you explain me that, like i said all works
fine
> but i want to understand this.
>
> Thanks
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Performance issue

2007-01-04 Thread Leon Rosenberg

there are 4 scopes or visibilities/lifecycles of attributes in the
servlet/jsp world.

page : the jsp page, same as local variable in a class.
request: the duration of the request over multiple pages
session: the duration of the user session, over multiple requests
application scope: the whole webapp.

However, talking about one of these scopes, you are always talking
about _one_ server and _one_ webapp.

So the application scope is something which belong to a) webapp and b)
server in first line.

As for multi-server environment - there are a lot of details here, and
I don't really know whether yours handle application scope like a
cluster-scope or not.
I would assume that each server has its own copy created at the start
of the server / deployment of the application.

In my world, if I'd have to implement this requirement I would select
one of two choices:

In both:  Create a service which manages the data and speaks to the db.

Option 1. A thread in the application (or timer event, or scheduler)
checks periodically (depending on the requirements it could be 1
minute or 15) with the service whether the local data is still
up-to-date. This can be done by comparing version numbers or creation
timestamps. If not the data in the application scope gets replaced.

Option 2. Service distributes new versions of the data via some
publisher/subscriber mechanism, like JMS, CORBA
Event/NotificationService, or something you develop yourself. The
subscriber resides in the webserver and puts updated data into the
local application scope.

Option 3. You may also use whatever capabilities your environment has,
if any. But I'd be very careful with loadbalancing and scope
distribution, 99.99% of what I saw sofar sucked badly.

regards
Leon







On 1/4/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:

Thanks Leon!!!

Ok I made it using the servletcontext like you have said :-), with this

servlet.getServletContext().setAttribute("objHospital", objHospital);

All works fine, even if the user made a mistake :)

One question:

1- I dont understand something about the servletContext, which is the
problem of have multiple-server configuration? In both servers the data is
store in the servlet context right? I guess the problem is that in some
moment the objHospital in one server is diferent to the objHospital in other
server because it change in the database? Or that the actions of one war
don´t have the same servlet context that the actions on other war? I really
don´t understand this, can you explain me that, like i said all works fine
but i want to understand this.

Thanks




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Performance issue

2007-01-04 Thread Daniel Chacón Sánchez

Thanks Leon!!!

Ok I made it using the servletcontext like you have said :-), with this

servlet.getServletContext().setAttribute("objHospital", objHospital);

All works fine, even if the user made a mistake :)

One question:

1- I dont understand something about the servletContext, which is the
problem of have multiple-server configuration? In both servers the data is
store in the servlet context right? I guess the problem is that in some
moment the objHospital in one server is diferent to the objHospital in other
server because it change in the database? Or that the actions of one war
don´t have the same servlet context that the actions on other war? I really
don´t understand this, can you explain me that, like i said all works fine
but i want to understand this.

Thanks


Re: Performance issue

2007-01-04 Thread Leon Rosenberg

Hmm,
can you send some code?

What kind of validation do you use? Serverside or js?
I suppose it happens because the validation-whatsoever send the user
directly to use jsp bypassing the action.

If you need a quick and dirty solution, alter you preExecute method to
put the objects into the session instead of the request scope. If you
want to make it less dirty add a check whether they already are there:
if (req.getSession().getAttribute("objHospitals")==null)
 req.getSession.setAttribute("objHospitals", staticObjHospitalsVariable);

For the proper solution you should show your code and struts-config
parts, so we can work out the best solution.

regards
Leon

P.S. are you on struts 1.x or 2.x?

On 1/4/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:

Leon!!! something happen... I applied your solution putting the objects in
the request in the  preExecute method of the base action, and all works
fine, but... when the user made a mistake, for example leave a required
field in blank, and the  ActionErrors validate method of the ActionForm
return the errors, the jsp launch the following exception:

javax.servlet.jsp.JspException:
   Cannot find bean under name objHospitals

This only happen when the method validate of the actionErrors returns an
error, why the request is lost or why the jsp don´t found the object? How
can I solve this problem, thanks!!! Hope you can answer Leon


2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:
>
> u welcome :-)
> L
>
> On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> > Thanks Leon!!!, I got it!!!
> >
> > 2007/1/2, Leon Rosenberg < [EMAIL PROTECTED]>:
> > >
> > > On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> > > > Thanks
> > > >
> > > > Leon, about using the servlet context, I read that on a distributed
> > > > application the share information of the servlet context is not
> > > entererly
> > > > global right?:
> > >
> > > Right, but since the data is readonly its ok to have a copy per
> > > webserver, right? It doesn't harm you to put one data-object (even a
> > > complex one) in the application scope. If you need to check for
> > > updates periodically you could make use of the subject-observer
> > > pattern and notify the webservers from the business layer via
> > > rmi/corba/jms/whatever to renew their data or just check if the data
> > > is still valid and replace it if needed periodically in a separate
> > > daemon thread.
> > >
> > > >
> > > > *"...In the case of a web application marked "distributed" in its
> > > deployment
> > > > descriptor, there will be one context instance for each virtual
> machine.
> > > In
> > > > this situation, the context cannot be used as a location to share
> global
> > > > information (because the information won't be truly global). Use an
> > > external
> > > > resource like a database instead."*
> > > >
> > > >
> > > > About the second solution that you gave to me, I do not understand,
> you
> > > said
> > > > that for example in my BaseAction Class create a method to put the
> > > objects
> > > > in the request? The problem is that in every request the application
> > > will go
> > > > to the database to load the objects and then put them on the
> request!
> > > What I
> > > > do not understand is how to put the objects in the request without
> have
> > > to
> > > > go the database each time that a request is made and the method in
> the
> > > > BaseAction is call.
> > >
> > > BaseAction extends Action{
> > >   private static Data1Class data1;
> > >   private static Data2Class data2;
> > >   
> > >
> > >   static{
> > >  data1 = createData1FromDB();
> > >  data2 = createData2FromDB();
> > >   }
> > >
> > >   //now in my actions i have my own execute method, you may have
> > > something //similar:
> > > protected void preProcessExecute(
> > > ActionMapping mapping,
> > > ActionForm af,
> > > HttpServletRequest req,
> > > HttpServletResponse res)
> > > throws Exception{
> > >
> > > req.setAttribute("data1", data1);
> > > req.setAttribute("data2", data2);
> > >   .
> > >   }
> > >
> > > protected void postProcessExecute(
> > > ActionMapping mapping,
> > > ActionForm af,
> > > HttpServletRequest req,
> > > HttpServletResponse res)
> > > throws Exception{
> > >
> > > }
> > >
> > > public abstract ActionForward myExecute(
> > > ActionMapping mapping,
> > > ActionForm af,
> > > HttpServletRequest req,
> > > HttpServletResponse res)
> > > throws Exception;
> > >
> > >
> > > public final ActionForward execute(
> > > ActionMapping mapping,
> > > ActionFor

Re: Performance issue

2007-01-04 Thread Daniel Chacón Sánchez

Leon!!! something happen... I applied your solution putting the objects in
the request in the  preExecute method of the base action, and all works
fine, but... when the user made a mistake, for example leave a required
field in blank, and the  ActionErrors validate method of the ActionForm
return the errors, the jsp launch the following exception:

javax.servlet.jsp.JspException:
  Cannot find bean under name objHospitals

This only happen when the method validate of the actionErrors returns an
error, why the request is lost or why the jsp don´t found the object? How
can I solve this problem, thanks!!! Hope you can answer Leon


2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:


u welcome :-)
L

On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> Thanks Leon!!!, I got it!!!
>
> 2007/1/2, Leon Rosenberg < [EMAIL PROTECTED]>:
> >
> > On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> > > Thanks
> > >
> > > Leon, about using the servlet context, I read that on a distributed
> > > application the share information of the servlet context is not
> > entererly
> > > global right?:
> >
> > Right, but since the data is readonly its ok to have a copy per
> > webserver, right? It doesn't harm you to put one data-object (even a
> > complex one) in the application scope. If you need to check for
> > updates periodically you could make use of the subject-observer
> > pattern and notify the webservers from the business layer via
> > rmi/corba/jms/whatever to renew their data or just check if the data
> > is still valid and replace it if needed periodically in a separate
> > daemon thread.
> >
> > >
> > > *"...In the case of a web application marked "distributed" in its
> > deployment
> > > descriptor, there will be one context instance for each virtual
machine.
> > In
> > > this situation, the context cannot be used as a location to share
global
> > > information (because the information won't be truly global). Use an
> > external
> > > resource like a database instead."*
> > >
> > >
> > > About the second solution that you gave to me, I do not understand,
you
> > said
> > > that for example in my BaseAction Class create a method to put the
> > objects
> > > in the request? The problem is that in every request the application
> > will go
> > > to the database to load the objects and then put them on the
request!
> > What I
> > > do not understand is how to put the objects in the request without
have
> > to
> > > go the database each time that a request is made and the method in
the
> > > BaseAction is call.
> >
> > BaseAction extends Action{
> >   private static Data1Class data1;
> >   private static Data2Class data2;
> >   
> >
> >   static{
> >  data1 = createData1FromDB();
> >  data2 = createData2FromDB();
> >   }
> >
> >   //now in my actions i have my own execute method, you may have
> > something //similar:
> > protected void preProcessExecute(
> > ActionMapping mapping,
> > ActionForm af,
> > HttpServletRequest req,
> > HttpServletResponse res)
> > throws Exception{
> >
> > req.setAttribute("data1", data1);
> > req.setAttribute("data2", data2);
> >   .
> >   }
> >
> > protected void postProcessExecute(
> > ActionMapping mapping,
> > ActionForm af,
> > HttpServletRequest req,
> > HttpServletResponse res)
> > throws Exception{
> >
> > }
> >
> > public abstract ActionForward myExecute(
> > ActionMapping mapping,
> > ActionForm af,
> > HttpServletRequest req,
> > HttpServletResponse res)
> > throws Exception;
> >
> >
> > public final ActionForward execute(
> > ActionMapping mapping,
> > ActionForm bean,
> > HttpServletRequest req,
> > HttpServletResponse res)
> > throws Exception {
> >
> >
> > preProcessExecute(mapping, bean, req, res);
> > ActionForward forward = myExecute(mapping, bean, req,
> > res);
> > postProcessExecute(mapping, bean, req, res);
> > return forward;
> > }
> > }
> >
> > You just have to ensure, that when an Action overwrites preProcess it
> > calls super.preProcess.
> > The advantage of this method is, that actions at the end of the
> > hierarchy have a chance to overwrite the data by the base action,
> > which is quite useful for internationalization and such.
> >
> > Same rules for updates as for servletContext apply.
> >
> > regards
> > Leon
> >
> >
> > >
> > > 2007/1/2, Leon Rosenberg <[EMAIL PROTECTED] >:
> > > >
> > > > The easiest way is to initialize the data once in the
> > > > init(ServletCon

RE: Performance issue

2007-01-02 Thread Raghu

You need to set the collection to actionform every time when page loads if
there are many actionforms in request scope.

If the actionform is in session then it is required to set the collection
when page loads.

It depends on how your application is designed in terms of actionforma and
their properties



*
TestUtil.Java
*
public static Vector vechospitals;   // holds hospitals
static
{
vechospitals= new Vector();

vecRFQView.addElement(new LabelValueBean("Select Hospital ","0"));
// default selected

 // if the hospitals are predifined
vecRFQView.addElement(new LabelValueBean("hospital 1","1"));
vecRFQView.addElement(new LabelValueBean("hospital 2","2"));
 // if the hospitals are from database

 vecRFQView.addElement(new
LabelValueBean(resultset.getString("hospital_name"),resultset.getString("hos
pital_id")));


}
*
In action class
*
// set View Collection for Dropdownbox in actinform

testActionForm.setHospitals(TestUtil.vechospitals);
*
In actionForm class
*

 /**
  * Holds list of Hospitals Collection
  */
 private Vector vechospitals=null;

 /**
  * @return Returns the vechospitals.
  */
 public Vector getHospitals() {
 return vechospitals;
 }



 /**
  * @param vechospitalsThe vechospitals to set.
  */
 public void setHospitals(Vector vechospitals) {
 this.vechospitals= vechospitals;
 }






-Original Message-
From: Leon Rosenberg [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 03, 2007 12:28 AM
To: Struts Users Mailing List
Subject: Re: Performance issue


The easiest way is to initialize the data once in the
init(ServletConfig) method of the servlet and put them into the
application scope (servletcontext). The struts tags will be able to
access the data directly, so you don't need to change a bit.
Of course the data structures theirself must be threadsafe to access,
which shouldn't be a problem if you are only reading them.

Alternatively you can perform this in a static initializer in a action
and put them in the request scope of each request (if you have a
common code block all actions are passing through, like authorization)
or into the application scope on first request (which would need a bit
of synchronization with double checked locking)

regards
leon

On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> Hi all, I'm using struts framework on my application, but I have a
> perfomance question.
>
> When my application starts I load objects in session that may or may not
> will be used (depends on what the user does),  for example I load the
health
> centers, hospitals, countries, etc, that will be available for the users
in
> html:selects, I know that to had many objects in session is not good, in
> fact each time the user click on one application option (menu) all the
> objects in session are erased, except the ones that I load on the start of
> the application. Is there a way (maybe a pattern) to load this objects in
> the moment that are needed, and not load all at the start of the
> application. This object are use on differents modules so I load them on
the
> start of the aplication and put them in sesion for not to go to the
database
> each time I need to load them on a html:select.
>
> any solution, idea? or that is the only way?
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Performance issue

2007-01-02 Thread Leon Rosenberg

u welcome :-)
L

On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:

Thanks Leon!!!, I got it!!!

2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:
>
> On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> > Thanks
> >
> > Leon, about using the servlet context, I read that on a distributed
> > application the share information of the servlet context is not
> entererly
> > global right?:
>
> Right, but since the data is readonly its ok to have a copy per
> webserver, right? It doesn't harm you to put one data-object (even a
> complex one) in the application scope. If you need to check for
> updates periodically you could make use of the subject-observer
> pattern and notify the webservers from the business layer via
> rmi/corba/jms/whatever to renew their data or just check if the data
> is still valid and replace it if needed periodically in a separate
> daemon thread.
>
> >
> > *"...In the case of a web application marked "distributed" in its
> deployment
> > descriptor, there will be one context instance for each virtual machine.
> In
> > this situation, the context cannot be used as a location to share global
> > information (because the information won't be truly global). Use an
> external
> > resource like a database instead."*
> >
> >
> > About the second solution that you gave to me, I do not understand, you
> said
> > that for example in my BaseAction Class create a method to put the
> objects
> > in the request? The problem is that in every request the application
> will go
> > to the database to load the objects and then put them on the request!
> What I
> > do not understand is how to put the objects in the request without have
> to
> > go the database each time that a request is made and the method in the
> > BaseAction is call.
>
> BaseAction extends Action{
>   private static Data1Class data1;
>   private static Data2Class data2;
>   
>
>   static{
>  data1 = createData1FromDB();
>  data2 = createData2FromDB();
>   }
>
>   //now in my actions i have my own execute method, you may have
> something //similar:
> protected void preProcessExecute(
> ActionMapping mapping,
> ActionForm af,
> HttpServletRequest req,
> HttpServletResponse res)
> throws Exception{
>
> req.setAttribute("data1", data1);
> req.setAttribute("data2", data2);
>   .
>   }
>
> protected void postProcessExecute(
> ActionMapping mapping,
> ActionForm af,
> HttpServletRequest req,
> HttpServletResponse res)
> throws Exception{
>
> }
>
> public abstract ActionForward myExecute(
> ActionMapping mapping,
> ActionForm af,
> HttpServletRequest req,
> HttpServletResponse res)
> throws Exception;
>
>
> public final ActionForward execute(
> ActionMapping mapping,
> ActionForm bean,
> HttpServletRequest req,
> HttpServletResponse res)
> throws Exception {
>
>
> preProcessExecute(mapping, bean, req, res);
> ActionForward forward = myExecute(mapping, bean, req,
> res);
> postProcessExecute(mapping, bean, req, res);
> return forward;
> }
> }
>
> You just have to ensure, that when an Action overwrites preProcess it
> calls super.preProcess.
> The advantage of this method is, that actions at the end of the
> hierarchy have a chance to overwrite the data by the base action,
> which is quite useful for internationalization and such.
>
> Same rules for updates as for servletContext apply.
>
> regards
> Leon
>
>
> >
> > 2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:
> > >
> > > The easiest way is to initialize the data once in the
> > > init(ServletConfig) method of the servlet and put them into the
> > > application scope (servletcontext). The struts tags will be able to
> > > access the data directly, so you don't need to change a bit.
> > > Of course the data structures theirself must be threadsafe to access,
> > > which shouldn't be a problem if you are only reading them.
> > >
> > > Alternatively you can perform this in a static initializer in a action
> > > and put them in the request scope of each request (if you have a
> > > common code block all actions are passing through, like authorization)
> > > or into the application scope on first request (which would need a bit
> > > of synchronization with double checked locking)
> > >
> > > regards
> > > leon
> > >
> > > On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> > > > Hi all, I'm using struts framework on my application, but I have a
> > > > perfomance question.
> > > >
> > > > When my applica

Re: Performance issue

2007-01-02 Thread Daniel Chacón Sánchez

Thanks Leon!!!, I got it!!!

2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:


On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> Thanks
>
> Leon, about using the servlet context, I read that on a distributed
> application the share information of the servlet context is not
entererly
> global right?:

Right, but since the data is readonly its ok to have a copy per
webserver, right? It doesn't harm you to put one data-object (even a
complex one) in the application scope. If you need to check for
updates periodically you could make use of the subject-observer
pattern and notify the webservers from the business layer via
rmi/corba/jms/whatever to renew their data or just check if the data
is still valid and replace it if needed periodically in a separate
daemon thread.

>
> *"...In the case of a web application marked "distributed" in its
deployment
> descriptor, there will be one context instance for each virtual machine.
In
> this situation, the context cannot be used as a location to share global
> information (because the information won't be truly global). Use an
external
> resource like a database instead."*
>
>
> About the second solution that you gave to me, I do not understand, you
said
> that for example in my BaseAction Class create a method to put the
objects
> in the request? The problem is that in every request the application
will go
> to the database to load the objects and then put them on the request!
What I
> do not understand is how to put the objects in the request without have
to
> go the database each time that a request is made and the method in the
> BaseAction is call.

BaseAction extends Action{
  private static Data1Class data1;
  private static Data2Class data2;
  

  static{
 data1 = createData1FromDB();
 data2 = createData2FromDB();
  }

  //now in my actions i have my own execute method, you may have
something //similar:
protected void preProcessExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception{

req.setAttribute("data1", data1);
req.setAttribute("data2", data2);
  .
  }

protected void postProcessExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception{

}

public abstract ActionForward myExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception;


public final ActionForward execute(
ActionMapping mapping,
ActionForm bean,
HttpServletRequest req,
HttpServletResponse res)
throws Exception {


preProcessExecute(mapping, bean, req, res);
ActionForward forward = myExecute(mapping, bean, req,
res);
postProcessExecute(mapping, bean, req, res);
return forward;
}
}

You just have to ensure, that when an Action overwrites preProcess it
calls super.preProcess.
The advantage of this method is, that actions at the end of the
hierarchy have a chance to overwrite the data by the base action,
which is quite useful for internationalization and such.

Same rules for updates as for servletContext apply.

regards
Leon


>
> 2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:
> >
> > The easiest way is to initialize the data once in the
> > init(ServletConfig) method of the servlet and put them into the
> > application scope (servletcontext). The struts tags will be able to
> > access the data directly, so you don't need to change a bit.
> > Of course the data structures theirself must be threadsafe to access,
> > which shouldn't be a problem if you are only reading them.
> >
> > Alternatively you can perform this in a static initializer in a action
> > and put them in the request scope of each request (if you have a
> > common code block all actions are passing through, like authorization)
> > or into the application scope on first request (which would need a bit
> > of synchronization with double checked locking)
> >
> > regards
> > leon
> >
> > On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> > > Hi all, I'm using struts framework on my application, but I have a
> > > perfomance question.
> > >
> > > When my application starts I load objects in session that may or may
not
> > > will be used (depends on what the user does),  for example I load
the
> > health
> > > centers, hospitals, countries, etc, that will be available for the
users
> > in
> > > html:selects, I know that to had many objects in session is not
good, in
> > > fact each ti

Re: Performance issue

2007-01-02 Thread Leon Rosenberg

On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:

Thanks

Leon, about using the servlet context, I read that on a distributed
application the share information of the servlet context is not entererly
global right?:


Right, but since the data is readonly its ok to have a copy per
webserver, right? It doesn't harm you to put one data-object (even a
complex one) in the application scope. If you need to check for
updates periodically you could make use of the subject-observer
pattern and notify the webservers from the business layer via
rmi/corba/jms/whatever to renew their data or just check if the data
is still valid and replace it if needed periodically in a separate
daemon thread.



*"...In the case of a web application marked "distributed" in its deployment
descriptor, there will be one context instance for each virtual machine. In
this situation, the context cannot be used as a location to share global
information (because the information won't be truly global). Use an external
resource like a database instead."*


About the second solution that you gave to me, I do not understand, you said
that for example in my BaseAction Class create a method to put the objects
in the request? The problem is that in every request the application will go
to the database to load the objects and then put them on the request! What I
do not understand is how to put the objects in the request without have to
go the database each time that a request is made and the method in the
BaseAction is call.


BaseAction extends Action{
 private static Data1Class data1;
 private static Data2Class data2;
 

 static{
data1 = createData1FromDB();
data2 = createData2FromDB();
 }

 //now in my actions i have my own execute method, you may have
something //similar:
protected void preProcessExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception{

req.setAttribute("data1", data1);
req.setAttribute("data2", data2); 
 .
 }

protected void postProcessExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception{

}

public abstract ActionForward myExecute(
ActionMapping mapping,
ActionForm af,
HttpServletRequest req,
HttpServletResponse res)
throws Exception;


public final ActionForward execute(
ActionMapping mapping,
ActionForm bean,
HttpServletRequest req,
HttpServletResponse res)
throws Exception {


preProcessExecute(mapping, bean, req, res);
ActionForward forward = myExecute(mapping, bean, req, res);
postProcessExecute(mapping, bean, req, res);
return forward;
}
}

You just have to ensure, that when an Action overwrites preProcess it
calls super.preProcess.
The advantage of this method is, that actions at the end of the
hierarchy have a chance to overwrite the data by the base action,
which is quite useful for internationalization and such.

Same rules for updates as for servletContext apply.

regards
Leon




2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:
>
> The easiest way is to initialize the data once in the
> init(ServletConfig) method of the servlet and put them into the
> application scope (servletcontext). The struts tags will be able to
> access the data directly, so you don't need to change a bit.
> Of course the data structures theirself must be threadsafe to access,
> which shouldn't be a problem if you are only reading them.
>
> Alternatively you can perform this in a static initializer in a action
> and put them in the request scope of each request (if you have a
> common code block all actions are passing through, like authorization)
> or into the application scope on first request (which would need a bit
> of synchronization with double checked locking)
>
> regards
> leon
>
> On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> > Hi all, I'm using struts framework on my application, but I have a
> > perfomance question.
> >
> > When my application starts I load objects in session that may or may not
> > will be used (depends on what the user does),  for example I load the
> health
> > centers, hospitals, countries, etc, that will be available for the users
> in
> > html:selects, I know that to had many objects in session is not good, in
> > fact each time the user click on one application option (menu) all the
> > objects in session are erased, except the ones that I load on

Re: Performance issue

2007-01-02 Thread Daniel Chacón Sánchez

Thanks

Leon, about using the servlet context, I read that on a distributed
application the share information of the servlet context is not entererly
global right?:

*"...In the case of a web application marked "distributed" in its deployment
descriptor, there will be one context instance for each virtual machine. In
this situation, the context cannot be used as a location to share global
information (because the information won't be truly global). Use an external
resource like a database instead."*


About the second solution that you gave to me, I do not understand, you said
that for example in my BaseAction Class create a method to put the objects
in the request? The problem is that in every request the application will go
to the database to load the objects and then put them on the request! What I
do not understand is how to put the objects in the request without have to
go the database each time that a request is made and the method in the
BaseAction is call.

2007/1/2, Leon Rosenberg <[EMAIL PROTECTED]>:


The easiest way is to initialize the data once in the
init(ServletConfig) method of the servlet and put them into the
application scope (servletcontext). The struts tags will be able to
access the data directly, so you don't need to change a bit.
Of course the data structures theirself must be threadsafe to access,
which shouldn't be a problem if you are only reading them.

Alternatively you can perform this in a static initializer in a action
and put them in the request scope of each request (if you have a
common code block all actions are passing through, like authorization)
or into the application scope on first request (which would need a bit
of synchronization with double checked locking)

regards
leon

On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:
> Hi all, I'm using struts framework on my application, but I have a
> perfomance question.
>
> When my application starts I load objects in session that may or may not
> will be used (depends on what the user does),  for example I load the
health
> centers, hospitals, countries, etc, that will be available for the users
in
> html:selects, I know that to had many objects in session is not good, in
> fact each time the user click on one application option (menu) all the
> objects in session are erased, except the ones that I load on the start
of
> the application. Is there a way (maybe a pattern) to load this objects
in
> the moment that are needed, and not load all at the start of the
> application. This object are use on differents modules so I load them on
the
> start of the aplication and put them in sesion for not to go to the
database
> each time I need to load them on a html:select.
>
> any solution, idea? or that is the only way?
>
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Performance issue

2007-01-02 Thread Leon Rosenberg

The easiest way is to initialize the data once in the
init(ServletConfig) method of the servlet and put them into the
application scope (servletcontext). The struts tags will be able to
access the data directly, so you don't need to change a bit.
Of course the data structures theirself must be threadsafe to access,
which shouldn't be a problem if you are only reading them.

Alternatively you can perform this in a static initializer in a action
and put them in the request scope of each request (if you have a
common code block all actions are passing through, like authorization)
or into the application scope on first request (which would need a bit
of synchronization with double checked locking)

regards
leon

On 1/2/07, Daniel Chacón Sánchez <[EMAIL PROTECTED]> wrote:

Hi all, I'm using struts framework on my application, but I have a
perfomance question.

When my application starts I load objects in session that may or may not
will be used (depends on what the user does),  for example I load the health
centers, hospitals, countries, etc, that will be available for the users in
html:selects, I know that to had many objects in session is not good, in
fact each time the user click on one application option (menu) all the
objects in session are erased, except the ones that I load on the start of
the application. Is there a way (maybe a pattern) to load this objects in
the moment that are needed, and not load all at the start of the
application. This object are use on differents modules so I load them on the
start of the aplication and put them in sesion for not to go to the database
each time I need to load them on a html:select.

any solution, idea? or that is the only way?




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Performance issue

2007-01-02 Thread Asthana, Rahul
Assuming the lists are user dependent..
1)You should run some profiling and load tests.There may be no performance 
issue in the first place.
2)Keep the actual content of the lists in application scope and only the ids in 
session.Lets say you have to show {"New York","London",Toronto"}; keep an int 
array in session{1,2,3}and  use the request interceptor or Tiles Controller to 
fetch the actual content.
HTH
 
-Original Message-
From: Mike Baroukh [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 02, 2007 12:47 PM
To: Struts Users Mailing List
Subject: Re: Performance issue



If those lists are not user-dependant, you can put them in application 
context. This way, they will be shared by all your users.

If they are user-dependant, I think I would have done a bean that 
provides properties that get data from db on the fly.
Of course, if an error occur, it will be in jsp rendering ...

Maybe you can also put in request (not in session) frequently used 
values with an interceptor ?

Mike

Daniel Chacón Sánchez a écrit :
> Hi all, I'm using struts framework on my application, but I have a
> perfomance question.
>
> When my application starts I load objects in session that may or may not
> will be used (depends on what the user does),  for example I load the 
> health
> centers, hospitals, countries, etc, that will be available for the 
> users in
> html:selects, I know that to had many objects in session is not good, in
> fact each time the user click on one application option (menu) all the
> objects in session are erased, except the ones that I load on the 
> start of
> the application. Is there a way (maybe a pattern) to load this objects in
> the moment that are needed, and not load all at the start of the
> application. This object are use on differents modules so I load them 
> on the
> start of the aplication and put them in sesion for not to go to the 
> database
> each time I need to load them on a html:select.
>
> any solution, idea? or that is the only way?
>


-- 

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED]
http://www.cardiweb.com
---



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Performance issue

2007-01-02 Thread Daniel Chacón Sánchez

Hi Mike, the list are not user-dependant, I load those list from the
database, and are the same for all users, but how can I put then on the
application context??

2007/1/2, Mike Baroukh <[EMAIL PROTECTED]>:



If those lists are not user-dependant, you can put them in application
context. This way, they will be shared by all your users.

If they are user-dependant, I think I would have done a bean that
provides properties that get data from db on the fly.
Of course, if an error occur, it will be in jsp rendering ...

Maybe you can also put in request (not in session) frequently used
values with an interceptor ?

Mike

Daniel Chacón Sánchez a écrit :
> Hi all, I'm using struts framework on my application, but I have a
> perfomance question.
>
> When my application starts I load objects in session that may or may not
> will be used (depends on what the user does),  for example I load the
> health
> centers, hospitals, countries, etc, that will be available for the
> users in
> html:selects, I know that to had many objects in session is not good, in
> fact each time the user click on one application option (menu) all the
> objects in session are erased, except the ones that I load on the
> start of
> the application. Is there a way (maybe a pattern) to load this objects
in
> the moment that are needed, and not load all at the start of the
> application. This object are use on differents modules so I load them
> on the
> start of the aplication and put them in sesion for not to go to the
> database
> each time I need to load them on a html:select.
>
> any solution, idea? or that is the only way?
>


--

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED]
http://www.cardiweb.com
---




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Performance issue

2007-01-02 Thread Mike Baroukh


If those lists are not user-dependant, you can put them in application 
context. This way, they will be shared by all your users.


If they are user-dependant, I think I would have done a bean that 
provides properties that get data from db on the fly.

Of course, if an error occur, it will be in jsp rendering ...

Maybe you can also put in request (not in session) frequently used 
values with an interceptor ?


Mike

Daniel Chacón Sánchez a écrit :

Hi all, I'm using struts framework on my application, but I have a
perfomance question.

When my application starts I load objects in session that may or may not
will be used (depends on what the user does),  for example I load the 
health
centers, hospitals, countries, etc, that will be available for the 
users in

html:selects, I know that to had many objects in session is not good, in
fact each time the user click on one application option (menu) all the
objects in session are erased, except the ones that I load on the 
start of

the application. Is there a way (maybe a pattern) to load this objects in
the moment that are needed, and not load all at the start of the
application. This object are use on differents modules so I load them 
on the
start of the aplication and put them in sesion for not to go to the 
database

each time I need to load them on a html:select.

any solution, idea? or that is the only way?




--

Mike Baroukh

---
Cardiweb  - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: [EMAIL PROTECTED]
http://www.cardiweb.com
---


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]