简体   繁体   English

Tomcat 7持久会话管理器从商店过早加载

[英]Tomcat 7 Persistent Session Manager prematurely loads from Store

We are attempting to configure the dynamodb session manager for tomcat 7 in an elasticbeanstalk environment running a single server. 我们正在尝试在运行单个服务器的Elasticbeanstalk环境中为tomcat 7配置dynamodb会话管理器

We can see the session data being periodically backed up to dynamodb but occasionally the old session data (for the same session) is being loaded back out of dynamodb. 我们可以看到会话数据被定期备份到dynamodb,但是偶尔(对于同一会话)旧的会话数据也被从dynamodb中加载回去。 In our application this manifests itself by loading the previous item you were looking at (the item is stored on the session). 在我们的应用程序中,这通过加载您正在查看的上一个项目来体现出来(该项目存储在会话中)。 The JSESSIONID cookie stays the same and the client keeps the same session. JSESSIONID cookie保持不变,并且客户端保持相同的会话。 If we turn the session manager off, the issue is resolved. 如果我们关闭会话管理器,则此问题已解决。

Here is the contents of our context.xml 这是我们的context.xml的内容

<?xml version="1.0" encoding="UTF-8"?>
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager
    className="com.amazonaws.services.dynamodb.sessionmanager.DynamoDBSessionManager"
    Table="SessionTable"
    RegionId="eu-west-1"/>
</Context>

We've tried setting maxIdleBackup and maxIdleSwap to high numbers as defined in the tomcat 7 docs to no avail. 我们尝试将tomcat 7文档中定义的maxIdleBackup和maxIdleSwap设置为高数字,但无济于事。

If we set maxIdleBackup and maxIdleSwap to zero then the error is reduced because the session data is backed up to dynamodb more often, but this doesn't solve the issue. 如果将maxIdleBackup和maxIdleSwap设置为零,则会减少错误,因为会话数据更频繁地备份到dynamodb,但这不能解决问题。

What is causing tomcat to load the session data back from the Store? 是什么导致tomcat从商店中加载会话数据? My understanding was that it should only be loaded from the store if it is not available at all (ie client hits a different tomcat). 我的理解是,只有在根本不可用的情况下,才应该从商店中加载它(即,客户端访问了另一个tomcat)。

I believe you suffer from the async nature (and the implicit need for sticky sessions) of the implementation as noted in issue #6 我相信您会遇到问题6中提到的实现的异步特性(以及对粘性会话的隐式需求)

If you are not using sticky sessions I recommend you go for the Redis approach which is synchronous 如果您不使用粘性会话,建议您使用同步的Redis方法

In the end we resorted to using the JDBCStore which does not have this issue. 最后,我们求助于使用不存在此问题的JDBCStore I hope to come back to this problem in the future given more time. 我希望将来有更多时间回到这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM