Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tsirkin,

On 2/24/2010 2:21 AM, Tsirkin Evgeny wrote:
 On Tue, Feb 23, 2010 at 11:50 PM, Christopher Schultz 
 ch...@christopherschultz.net wrote:
 
 -BEGIN PGP SIGNED MESSAGE- What's flow-resuming is ?How a
 request can be resumed ?Doesn't this goes
 againt the idea
 of http is staitless ,that's vrey interesting?


 So,the flow-resuming you were talking about is just the mechanism of
 storing the
 request parameters and url and use them again after successful
 authentication,right?

It also stores POST message bodies up to a certain size.

 Yes,this probably would not work with custom session ,since tomcat probably
 stores the parameters and url in session.

Tomcat definitely does, under the session note, which is a
Tomcat-specific implementation detail.

 For this particular issue however i have implemented my own mechanism
 using custom cookies (server side cookies).

Server-side cookies? Sounds like a winner.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuFRPIACgkQ9CaO5/Lv0PBRhgCgwCBL4uSvYBN2epjoLJormtWH
YOMAoL47gA31p86jAYmvklsoCb9mQfGe
=bL2J
-END PGP SIGNATURE-

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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-23 Thread Simone Tripodi
Hi Evgeny,
thanks a lot for shared your experience, very interesting. I'd like to
plug something magic that could avoid me configuring a filter, I
started investigating about a possible use of AOP  HttpSession.
If anyone is interested, I'll share my results when done.
Best regards!!!
Simo

http://people.apache.org/~simonetripodi/



On Tue, Feb 23, 2010 at 7:51 AM, Tsirkin Evgeny tsir...@gmail.com wrote:
 Just in case somebody will google for a solution for replacing session.
 I have done this .
 First of all ,why:
 We have cluster of 2 machines .
 Each have a separate db on it .
 The machines are sharing information using nfs mounting fs.
 Each machine runs it's own apache server ,(no apache balancer in front).
 There IS a hardware load balancer in front of this but sometime it fails
 to route already open sessions to same host.
 So,we can't :
 1. share sessions using files ,because this would be same file for 2 tomcats
    and because this would fail on nfs .
 2. we can't use tomcat cluster because there are cases when BOTH tomcat
    would be shut down or restarted and session would be loosed.
 3. we can't use a db because there is no central db - each host has it's own
 one.
 4. to complicate issue machines could be added/removed to the cluster.

 What we did - override session object using filter.On each request start it
 would
 read it's info from db (any configured one ,but preferring the local one)
 On each request end it would write itself into ALL dbs that are configured
 to be
 used.
 Although the obvious problem here is the writing to more then 1 db and
 reading
 from a db on each request ,this really works good thanks for mysql to be
 so fast on simple read/write.
 I have even implemented a simple lock mechanism for session .
 What more - this solution is portable ,it worked for us on SunONE server
 and now on tomcat.
 Thanks
 Evgeny
 On Tue, Feb 16, 2010 at 9:54 PM, Simone Tripodi 
 simone.trip...@gmail.comwrote:

 Hi Martin,
 very interesting, thanks for share it!!! I did, more or less, the same
 on a project for a customer, but it was strictly related to the
 application, your stuff looks much much better of mine and it is a
 reusable module.
 All the best,
 Simo

 http://people.apache.org/~simonetripodi/http://people.apache.org/%7Esimonetripodi/



 On Tue, Feb 16, 2010 at 6:02 PM, Martin Grotzke
 martin.grot...@javakaffee.de wrote:
  Hi Jon,
 
  On Mon, 2010-02-15 at 11:55 -0600, Jon Brisbin wrote:
  I'm trying to figure out today how I can implement a Valve or something
 that can store a session to a backend DB and reload that session on another
 Tomcat instance similar to how the PersistentManager loads user's session
 after a restart.
 
  Would a Valve based on PersistentValve allow me to implement a
 cluster-like solution such that a user login causes a write to a central
 database and a load balanced request to another server would see that user
 without forcing another login?
  You might have a look at the
  http://code.google.com/p/memcached-session-manager/ which is a session
  failover solution storing sessions in memcached.
 
  When the project was created I only thought of applications using sticky
  sessions but it should also work with non-sticky sessions if sessions
  are stored in memcached synchronously (sessionBackupAsync needs to be
  set to false, see [1]).
 
  The memcached-session-manager basically is a session manager
  implemention, the most interesting part is the
  MemcachedBackupSessionManager ([2]) if you want to have a look at the
  code.
 
  Cheers,
  Martin
 
 
  [1]
 http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
  [2]
 http://github.com/magro/memcached-session-manager/blob/master/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java
 
 
 
 
  Jon Brisbin
  Portal Webmaster
  NPC International, Inc.
 
 
 
  On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:
 
   Hi all guys and very nice to meet the Tomcat community,
   I've a web-application that needs to be replicated in more than one
   Tomcat, and since it is HttpSession based, I need to enable the
   session replication.
   Even if I work with very good sysadmins that know how to do it, I'm
   curious and would like to know if I could replace the HttpSession
   implementation with a my own one, I'd like to integrate Hazelcast[1]
   for data synchronization.
   Thanks in advance, every suggestion will be very appreciated.
   Simo
  
   [1] http://www.hazelcast.com/
  
   http://people.apache.org/~simonetripodi/http://people.apache.org/%7Esimonetripodi/
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
   For additional commands, e-mail: users-h...@tomcat.apache.org
  
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: 

Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-23 Thread Jon Brisbin

On Feb 23, 2010, at 7:31 AM, Simone Tripodi wrote:

 Hi Evgeny,
 thanks a lot for shared your experience, very interesting. I'd like to
 plug something magic that could avoid me configuring a filter, I
 started investigating about a possible use of AOP  HttpSession.
 If anyone is interested, I'll share my results when done.

This sound very interesting to me. I'd love to take a look at it when you're 
done. I'm still fighting load-balancing issues.

Jon Brisbin
Portal Webmaster
NPC International, Inc.


 Best regards!!!
 Simo
 
 http://people.apache.org/~simonetripodi/
 
 
 
 On Tue, Feb 23, 2010 at 7:51 AM, Tsirkin Evgeny tsir...@gmail.com wrote:
 Just in case somebody will google for a solution for replacing session.
 I have done this .
 First of all ,why:
 We have cluster of 2 machines .
 Each have a separate db on it .
 The machines are sharing information using nfs mounting fs.
 Each machine runs it's own apache server ,(no apache balancer in front).
 There IS a hardware load balancer in front of this but sometime it fails
 to route already open sessions to same host.
 So,we can't :
 1. share sessions using files ,because this would be same file for 2 tomcats
and because this would fail on nfs .
 2. we can't use tomcat cluster because there are cases when BOTH tomcat
would be shut down or restarted and session would be loosed.
 3. we can't use a db because there is no central db - each host has it's own
 one.
 4. to complicate issue machines could be added/removed to the cluster.
 
 What we did - override session object using filter.On each request start it
 would
 read it's info from db (any configured one ,but preferring the local one)
 On each request end it would write itself into ALL dbs that are configured
 to be
 used.
 Although the obvious problem here is the writing to more then 1 db and
 reading
 from a db on each request ,this really works good thanks for mysql to be
 so fast on simple read/write.
 I have even implemented a simple lock mechanism for session .
 What more - this solution is portable ,it worked for us on SunONE server
 and now on tomcat.
 Thanks
 Evgeny
 On Tue, Feb 16, 2010 at 9:54 PM, Simone Tripodi 
 simone.trip...@gmail.comwrote:
 
 Hi Martin,
 very interesting, thanks for share it!!! I did, more or less, the same
 on a project for a customer, but it was strictly related to the
 application, your stuff looks much much better of mine and it is a
 reusable module.
 All the best,
 Simo
 
 http://people.apache.org/~simonetripodi/http://people.apache.org/%7Esimonetripodi/
 
 
 
 On Tue, Feb 16, 2010 at 6:02 PM, Martin Grotzke
 martin.grot...@javakaffee.de wrote:
 Hi Jon,
 
 On Mon, 2010-02-15 at 11:55 -0600, Jon Brisbin wrote:
 I'm trying to figure out today how I can implement a Valve or something
 that can store a session to a backend DB and reload that session on another
 Tomcat instance similar to how the PersistentManager loads user's session
 after a restart.
 
 Would a Valve based on PersistentValve allow me to implement a
 cluster-like solution such that a user login causes a write to a central
 database and a load balanced request to another server would see that user
 without forcing another login?
 You might have a look at the
 http://code.google.com/p/memcached-session-manager/ which is a session
 failover solution storing sessions in memcached.
 
 When the project was created I only thought of applications using sticky
 sessions but it should also work with non-sticky sessions if sessions
 are stored in memcached synchronously (sessionBackupAsync needs to be
 set to false, see [1]).
 
 The memcached-session-manager basically is a session manager
 implemention, the most interesting part is the
 MemcachedBackupSessionManager ([2]) if you want to have a look at the
 code.
 
 Cheers,
 Martin
 
 
 [1]
 http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
 [2]
 http://github.com/magro/memcached-session-manager/blob/master/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java
 
 
 
 
 Jon Brisbin
 Portal Webmaster
 NPC International, Inc.
 
 
 
 On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:
 
 Hi all guys and very nice to meet the Tomcat community,
 I've a web-application that needs to be replicated in more than one
 Tomcat, and since it is HttpSession based, I need to enable the
 session replication.
 Even if I work with very good sysadmins that know how to do it, I'm
 curious and would like to know if I could replace the HttpSession
 implementation with a my own one, I'd like to integrate Hazelcast[1]
 for data synchronization.
 Thanks in advance, every suggestion will be very appreciated.
 Simo
 
 [1] http://www.hazelcast.com/
 
 http://people.apache.org/~simonetripodi/http://people.apache.org/%7Esimonetripodi/
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 
 

Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tsirkin,

On 2/23/2010 1:51 AM, Tsirkin Evgeny wrote:
 What we did - override session object using filter.On each request start it
 would
 read it's info from db (any configured one ,but preferring the local one)
 On each request end it would write itself into ALL dbs that are configured
 to be
 used.

This could have been done using standard Tomcat components and a shared
session-only database. Or, a pair of MysQL databases rigged to hot-copy
each other.

I think you did more work than necessary. Does this work with
authentication? Tomcat adds information to the session that isn't part
of the attributes, so a standard HttpSession wrapper won't be able to
replicate this information between the nodes. That means that things
like flow-resuming (where your original request is re-submitted after
successful authentication) won't work.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuEGbYACgkQ9CaO5/Lv0PDhiQCfQe3yPvORu/NX4AKyTDFL+xvR
kxgAoKAdaB26k5K/T+10Rqrq7iQsS6Xu
=2IqQ
-END PGP SIGNATURE-

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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-23 Thread Tsirkin Evgeny
On Tue, Feb 23, 2010 at 8:08 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Tsirkin,

 On 2/23/2010 1:51 AM, Tsirkin Evgeny wrote:
  What we did - override session object using filter.On each request start
 it
  would
  read it's info from db (any configured one ,but preferring the local one)
  On each request end it would write itself into ALL dbs that are
 configured
  to be
  used.

 This could have been done using standard Tomcat components and a shared
 session-only database.


Which means running another mysql instance just for it,
And on what machine - there are 2 equivalent machines ,no separate db one.


 Or, a pair of MysQL databases rigged to hot-copy
 each other.


Unfortunately i think that mysql just don't know how to do master-master
cluster (maybe in newer
versions it does).


 I think you did more work than necessary. Does this work with
 authentication?



 Tomcat adds information to the session that isn't part
 of the attributes, so a standard HttpSession wrapper won't be able to
 replicate this information between the nodes.


I guess tomcat authentication is broken for me - tomcat is probably writing
something in
session _ before _ the filter loads the data into it from db.
This probably can be fixed if i do not rip the old data written by tomcat
and just
add my own ,but i just don't use tomcat auth.


 That means that things
 like flow-resuming (where your original request is re-submitted after
 successful authentication) won't work.



What's flow-resuming is ?How a request can be resumed ?Doesn't this goes
againt the idea
of http is staitless ,that's vrey interesting?
Evgeny


 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAkuEGbYACgkQ9CaO5/Lv0PDhiQCfQe3yPvORu/NX4AKyTDFL+xvR
 kxgAoKAdaB26k5K/T+10Rqrq7iQsS6Xu
 =2IqQ
 -END PGP SIGNATURE-

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




Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-23 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Tsirkin,

On 2/23/2010 1:49 PM, Tsirkin Evgeny wrote:
 On Tue, Feb 23, 2010 at 8:08 PM, Christopher Schultz 
 ch...@christopherschultz.net wrote:
 I guess tomcat authentication is broken for me - tomcat is probably writing
 something in
 session _ before _ the filter loads the data into it from db.

That is true: Tomcat does session work /before/ filters are invoked, but
it also has something called the session note which is essentially a
private attribute that can be used for things like authentication state
information. The HttpSession has no access to this except through
introspection, which could be disabled by a SecurityManager I'd imagine.

 This probably can be fixed if i do not rip the old data written by tomcat
 and just add my own ,but i just don't use tomcat auth.

If you're not using container-based authentication, then I guess it
doesn't matter.

 That means that things like flow-resuming (where your original
 request is re-submitted after successful authentication) won't work.
 
 
 What's flow-resuming is ?How a request can be resumed ?Doesn't this goes
 againt the idea
 of http is staitless ,that's vrey interesting?

See section 12.5.3 of the servlet (2.5) specification which lays this
all out in plain English.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuETaUACgkQ9CaO5/Lv0PDHggCeOrnsxbjOuB0THbM80BBmeJSe
BEEAnRglqa3NXiGhX7+2IoFIWbotMCLl
=4KTl
-END PGP SIGNATURE-

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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-23 Thread Tsirkin Evgeny
On Tue, Feb 23, 2010 at 11:50 PM, Christopher Schultz 
ch...@christopherschultz.net wrote:

 -BEGIN PGP SIGNED MESSAGE- What's flow-resuming is ?How a
 request can be resumed ?Doesn't this goes
  againt the idea
  of http is staitless ,that's vrey interesting?


So,the flow-resuming you were talking about is just the mechanism of
storing the
request parameters and url and use them again after successful
authentication,right?
Yes,this probably would not work with custom session ,since tomcat probably
stores the parameters and url in session.
For this particular issue however i have implemented my own mechanism
using custom cookies (server side cookies).
Of course,all this is probably can not be reused and is tied to my
particular
env. .
But it is a yes this can be done if really needed email.
Evgeny


 See section 12.5.3 of the servlet (2.5) specification which lays this
 all out in plain English.

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAkuETaUACgkQ9CaO5/Lv0PDHggCeOrnsxbjOuB0THbM80BBmeJSe
 BEEAnRglqa3NXiGhX7+2IoFIWbotMCLl
 =4KTl
 -END PGP SIGNATURE-

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




Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-22 Thread Tsirkin Evgeny
Just in case somebody will google for a solution for replacing session.
I have done this .
First of all ,why:
We have cluster of 2 machines .
Each have a separate db on it .
The machines are sharing information using nfs mounting fs.
Each machine runs it's own apache server ,(no apache balancer in front).
There IS a hardware load balancer in front of this but sometime it fails
to route already open sessions to same host.
So,we can't :
1. share sessions using files ,because this would be same file for 2 tomcats
and because this would fail on nfs .
2. we can't use tomcat cluster because there are cases when BOTH tomcat
would be shut down or restarted and session would be loosed.
3. we can't use a db because there is no central db - each host has it's own
one.
4. to complicate issue machines could be added/removed to the cluster.

What we did - override session object using filter.On each request start it
would
read it's info from db (any configured one ,but preferring the local one)
On each request end it would write itself into ALL dbs that are configured
to be
used.
Although the obvious problem here is the writing to more then 1 db and
reading
from a db on each request ,this really works good thanks for mysql to be
so fast on simple read/write.
I have even implemented a simple lock mechanism for session .
What more - this solution is portable ,it worked for us on SunONE server
and now on tomcat.
Thanks
Evgeny
On Tue, Feb 16, 2010 at 9:54 PM, Simone Tripodi simone.trip...@gmail.comwrote:

 Hi Martin,
 very interesting, thanks for share it!!! I did, more or less, the same
 on a project for a customer, but it was strictly related to the
 application, your stuff looks much much better of mine and it is a
 reusable module.
 All the best,
 Simo

 http://people.apache.org/~simonetripodi/http://people.apache.org/%7Esimonetripodi/



 On Tue, Feb 16, 2010 at 6:02 PM, Martin Grotzke
 martin.grot...@javakaffee.de wrote:
  Hi Jon,
 
  On Mon, 2010-02-15 at 11:55 -0600, Jon Brisbin wrote:
  I'm trying to figure out today how I can implement a Valve or something
 that can store a session to a backend DB and reload that session on another
 Tomcat instance similar to how the PersistentManager loads user's session
 after a restart.
 
  Would a Valve based on PersistentValve allow me to implement a
 cluster-like solution such that a user login causes a write to a central
 database and a load balanced request to another server would see that user
 without forcing another login?
  You might have a look at the
  http://code.google.com/p/memcached-session-manager/ which is a session
  failover solution storing sessions in memcached.
 
  When the project was created I only thought of applications using sticky
  sessions but it should also work with non-sticky sessions if sessions
  are stored in memcached synchronously (sessionBackupAsync needs to be
  set to false, see [1]).
 
  The memcached-session-manager basically is a session manager
  implemention, the most interesting part is the
  MemcachedBackupSessionManager ([2]) if you want to have a look at the
  code.
 
  Cheers,
  Martin
 
 
  [1]
 http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
  [2]
 http://github.com/magro/memcached-session-manager/blob/master/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java
 
 
 
 
  Jon Brisbin
  Portal Webmaster
  NPC International, Inc.
 
 
 
  On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:
 
   Hi all guys and very nice to meet the Tomcat community,
   I've a web-application that needs to be replicated in more than one
   Tomcat, and since it is HttpSession based, I need to enable the
   session replication.
   Even if I work with very good sysadmins that know how to do it, I'm
   curious and would like to know if I could replace the HttpSession
   implementation with a my own one, I'd like to integrate Hazelcast[1]
   for data synchronization.
   Thanks in advance, every suggestion will be very appreciated.
   Simo
  
   [1] http://www.hazelcast.com/
  
   http://people.apache.org/~simonetripodi/http://people.apache.org/%7Esimonetripodi/
  
   -
   To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
   For additional commands, e-mail: users-h...@tomcat.apache.org
  
 
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 
 
  --
 

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




Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-16 Thread Martin Grotzke
Hi Jon,

On Mon, 2010-02-15 at 11:55 -0600, Jon Brisbin wrote:
 I'm trying to figure out today how I can implement a Valve or something that 
 can store a session to a backend DB and reload that session on another Tomcat 
 instance similar to how the PersistentManager loads user's session after a 
 restart.
 
 Would a Valve based on PersistentValve allow me to implement a cluster-like 
 solution such that a user login causes a write to a central database and a 
 load balanced request to another server would see that user without forcing 
 another login?
You might have a look at the
http://code.google.com/p/memcached-session-manager/ which is a session
failover solution storing sessions in memcached.

When the project was created I only thought of applications using sticky
sessions but it should also work with non-sticky sessions if sessions
are stored in memcached synchronously (sessionBackupAsync needs to be
set to false, see [1]).

The memcached-session-manager basically is a session manager
implemention, the most interesting part is the
MemcachedBackupSessionManager ([2]) if you want to have a look at the
code.

Cheers,
Martin


[1] 
http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
[2] 
http://github.com/magro/memcached-session-manager/blob/master/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java



 
 Jon Brisbin
 Portal Webmaster
 NPC International, Inc.
 
 
 
 On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:
 
  Hi all guys and very nice to meet the Tomcat community,
  I've a web-application that needs to be replicated in more than one
  Tomcat, and since it is HttpSession based, I need to enable the
  session replication.
  Even if I work with very good sysadmins that know how to do it, I'm
  curious and would like to know if I could replace the HttpSession
  implementation with a my own one, I'd like to integrate Hazelcast[1]
  for data synchronization.
  Thanks in advance, every suggestion will be very appreciated.
  Simo
  
  [1] http://www.hazelcast.com/
  
  http://people.apache.org/~simonetripodi/
  
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
  
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 

-- 


signature.asc
Description: This is a digitally signed message part


Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-16 Thread Simone Tripodi
Hi Martin,
very interesting, thanks for share it!!! I did, more or less, the same
on a project for a customer, but it was strictly related to the
application, your stuff looks much much better of mine and it is a
reusable module.
All the best,
Simo

http://people.apache.org/~simonetripodi/



On Tue, Feb 16, 2010 at 6:02 PM, Martin Grotzke
martin.grot...@javakaffee.de wrote:
 Hi Jon,

 On Mon, 2010-02-15 at 11:55 -0600, Jon Brisbin wrote:
 I'm trying to figure out today how I can implement a Valve or something that 
 can store a session to a backend DB and reload that session on another 
 Tomcat instance similar to how the PersistentManager loads user's session 
 after a restart.

 Would a Valve based on PersistentValve allow me to implement a cluster-like 
 solution such that a user login causes a write to a central database and a 
 load balanced request to another server would see that user without forcing 
 another login?
 You might have a look at the
 http://code.google.com/p/memcached-session-manager/ which is a session
 failover solution storing sessions in memcached.

 When the project was created I only thought of applications using sticky
 sessions but it should also work with non-sticky sessions if sessions
 are stored in memcached synchronously (sessionBackupAsync needs to be
 set to false, see [1]).

 The memcached-session-manager basically is a session manager
 implemention, the most interesting part is the
 MemcachedBackupSessionManager ([2]) if you want to have a look at the
 code.

 Cheers,
 Martin


 [1] 
 http://code.google.com/p/memcached-session-manager/wiki/SetupAndConfiguration
 [2] 
 http://github.com/magro/memcached-session-manager/blob/master/core/src/main/java/de/javakaffee/web/msm/MemcachedBackupSessionManager.java




 Jon Brisbin
 Portal Webmaster
 NPC International, Inc.



 On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:

  Hi all guys and very nice to meet the Tomcat community,
  I've a web-application that needs to be replicated in more than one
  Tomcat, and since it is HttpSession based, I need to enable the
  session replication.
  Even if I work with very good sysadmins that know how to do it, I'm
  curious and would like to know if I could replace the HttpSession
  implementation with a my own one, I'd like to integrate Hazelcast[1]
  for data synchronization.
  Thanks in advance, every suggestion will be very appreciated.
  Simo
 
  [1] http://www.hazelcast.com/
 
  http://people.apache.org/~simonetripodi/
 
  -
  To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
  For additional commands, e-mail: users-h...@tomcat.apache.org
 


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


 --


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



Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-15 Thread Simone Tripodi
Hi all guys and very nice to meet the Tomcat community,
I've a web-application that needs to be replicated in more than one
Tomcat, and since it is HttpSession based, I need to enable the
session replication.
Even if I work with very good sysadmins that know how to do it, I'm
curious and would like to know if I could replace the HttpSession
implementation with a my own one, I'd like to integrate Hazelcast[1]
for data synchronization.
Thanks in advance, every suggestion will be very appreciated.
Simo

[1] http://www.hazelcast.com/

http://people.apache.org/~simonetripodi/

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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Simone,

On 2/15/2010 12:05 PM, Simone Tripodi wrote:
 I've a web-application that needs to be replicated in more than one
 Tomcat, and since it is HttpSession based, I need to enable the
 session replication.
 Even if I work with very good sysadmins that know how to do it, I'm
 curious and would like to know if I could replace the HttpSession
 implementation with a my own one, I'd like to integrate Hazelcast[1]
 for data synchronization.

Why not use the session replication that comes with Tomcat?

Otherwise, presumably Hazelcast knows how to integrate their own product
with Tomcat. You might have better luck asking them.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt5f/AACgkQ9CaO5/Lv0PBs2ACgh/CsaG1mdvnENrcw5Zt8cn10
tPgAni7x4ZGDvBiT2+wIoPZ5QwuOBKNG
=P+WC
-END PGP SIGNATURE-

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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-15 Thread Jon Brisbin
I'm just getting ready to ask a question like this, as I have a similar need.

I'm using the built-in Tribes-based replication which works fine for short 
periods of time and under moderate to light load. Once the Tomcat server has 
been running for a day or two, though, this distributed session replication 
starts breaking unexpectedly. Once this happens, the apps start becoming 
unavailable until I restart everything.

I'm trying to figure out today how I can implement a Valve or something that 
can store a session to a backend DB and reload that session on another Tomcat 
instance similar to how the PersistentManager loads user's session after a 
restart.

Would a Valve based on PersistentValve allow me to implement a cluster-like 
solution such that a user login causes a write to a central database and a load 
balanced request to another server would see that user without forcing another 
login?

Jon Brisbin
Portal Webmaster
NPC International, Inc.



On Feb 15, 2010, at 11:05 AM, Simone Tripodi wrote:

 Hi all guys and very nice to meet the Tomcat community,
 I've a web-application that needs to be replicated in more than one
 Tomcat, and since it is HttpSession based, I need to enable the
 session replication.
 Even if I work with very good sysadmins that know how to do it, I'm
 curious and would like to know if I could replace the HttpSession
 implementation with a my own one, I'd like to integrate Hazelcast[1]
 for data synchronization.
 Thanks in advance, every suggestion will be very appreciated.
 Simo
 
 [1] http://www.hazelcast.com/
 
 http://people.apache.org/~simonetripodi/
 
 -
 To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org
 


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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-15 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jon,

On 2/15/2010 12:55 PM, Jon Brisbin wrote:
 I'm using the built-in Tribes-based replication which works fine for
 short periods of time and under moderate to light load. Once the
 Tomcat server has been running for a day or two, though, this
 distributed session replication starts breaking unexpectedly. Once
 this happens, the apps start becoming unavailable until I restart
 everything.

That's unfortunate. You should post a complaint that you are observing
this behavior. AFAIK, the Tomcat devs are quite satisfied with their
replication implementation. Get ready to defend your use of session
objects, though :)

 I'm trying to figure out today how I can implement a Valve or
 something that can store a session to a backend DB and reload that
 session on another Tomcat instance similar to how the
 PersistentManager loads user's session after a restart.
 
 Would a Valve based on PersistentValve allow me to implement a
 cluster-like solution such that a user login causes a write to a
 central database and a load balanced request to another server would
 see that user without forcing another login?

I would think that simply using the existing PersistenceManager +
JDBCStore would work. In tact, it's even documented to be one of the
ways of achieving session clustering without doing in-memory
replication: http://tomcat.apache.org/tomcat-6.0-doc/cluster-howto.html

Unfortunately, I didn't see any specifics on how to configure Tomcat to
do just that, though I must admit I didn't spend very much time looking.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt5khwACgkQ9CaO5/Lv0PCydwCdE/ZjGWYg91P+anDZIFYhilSz
QVUAniRKuLV/TSUphnlBhEdKIKDGC2TM
=+FuL
-END PGP SIGNATURE-

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



Re: Is it possible to replace the HttpSession implementation in Tomcat?

2010-02-15 Thread Simone Tripodi
Hi Cris,
thanks for your reply and nice to meet you :)
There's no specific reason why I don't want to use the built-in
session replication, even if I'd be able to realize what I've in my
mind, the sysadmins will never let me know to use it since they're
confident with the Tomcat solution.
BTW, I'm just curious and like very much integrating heterogeneous
software layers in an original way, so before spending time in
studying the Tomcat code and understand how to realize my crazy stuff
I wrote the email :P
Thanks, all the best,
Simo

http://people.apache.org/~simonetripodi/



On Mon, Feb 15, 2010 at 6:10 PM, Christopher Schultz
ch...@christopherschultz.net wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Simone,

 On 2/15/2010 12:05 PM, Simone Tripodi wrote:
 I've a web-application that needs to be replicated in more than one
 Tomcat, and since it is HttpSession based, I need to enable the
 session replication.
 Even if I work with very good sysadmins that know how to do it, I'm
 curious and would like to know if I could replace the HttpSession
 implementation with a my own one, I'd like to integrate Hazelcast[1]
 for data synchronization.

 Why not use the session replication that comes with Tomcat?

 Otherwise, presumably Hazelcast knows how to integrate their own product
 with Tomcat. You might have better luck asking them.

 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.10 (MingW32)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

 iEYEARECAAYFAkt5f/AACgkQ9CaO5/Lv0PBs2ACgh/CsaG1mdvnENrcw5Zt8cn10
 tPgAni7x4ZGDvBiT2+wIoPZ5QwuOBKNG
 =P+WC
 -END PGP SIGNATURE-

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



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