aws-dynamodb-session-tomcat icon indicating copy to clipboard operation
aws-dynamodb-session-tomcat copied to clipboard

stored Sessions in dynamodb

Open messmerxx opened this issue 8 years ago • 3 comments

we are deploying our application in the following environment: 64bit Amazon Linux 2016.03 v2.2.0 running Tomcat 8 Java 8, aws-dynamodb-session-tomcat.jar.2.0.4, after creating the Tomcat_Sessions table in dynamoDB, the session can be stored in the table.

BUT we notice that the new sessions are not stored immediately in Tomcat_Sessions table if new sessions are created by the clients. neither the dynamodb UI or using the command aws dynamodb scan --table-name Tomcat_SessionState --region xxx

there is notice "Storage size and item count are not updated in real-time. They are updated periodically, roughly every six hours.", it means, the sessions will be stored in the table but not updated immediately?

we are trying to solve our autoscaling, load balacing problem with AWS. so your library is critical to our application. but we do not understand the behavior of your libaray completely. if you can share some limitations of this lib, that would be very great.

With best regards, Harrsion

messmerxx avatar Sep 09 '16 09:09 messmerxx

"Storage size and item count are not updated in real-time. They are updated periodically, roughly every six hours."

This is just a Dynamo thing. There's no way to get a 100% accurate count unless you scan the whole table. It doesn't appear to be relevant to what you're seeing.

This implementation of SessionManager (and all implementations that extend from PersistentManagerBase) acts as a session backup and failover rather than a realtime replication of session data. As such it only works reliably with sticky sessions. There are a few session manager implementations that do realtime persistence of sessions and allow for non-sticky sessions although they are a bit more complicated. https://github.com/magro/memcached-session-manager is one such example, you could use Amazon ElastiCache to back it.

shorea avatar Sep 09 '16 14:09 shorea

Hi Andrew, Could you please help to form correct view on what this session manager targets.

Based on what you've mentioned: "This implementation of SessionManager (and all implementations that extend from PersistentManagerBase) acts as a session backup and failover rather than a realtime replication of session data. As such it only works reliably with sticky sessions."

  1. when reading this official doc: http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-tomcat-session-manager.html It doesn't say anything about mandatory session stickiness, it even mentions that it's not locked and is exposed to race conditions, which implies no session stickiness, otherwise it all would be processed on the same node and standard locking tomcat mechanism could be used. Can you confirm that dynamo db session manager can work reliably in session sticky mode only? Maybe worth it to let AWS marketing guys to update this page because it's very misleading.

  2. If dynamo db has huge synchronization lag with the cache manager, will it perform reliable fail over (with session sticky mode enabled) if one node becomes unavailable? If dynamo db is not synced - it may be dangerous.

Thank you.

AlexKovalevich avatar Dec 20 '16 11:12 AlexKovalevich

This project has been archived. Please see the README.md for more detail on alternative projects.

hyandell avatar Feb 06 '18 21:02 hyandell