云就绪 - 寻找 HTTP 会话替代方案
Cloud readiness - looking for HTTP Session alternatives
我们计划将 J2EE
Monolith
重构为 Microservices
应用程序。我们计划使用 Spring
、Spring boot
、Spring cloud
和 Pivotal cloud foundry
作为 PaaS
进行构建。
当我使用 The twelve-factor app 验证我当前的应用程序是否已准备好云时,我注意到的重要想法是 'HTTP Sessions' 在我们的应用程序中的用法。 link 建议
Some web systems rely on “sticky sessions” – that is, caching user
session data in memory of the app’s process and expecting future
requests from the same visitor to be routed to the same process.
Sticky sessions are a violation of twelve-factor and should never be
used or relied upon. Session state data is a good candidate for a
datastore that offers time-expiration, such as Memcached or Redis.
我不明白如何使用 im-memory data store
来跟踪用户会话?有人可以解释一下吗?我应该使用一些唯一的密钥让用户从内存数据存储中检索信息吗?
作为一个很好的例子,你可以看看Spring会话实现的解释
https://www.infoq.com/articles/Next-Generation-Session-Management-with-Spring-Session
它引用了 Redis 存储,您可以从 PCF 服务将其绑定到您的应用程序。
我们计划将 J2EE
Monolith
重构为 Microservices
应用程序。我们计划使用 Spring
、Spring boot
、Spring cloud
和 Pivotal cloud foundry
作为 PaaS
进行构建。
当我使用 The twelve-factor app 验证我当前的应用程序是否已准备好云时,我注意到的重要想法是 'HTTP Sessions' 在我们的应用程序中的用法。 link 建议
Some web systems rely on “sticky sessions” – that is, caching user session data in memory of the app’s process and expecting future requests from the same visitor to be routed to the same process. Sticky sessions are a violation of twelve-factor and should never be used or relied upon. Session state data is a good candidate for a datastore that offers time-expiration, such as Memcached or Redis.
我不明白如何使用 im-memory data store
来跟踪用户会话?有人可以解释一下吗?我应该使用一些唯一的密钥让用户从内存数据存储中检索信息吗?
作为一个很好的例子,你可以看看Spring会话实现的解释
https://www.infoq.com/articles/Next-Generation-Session-Management-with-Spring-Session
它引用了 Redis 存储,您可以从 PCF 服务将其绑定到您的应用程序。