You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ildefonso Montero <il...@gmail.com> on 2008/06/19 19:02:02 UTC

Error replicating sessions with Struts 2 framework java application

Hi,

we are having a problem when balancing Tomcat session among to clusters.
Architecture is the following: Apache (A) balancing 50-50 over Tomcat (1) and
Tomcat (2).

We are working on a big application and we saw that the session is not
replicated properly because we are doing one request for each Tomcat
sequentially (see 50-50 balancing) and we have checked that a simple counter

that we created inside the session object (our own object) accesing using
session.getAttribute("name") the resulted pattern is:

Request 1 in T1, counter = 1
Request 2 in T2, counter = 2
Request 3 in T1, counter = 2

Request 4 in T2, counter = 3
Request 5 in T1, counter = 3
Request 6 in T2, counter = 4
Request 7 in T1, counter = 4
Request 8 in T2, counter = 5
...

so, the value of the counter is not replicated properly or we are accesing it

in a wrong way. Is interesting for us that the Session ID (session.getID())
shows the same ID in both Tomcats so, we guess the is the same but replication
of attributes values seems to be not replicated.

Could you please help us?

Than you in advance.

some details: Apache 2.2.3, used mod_proxy_ajp instead of mod_jk, so we did
not

configured workers.properties file, we customized httpd.conf file.



-- 
-----------------------------------------------------------------
Ildefonso Montero Pérez
  ildefonso.montero{arroba}gmail.com
  monteroperez{arroba}.us.es
-----------------------------------------------------------------

Re: Error replicating sessions with Struts 2 framework java application

Posted by Al Sutton <al...@alsutton.com>.
Just to add to this, S2 is compliant with J2EE specs, therefore if the 
container has problems clusting a S2 application, it's not S2 that's at 
fault, it's the clustering capability of the appserver.

My guess is that youy need to look at the information replication 
strategy employed by your chosen app server, you may find the app server 
vendor has some notes about the reliability and replication latency for 
the available strategies.

Al.

P.S. About the mail in the link; I'm not sure what comment is 
neccessary, check the code mentioned and see for yourself how it's 
implemented.


Dave Newton wrote:
> Clustering is generally framework-neutral--it's straight JEE as far as I know. As long as the session is serializable (hey, thanks a lot, subList :( it should work no matter what the framework is.
>
> We're running S2 clustered with no issues.
>
> Dave
>
> --- On Sat, 6/21/08, Ildefonso Montero <il...@gmail.com> wrote:
>
>   
>> From: Ildefonso Montero <il...@gmail.com>
>> Subject: Re: Error replicating sessions with Struts 2 framework java application
>> To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Date: Saturday, June 21, 2008, 6:31 AM
>> Dear Laurie,
>>
>> thanks for your quick response, maybe I would rename this
>> thread as: Does
>> Struts 2 support clustering? (see
>> link<http://mail-archives.apache.org/mod_mbox/struts-user/200804.mbox/%3C16628146.post@talk.nabble.com%3E>
>> )
>>
>> I have doubts about the replicacion of a SessionMap object
>> on the quoted
>> architecture, What do you think?
>>
>> Regards
>>
>> 2008/6/20 Laurie Harper <la...@holoweb.net>:
>>
>>     
>>> Problems with Tomcat session replication are really a
>>>       
>> Tomcat issue, not a
>>     
>>> Struts issue. You will likely have more luck asking on
>>>       
>> the Tomcat user's
>>     
>>> list. You should include more details about how you
>>>       
>> configured Tomcat for
>>     
>>> session replication, too, since that seems likely to
>>>       
>> be where the problem
>>     
>>> lies.
>>>
>>> L.
>>>
>>>
>>> Ildefonso Montero wrote:
>>>
>>>       
>>>> Hi,
>>>>
>>>> we are having a problem when balancing Tomcat
>>>>         
>> session among to clusters.
>>     
>>>> Architecture is the following: Apache (A)
>>>>         
>> balancing 50-50 over Tomcat (1)
>>     
>>>> and
>>>> Tomcat (2).
>>>>
>>>> We are working on a big application and we saw
>>>>         
>> that the session is not
>>     
>>>> replicated properly because we are doing one
>>>>         
>> request for each Tomcat
>>     
>>>> sequentially (see 50-50 balancing) and we have
>>>>         
>> checked that a simple
>>     
>>>> counter
>>>>
>>>> that we created inside the session object (our own
>>>>         
>> object) accesing using
>>     
>>>> session.getAttribute("name") the
>>>>         
>> resulted pattern is:
>>     
>>>> Request 1 in T1, counter = 1
>>>> Request 2 in T2, counter = 2
>>>> Request 3 in T1, counter = 2
>>>>
>>>> Request 4 in T2, counter = 3
>>>> Request 5 in T1, counter = 3
>>>> Request 6 in T2, counter = 4
>>>> Request 7 in T1, counter = 4
>>>> Request 8 in T2, counter = 5
>>>> ....
>>>>
>>>> so, the value of the counter is not replicated
>>>>         
>> properly or we are accesing
>>     
>>>> it
>>>>
>>>> in a wrong way. Is interesting for us that the
>>>>         
>> Session ID
>>     
>>>> (session.getID())
>>>> shows the same ID in both Tomcats so, we guess the
>>>>         
>> is the same but
>>     
>>>> replication
>>>> of attributes values seems to be not replicated.
>>>>
>>>> Could you please help us?
>>>>
>>>> Than you in advance.
>>>>
>>>> some details: Apache 2.2.3, used mod_proxy_ajp
>>>>         
>> instead of mod_jk, so we
>>     
>>>> did
>>>> not
>>>>
>>>> configured workers.properties file, we customized
>>>>         
>> httpd.conf file.
>>     
>>>>
>>>>
>>>>         
>>>       
>> ---------------------------------------------------------------------
>>     
>>> To unsubscribe, e-mail:
>>>       
>> user-unsubscribe@struts.apache.org
>>     
>>> For additional commands, e-mail:
>>>       
>> user-help@struts.apache.org
>>     
>>>       
>> -- 
>> -----------------------------------------------------------------
>> Ildefonso Montero Pérez
>> ildefonso.montero{arroba}gmail.com
>> monteroperez{arroba}.us.es
>> -----------------------------------------------------------------
>>     
>
> ---------------------------------------------------------------------
> 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: Error replicating sessions with Struts 2 framework java application

Posted by Dave Newton <ne...@yahoo.com>.
Clustering is generally framework-neutral--it's straight JEE as far as I know. As long as the session is serializable (hey, thanks a lot, subList :( it should work no matter what the framework is.

We're running S2 clustered with no issues.

Dave

--- On Sat, 6/21/08, Ildefonso Montero <il...@gmail.com> wrote:

> From: Ildefonso Montero <il...@gmail.com>
> Subject: Re: Error replicating sessions with Struts 2 framework java application
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Saturday, June 21, 2008, 6:31 AM
> Dear Laurie,
> 
> thanks for your quick response, maybe I would rename this
> thread as: Does
> Struts 2 support clustering? (see
> link<http://mail-archives.apache.org/mod_mbox/struts-user/200804.mbox/%3C16628146.post@talk.nabble.com%3E>
> )
> 
> I have doubts about the replicacion of a SessionMap object
> on the quoted
> architecture, What do you think?
> 
> Regards
> 
> 2008/6/20 Laurie Harper <la...@holoweb.net>:
> 
> > Problems with Tomcat session replication are really a
> Tomcat issue, not a
> > Struts issue. You will likely have more luck asking on
> the Tomcat user's
> > list. You should include more details about how you
> configured Tomcat for
> > session replication, too, since that seems likely to
> be where the problem
> > lies.
> >
> > L.
> >
> >
> > Ildefonso Montero wrote:
> >
> >> Hi,
> >>
> >> we are having a problem when balancing Tomcat
> session among to clusters.
> >> Architecture is the following: Apache (A)
> balancing 50-50 over Tomcat (1)
> >> and
> >> Tomcat (2).
> >>
> >> We are working on a big application and we saw
> that the session is not
> >> replicated properly because we are doing one
> request for each Tomcat
> >> sequentially (see 50-50 balancing) and we have
> checked that a simple
> >> counter
> >>
> >> that we created inside the session object (our own
> object) accesing using
> >> session.getAttribute("name") the
> resulted pattern is:
> >>
> >> Request 1 in T1, counter = 1
> >> Request 2 in T2, counter = 2
> >> Request 3 in T1, counter = 2
> >>
> >> Request 4 in T2, counter = 3
> >> Request 5 in T1, counter = 3
> >> Request 6 in T2, counter = 4
> >> Request 7 in T1, counter = 4
> >> Request 8 in T2, counter = 5
> >> ....
> >>
> >> so, the value of the counter is not replicated
> properly or we are accesing
> >> it
> >>
> >> in a wrong way. Is interesting for us that the
> Session ID
> >> (session.getID())
> >> shows the same ID in both Tomcats so, we guess the
> is the same but
> >> replication
> >> of attributes values seems to be not replicated.
> >>
> >> Could you please help us?
> >>
> >> Than you in advance.
> >>
> >> some details: Apache 2.2.3, used mod_proxy_ajp
> instead of mod_jk, so we
> >> did
> >> not
> >>
> >> configured workers.properties file, we customized
> httpd.conf file.
> >>
> >>
> >>
> >>
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 
> 
> -- 
> -----------------------------------------------------------------
> Ildefonso Montero Pérez
> ildefonso.montero{arroba}gmail.com
> monteroperez{arroba}.us.es
> -----------------------------------------------------------------

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


Re: Error replicating sessions with Struts 2 framework java application

Posted by Ildefonso Montero <il...@gmail.com>.
Dear Laurie,

thanks for your quick response, maybe I would rename this thread as: Does
Struts 2 support clustering? (see
link<http://mail-archives.apache.org/mod_mbox/struts-user/200804.mbox/%3C16628146.post@talk.nabble.com%3E>
)

I have doubts about the replicacion of a SessionMap object on the quoted
architecture, What do you think?

Regards

2008/6/20 Laurie Harper <la...@holoweb.net>:

> Problems with Tomcat session replication are really a Tomcat issue, not a
> Struts issue. You will likely have more luck asking on the Tomcat user's
> list. You should include more details about how you configured Tomcat for
> session replication, too, since that seems likely to be where the problem
> lies.
>
> L.
>
>
> Ildefonso Montero wrote:
>
>> Hi,
>>
>> we are having a problem when balancing Tomcat session among to clusters.
>> Architecture is the following: Apache (A) balancing 50-50 over Tomcat (1)
>> and
>> Tomcat (2).
>>
>> We are working on a big application and we saw that the session is not
>> replicated properly because we are doing one request for each Tomcat
>> sequentially (see 50-50 balancing) and we have checked that a simple
>> counter
>>
>> that we created inside the session object (our own object) accesing using
>> session.getAttribute("name") the resulted pattern is:
>>
>> Request 1 in T1, counter = 1
>> Request 2 in T2, counter = 2
>> Request 3 in T1, counter = 2
>>
>> Request 4 in T2, counter = 3
>> Request 5 in T1, counter = 3
>> Request 6 in T2, counter = 4
>> Request 7 in T1, counter = 4
>> Request 8 in T2, counter = 5
>> ....
>>
>> so, the value of the counter is not replicated properly or we are accesing
>> it
>>
>> in a wrong way. Is interesting for us that the Session ID
>> (session.getID())
>> shows the same ID in both Tomcats so, we guess the is the same but
>> replication
>> of attributes values seems to be not replicated.
>>
>> Could you please help us?
>>
>> Than you in advance.
>>
>> some details: Apache 2.2.3, used mod_proxy_ajp instead of mod_jk, so we
>> did
>> not
>>
>> configured workers.properties file, we customized httpd.conf file.
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
-----------------------------------------------------------------
Ildefonso Montero Pérez
ildefonso.montero{arroba}gmail.com
monteroperez{arroba}.us.es
-----------------------------------------------------------------

Re: Error replicating sessions with Struts 2 framework java application

Posted by Laurie Harper <la...@holoweb.net>.
Problems with Tomcat session replication are really a Tomcat issue, not 
a Struts issue. You will likely have more luck asking on the Tomcat 
user's list. You should include more details about how you configured 
Tomcat for session replication, too, since that seems likely to be where 
the problem lies.

L.

Ildefonso Montero wrote:
> Hi,
> 
> we are having a problem when balancing Tomcat session among to clusters.
> Architecture is the following: Apache (A) balancing 50-50 over Tomcat (1) and
> Tomcat (2).
> 
> We are working on a big application and we saw that the session is not
> replicated properly because we are doing one request for each Tomcat
> sequentially (see 50-50 balancing) and we have checked that a simple counter
> 
> that we created inside the session object (our own object) accesing using
> session.getAttribute("name") the resulted pattern is:
> 
> Request 1 in T1, counter = 1
> Request 2 in T2, counter = 2
> Request 3 in T1, counter = 2
> 
> Request 4 in T2, counter = 3
> Request 5 in T1, counter = 3
> Request 6 in T2, counter = 4
> Request 7 in T1, counter = 4
> Request 8 in T2, counter = 5
> ....
> 
> so, the value of the counter is not replicated properly or we are accesing it
> 
> in a wrong way. Is interesting for us that the Session ID (session.getID())
> shows the same ID in both Tomcats so, we guess the is the same but replication
> of attributes values seems to be not replicated.
> 
> Could you please help us?
> 
> Than you in advance.
> 
> some details: Apache 2.2.3, used mod_proxy_ajp instead of mod_jk, so we did
> not
> 
> configured workers.properties file, we customized httpd.conf file.
> 
> 
> 


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