memcache JSESSIONID tomcat issues

293 views
Skip to first unread message

David Dennis

unread,
Oct 23, 2017, 4:37:28 PM10/23/17
to memcached-session-manager
Hi,

I have a tomcat8/spring app running on two EC2 instances. When I go to these instances I have no problem logging into my page. But when I set up a Load Balancer it just redirects we back to the login page when trying to access the app through that LB. This LB is non sticky. So I set up Elasticache memcache. What I did was bring in three jars. memcached-session-manager-2.1.1.jar, memcached-session-manager-tc8-2.1.1.jar and spymemcached-2.11.1.jar in my tomcat lib folder. Then I set up my context.xml to use
   <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
        memcachedNodes="n1:my Configuration Endpoint:"
             memcachedProtocol="binary"
             sticky="true"
             sessionBackupAsync="true"
             requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
             transcoderFactoryClass="de.javakaffee.web.msm.JavaSerializationTranscoderFactory"
          />
But I still have the issue on my LB where it just redirects me back to my login page. Am I missing a setup step? Or does this not support tomcat 8 etc??

Side note. I also tried adding the ant jars.

Billy Bacon

unread,
Oct 23, 2017, 6:20:35 PM10/23/17
to memcached-se...@googlegroups.com
Hi David,

Are you bringing down the memached jars from S3 with an ebextension at deployment time to update your TOMCAT/lib directory (assumes you are running in an ElasticBeanstalk environment)? 

I'd get rid of the spymecached jar altogether and use the one that AWS provides for connecting to ElasticCache. You should be able to download it through the AWS ElastiCache console. The one we've been using for years is AmazonElastiCacheClusterClient-1.0.jar. <--- That takes the place of spymemcached.

I haven't seen or used the memcachedProtocol attribute, that might be a 2.x feature Martin built in. We've been running 1.9.6 for a long time. 

This is what our context.xml looks like for version 1.9.6. 

<Context path="">
<Manager
className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
enabled="${memcached.session.enabled}"
memcachedNodes="${memcached.session.nodes}"
requestUriIgnorePattern=".*\.(png|gif|jpg|css|js|ico)$"
transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"/>
</Context>

The enabled and memcachedNodes attributes are injected via jvm args.

All of the bits I explained above applies to a non-elasticbeanstalk environment in the event you are rolling your own ALB (application load balancer) and EC2 instances. 

You'll also want to make sure that your sticky session timeout on your load balancer matches the session timeout for your app. If that's a mixed bag you will sometimes see odd behavior. I don't think this is the root of your issue but could bite you in the ass down the road when you get things working.

- Bacon -


--

---
You received this message because you are subscribed to the Google Groups "memcached-session-manager" group.
To unsubscribe from this group and stop receiving emails from it, send an email to memcached-session-...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages