You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by croffman <my...@hotmail.com> on 2005/06/09 18:43:53 UTC

Multiple user - problem

Using Struts & EJB's - For load testing, facing a problem, that if 10 multiple users are accessing at the same time, only one user is getting other user data (WRONG data) out of 10 users. But all other 9 users are getting correct data.

The wrong data for that one user, is from one out of 9 other users.

Any kind of suggestions/inputs are helpful.

Thanks in advance.

Re: Multiple user - problem

Posted by Martin Gainty <mg...@hotmail.com>.
About 3/4 of the way down in the article 'j2ee design patterns' authored by 
William Crawford and Jonathan Kaplan
http://www.devx.com/assets/download/7254.pdf
Read the 'criteria' 'convert your session beans into business delegates' --  
very instructional to the scenario you have described
HTH
Martin-
----- Original Message ----- 
From: "croffman" <my...@hotmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, June 09, 2005 3:49 PM
Subject: Re: Multiple user - problem


Thanks for the quick responses.

Here is some more info:

1. >>>>>Is it worse with more users?
This was done by manual users, before load testing. Couldn't try that now.

2. >>>>>Do you keep any non-synchronized user-specific info in an instance 
of a class that is only instantiated once (like a servlet or action)? That 
gets a lot of people even though it's in all the documentation.
Looks like there is a similarity. But not sure. Had a MAIN action class 
(which extends from TilesAction), which contains a protected class defined 
and that got the CDTO in it. Whereever needed in all the action classes, the 
CDTO is got from this protected class. Is there any problem here?

3. >>>>>-synchronisation of all method calls
No where explicit synchronization is being used in the application.

4. >>>>>-scoping of data entities(assuming you are implementing with beans)
Kept the forms in request scope.

5. >>>>Also - are you resetting all of the properties in your forms classes. 
If not, some of the data set by one user can bleed over to another user.
As using DynaValidatorForm, not sure how to reset the properties.

In the app, are using Struts form-beans 
(org.apache.struts.validator.DynaValidatorForm). And in the action classes, 
calling the delegate by passing the cdto (custom data transfer object), 
which contains the request data. And when the delegate calls the EJB's, it 
gets the data from database and populates the custom data transfer object 
and sent back to the action class. And in the action class, this cdto is 
copied back to form.

The wrong data came up for one user only. Is there any chance that this cdto 
is shared and being used for two users. Couldn't think of a chance, but...? 
Is there any chance by POINT #2 above.

And EJB's are stateless and Entity Beans are with container managed 
persitance.

Once again thanks for your suggestions.

Croff


----- Original Message ----- 
From: "Martin Gainty" <mg...@hotmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, June 09, 2005 2:22 PM
Subject: Re: Multiple user - problem


> both concepts are applicable in that
> scoping of session based information should ultimately pull from
> user-neutral entity (such as Class Object) whose end of life is not
> dependent on either client session passivation or client session 
> termination
> Any underlying synchronisation mechanisms for entities (synchronised
> objects) are entirely dependent on selection of scope and
> whether the implementor is controlling the object via declarative or
> programmatically means
>
> Here are some good reads
> Problem Scenario for Stateful Session Beans
> http://docs.sun.com/source/817-2162-10/bpstatement.html
> Software Architecture in Practice: The Luther Architecture
> http://www.awprofessional.com/articles/article.asp?p=32063&seqNum=3
>
> HTH,
> Martin-
> ----- Original Message ----- 
> From: "Dave Newton" <ne...@pingsite.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Thursday, June 09, 2005 1:47 PM
> Subject: Re: Multiple user - problem
>
>
> > Martin Gainty wrote:
> >
> >> -synchronisation of all method calls
> >
> > Why all? (Really, why _any_, since you can synchornized any shared data
> > structures.)
> >
> >> -scoping of data entities(assuming you are implementing with beans)
> >
> > Unless he's storing user data in application scope, this shouldn't be an
> > issue, should it?
> >
> > Dave
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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


RE: Multiple user - problem

Posted by Ray Madigan <ra...@madigans.org>.
You wrote:

As using DynaValidatorForm, not sure how to reset the properties.

If you look at the javadoc on this class you will see a reset method where
you need to reset the properties to their initial state.


-----Original Message-----
From: croffman [mailto:mystruts2004@hotmail.com]
Sent: Thursday, June 09, 2005 12:50 PM
To: Struts Users Mailing List
Subject: Re: Multiple user - problem


Thanks for the quick responses.

Here is some more info:

1. >>>>>Is it worse with more users?
This was done by manual users, before load testing. Couldn't try that now.

2. >>>>>Do you keep any non-synchronized user-specific info in an instance
of a class that is only instantiated once (like a servlet or action)? That
gets a lot of people even though it's in all the documentation.
Looks like there is a similarity. But not sure. Had a MAIN action class
(which extends from TilesAction), which contains a protected class defined
and that got the CDTO in it. Whereever needed in all the action classes, the
CDTO is got from this protected class. Is there any problem here?

3. >>>>>-synchronisation of all method calls
No where explicit synchronization is being used in the application.

4. >>>>>-scoping of data entities(assuming you are implementing with beans)
Kept the forms in request scope.

5. >>>>Also - are you resetting all of the properties in your forms classes.
If not, some of the data set by one user can bleed over to another user.
As using DynaValidatorForm, not sure how to reset the properties.

In the app, are using Struts form-beans
(org.apache.struts.validator.DynaValidatorForm). And in the action classes,
calling the delegate by passing the cdto (custom data transfer object),
which contains the request data. And when the delegate calls the EJB's, it
gets the data from database and populates the custom data transfer object
and sent back to the action class. And in the action class, this cdto is
copied back to form.

The wrong data came up for one user only. Is there any chance that this cdto
is shared and being used for two users. Couldn't think of a chance, but...?
Is there any chance by POINT #2 above.

And EJB's are stateless and Entity Beans are with container managed
persitance.

Once again thanks for your suggestions.

Croff


----- Original Message -----
From: "Martin Gainty" <mg...@hotmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, June 09, 2005 2:22 PM
Subject: Re: Multiple user - problem


> both concepts are applicable in that
> scoping of session based information should ultimately pull from
> user-neutral entity (such as Class Object) whose end of life is not
> dependent on either client session passivation or client session
termination
> Any underlying synchronisation mechanisms for entities (synchronised
> objects) are entirely dependent on selection of scope and
> whether the implementor is controlling the object via declarative or
> programmatically means
>
> Here are some good reads
> Problem Scenario for Stateful Session Beans
> http://docs.sun.com/source/817-2162-10/bpstatement.html
> Software Architecture in Practice: The Luther Architecture
> http://www.awprofessional.com/articles/article.asp?p=32063&seqNum=3
>
> HTH,
> Martin-
> ----- Original Message -----
> From: "Dave Newton" <ne...@pingsite.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Thursday, June 09, 2005 1:47 PM
> Subject: Re: Multiple user - problem
>
>
> > Martin Gainty wrote:
> >
> >> -synchronisation of all method calls
> >
> > Why all? (Really, why _any_, since you can synchornized any shared data
> > structures.)
> >
> >> -scoping of data entities(assuming you are implementing with beans)
> >
> > Unless he's storing user data in application scope, this shouldn't be an
> > issue, should it?
> >
> > Dave
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


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


Re: Multiple user - problem

Posted by croffman <my...@hotmail.com>.
Thanks for the quick responses.

Here is some more info:

1. >>>>>Is it worse with more users?
This was done by manual users, before load testing. Couldn't try that now. 

2. >>>>>Do you keep any non-synchronized user-specific info in an instance of a class that is only instantiated once (like a servlet or action)? That gets a lot of people even though it's in all the documentation.
Looks like there is a similarity. But not sure. Had a MAIN action class (which extends from TilesAction), which contains a protected class defined and that got the CDTO in it. Whereever needed in all the action classes, the CDTO is got from this protected class. Is there any problem here?

3. >>>>>-synchronisation of all method calls
No where explicit synchronization is being used in the application.

4. >>>>>-scoping of data entities(assuming you are implementing with beans)
Kept the forms in request scope.

5. >>>>Also - are you resetting all of the properties in your forms classes.  If not, some of the data set by one user can bleed over to another user.
As using DynaValidatorForm, not sure how to reset the properties.

In the app, are using Struts form-beans (org.apache.struts.validator.DynaValidatorForm). And in the action classes, calling the delegate by passing the cdto (custom data transfer object), which contains the request data. And when the delegate calls the EJB's, it gets the data from database and populates the custom data transfer object and sent back to the action class. And in the action class, this cdto is copied back to form.

The wrong data came up for one user only. Is there any chance that this cdto is shared and being used for two users. Couldn't think of a chance, but...? Is there any chance by POINT #2 above.

And EJB's are stateless and Entity Beans are with container managed persitance.

Once again thanks for your suggestions.

Croff


----- Original Message ----- 
From: "Martin Gainty" <mg...@hotmail.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, June 09, 2005 2:22 PM
Subject: Re: Multiple user - problem


> both concepts are applicable in that
> scoping of session based information should ultimately pull from 
> user-neutral entity (such as Class Object) whose end of life is not 
> dependent on either client session passivation or client session termination
> Any underlying synchronisation mechanisms for entities (synchronised 
> objects) are entirely dependent on selection of scope and
> whether the implementor is controlling the object via declarative or 
> programmatically means
> 
> Here are some good reads
> Problem Scenario for Stateful Session Beans
> http://docs.sun.com/source/817-2162-10/bpstatement.html
> Software Architecture in Practice: The Luther Architecture
> http://www.awprofessional.com/articles/article.asp?p=32063&seqNum=3
> 
> HTH,
> Martin-
> ----- Original Message ----- 
> From: "Dave Newton" <ne...@pingsite.com>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Thursday, June 09, 2005 1:47 PM
> Subject: Re: Multiple user - problem
> 
> 
> > Martin Gainty wrote:
> >
> >> -synchronisation of all method calls
> >
> > Why all? (Really, why _any_, since you can synchornized any shared data 
> > structures.)
> >
> >> -scoping of data entities(assuming you are implementing with beans)
> >
> > Unless he's storing user data in application scope, this shouldn't be an 
> > issue, should it?
> >
> > Dave
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

Re: Multiple user - problem

Posted by Martin Gainty <mg...@hotmail.com>.
both concepts are applicable in that
scoping of session based information should ultimately pull from 
user-neutral entity (such as Class Object) whose end of life is not 
dependent on either client session passivation or client session termination
Any underlying synchronisation mechanisms for entities (synchronised 
objects) are entirely dependent on selection of scope and
whether the implementor is controlling the object via declarative or 
programmatically means

Here are some good reads
Problem Scenario for Stateful Session Beans
http://docs.sun.com/source/817-2162-10/bpstatement.html
Software Architecture in Practice: The Luther Architecture
http://www.awprofessional.com/articles/article.asp?p=32063&seqNum=3

HTH,
Martin-
----- Original Message ----- 
From: "Dave Newton" <ne...@pingsite.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, June 09, 2005 1:47 PM
Subject: Re: Multiple user - problem


> Martin Gainty wrote:
>
>> -synchronisation of all method calls
>
> Why all? (Really, why _any_, since you can synchornized any shared data 
> structures.)
>
>> -scoping of data entities(assuming you are implementing with beans)
>
> Unless he's storing user data in application scope, this shouldn't be an 
> issue, should it?
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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


Re: Multiple user - problem

Posted by Dave Newton <ne...@pingsite.com>.
Martin Gainty wrote:

> -synchronisation of all method calls

Why all? (Really, why _any_, since you can synchornized any shared data 
structures.)

> -scoping of data entities(assuming you are implementing with beans)

Unless he's storing user data in application scope, this shouldn't be an 
issue, should it?

Dave



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


Re: Multiple user - problem

Posted by Martin Gainty <mg...@hotmail.com>.
the 2 things I would look at immediately
-synchronisation of all method calls
-scoping of data entities(assuming you are implementing with beans)
Anyone else?
Martin-
----- Original Message ----- 
From: "Dave Newton" <ne...@pingsite.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, June 09, 2005 1:14 PM
Subject: Re: Multiple user - problem


> croffman wrote:
>
>>Using Struts & EJB's - For load testing, facing a problem, that if 10 
>>multiple users are accessing at the same time, only one user is getting 
>>other user data (WRONG data) out of 10 users. But all other 9 users are 
>>getting correct data.
>>
>>The wrong data for that one user, is from one out of 9 other users.
>>
> Is it worse with more users?
>
> Do you keep any non-synchronized user-specific info in an instance of a 
> class that is only instantiated once (like a servlet or action)? That gets 
> a lot of people even though it's in all the documentation.
>
> Without any more specific information it'll be really tough to be helpful 
> in any meaningful way.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> 

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


Re: Multiple user - problem

Posted by croffman <my...@hotmail.com>.
I remember I have faced the similar problem before with only just servlets. Previous problem was, had a servlet containing a class level variable which holded the data. When multiple users hit the servlet, then the response data was switched to the users.

Here, in the action class, there is an inner class, which has a object (obj) that contains all the data. I am thinking this may be causing the problem. This looks like similar to the problem mentioned above and as Dave mentioned (>>>>>Do you keep any non-synchronized user-specific info in an instance of a class that is only instantiated once (like a servlet or action)? That gets a lot of people even though it's in all the documentation).

Any suggestions/inputs on this?

Thanks.

Croff

----- Original Message ----- 
From: "Dave Newton" <ne...@pingsite.com>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Thursday, June 09, 2005 3:31 PM
Subject: Re: Multiple user - problem


> Ray Madigan wrote:
> 
> >It is hard for me to believe you got past a single user with out resetting
> >the properties, unless you only write to them.  If you use the form
> >properties to assist in populating your form, the properties need to be
> >reset.
> >  
> >
> Well, if I'm hitting a form with existing values (like an 'edit' 
> operation) I'd load up the form using the BeanUtils, not reset, because 
> that doesn't strike me as an appropriate place to fill a bean with 
> values from a DB. Other than occasional checkbox games I've never 
> directly used the reset method.
> 
> In the JavaDoc it clearly states that "The default implementation does 
> nothing. In practice, the only properties that need to be reset are 
> those which represent checkboxes on a session-scoped form. Otherwise, 
> properties can be given initial values where the field is declared."
> 
> I've written four fairly major webapps using struts, have touched the 
> reset method maybe 2-3x (for checkboxes), and that's it. I have _never_ 
> seen a case where I've gotten any old values, including under 
> stress-testing with dozens of simulated users posting/reading unique 
> form values.
> 
> I haven't thought about it much at all lately, though, I use 
> DynaValiatorActionForms almost exclusively.
> 
> Dave
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

Re: Multiple user - problem

Posted by Dave Newton <ne...@pingsite.com>.
Ray Madigan wrote:

>It is hard for me to believe you got past a single user with out resetting
>the properties, unless you only write to them.  If you use the form
>properties to assist in populating your form, the properties need to be
>reset.
>  
>
Well, if I'm hitting a form with existing values (like an 'edit' 
operation) I'd load up the form using the BeanUtils, not reset, because 
that doesn't strike me as an appropriate place to fill a bean with 
values from a DB. Other than occasional checkbox games I've never 
directly used the reset method.

In the JavaDoc it clearly states that "The default implementation does 
nothing. In practice, the only properties that need to be reset are 
those which represent checkboxes on a session-scoped form. Otherwise, 
properties can be given initial values where the field is declared."

I've written four fairly major webapps using struts, have touched the 
reset method maybe 2-3x (for checkboxes), and that's it. I have _never_ 
seen a case where I've gotten any old values, including under 
stress-testing with dozens of simulated users posting/reading unique 
form values.

I haven't thought about it much at all lately, though, I use 
DynaValiatorActionForms almost exclusively.

Dave



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


RE: Multiple user - problem

Posted by Ray Madigan <ra...@madigans.org>.
The class org.apache.struts.action.ActionForm has a reset method.  For a
long time I would add form property variables without handling them in the
reset method.  I would get old values in the form and was getting spurious
data in the forms.

It is hard for me to believe you got past a single user with out resetting
the properties, unless you only write to them.  If you use the form
properties to assist in populating your form, the properties need to be
reset.

-----Original Message-----
From: Dave Newton [mailto:newton@pingsite.com]
Sent: Thursday, June 09, 2005 10:59 AM
To: Struts Users Mailing List
Subject: Re: Multiple user - problem


Ray Madigan wrote:

>Also - are you resetting all of the properties in your forms classes.  If
>not, some of the data set by one user can bleed over to another user.
>
>
?! Really? I was not aware of that; we deployed and load-tested a Really
Big Sruts app internally at a large company. Under what circumstances
might that happen?

Dave



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


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


Re: Multiple user - problem

Posted by Dave Newton <ne...@pingsite.com>.
Ray Madigan wrote:

>Also - are you resetting all of the properties in your forms classes.  If
>not, some of the data set by one user can bleed over to another user.
>  
>
?! Really? I was not aware of that; we deployed and load-tested a Really 
Big Sruts app internally at a large company. Under what circumstances 
might that happen?

Dave



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


RE: Multiple user - problem

Posted by Ray Madigan <ra...@madigans.org>.
Also - are you resetting all of the properties in your forms classes.  If
not, some of the data set by one user can bleed over to another user.

Hope that helps

-----Original Message-----
From: Dave Newton [mailto:newton@pingsite.com]
Sent: Thursday, June 09, 2005 10:15 AM
To: Struts Users Mailing List
Subject: Re: Multiple user - problem


croffman wrote:

>Using Struts & EJB's - For load testing, facing a problem, that if 10
multiple users are accessing at the same time, only one user is getting
other user data (WRONG data) out of 10 users. But all other 9 users are
getting correct data.
>
>The wrong data for that one user, is from one out of 9 other users.
>
>
Is it worse with more users?

Do you keep any non-synchronized user-specific info in an instance of a
class that is only instantiated once (like a servlet or action)? That
gets a lot of people even though it's in all the documentation.

Without any more specific information it'll be really tough to be
helpful in any meaningful way.

Dave



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


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


Re: Multiple user - problem

Posted by Dave Newton <ne...@pingsite.com>.
croffman wrote:

>Using Struts & EJB's - For load testing, facing a problem, that if 10 multiple users are accessing at the same time, only one user is getting other user data (WRONG data) out of 10 users. But all other 9 users are getting correct data.
>
>The wrong data for that one user, is from one out of 9 other users.
>  
>
Is it worse with more users?

Do you keep any non-synchronized user-specific info in an instance of a 
class that is only instantiated once (like a servlet or action)? That 
gets a lot of people even though it's in all the documentation.

Without any more specific information it'll be really tough to be 
helpful in any meaningful way.

Dave



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