You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Aristedes Maniatis <ar...@ish.com.au.INVALID> on 2020/05/25 09:39:28 UTC

Jetty SessionDataStore

Has anyone implemented a SessionDataStore for Jetty to store session 
info from Jetty in Zookeeper?

https://www.eclipse.org/jetty/documentation/current/session-management.html

Stores exist for MongoDB, Hazelcast and a bunch of other things already.


Cheers

Ari


Re: Jetty SessionDataStore

Posted by Aristedes Maniatis <am...@apache.org>.
Yes, it is not rocket science. But with all things that contain the words cache and thread, it can be a bit complex:

1. We would store the SessionData in a znode
2. We'd give it a TTL to match the session timeout in Jetty
3. We need to properly handle exceptions where it timed out or some other issue occurred
4. Jetty has a session cache layer. We'd need to understand how that would interact with any timeout in ZK. If writes are not hitting ZK, then the TTL will not be updated.
5. We'd need to test how well ZK performs with node TTL updated dozens of times per second  (it is a restful app)
6. We'd like to prevent the same user logging in twice (two sessions). Since the znode is really nothing more than session id (path) and user id (data), but ZK doesn't give us a way to force the userId attribute to be unique, its not clear how to do that in a cluster safe way.

So I was hoping someone might have solved some of the above problems :-)

Cheers
Ari

On 2020/05/25 15:27:34, Jordan Zimmerman <jo...@jordanzimmerman.com> wrote: 
> Not that I know of. It seems like it wouldn't be too hard to write. AFAICT you need to implement this: https://github.com/eclipse/jetty.project/blob/jetty-10.0.x/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java <https://github.com/eclipse/jetty.project/blob/jetty-10.0.x/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java> 
> 
> > On May 25, 2020, at 4:39 AM, Aristedes Maniatis <ar...@ish.com.au.INVALID> wrote:
> > 
> > Has anyone implemented a SessionDataStore for Jetty to store session info from Jetty in Zookeeper?
> > 
> > https://www.eclipse.org/jetty/documentation/current/session-management.html
> > 
> > Stores exist for MongoDB, Hazelcast and a bunch of other things already.
> > 
> > 
> > Cheers
> > 
> > Ari
> > 
> 
> 

Re: Jetty SessionDataStore

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
Not that I know of. It seems like it wouldn't be too hard to write. AFAICT you need to implement this: https://github.com/eclipse/jetty.project/blob/jetty-10.0.x/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java <https://github.com/eclipse/jetty.project/blob/jetty-10.0.x/jetty-server/src/main/java/org/eclipse/jetty/server/session/AbstractSessionDataStore.java> 

> On May 25, 2020, at 4:39 AM, Aristedes Maniatis <ar...@ish.com.au.INVALID> wrote:
> 
> Has anyone implemented a SessionDataStore for Jetty to store session info from Jetty in Zookeeper?
> 
> https://www.eclipse.org/jetty/documentation/current/session-management.html
> 
> Stores exist for MongoDB, Hazelcast and a bunch of other things already.
> 
> 
> Cheers
> 
> Ari
>