Azure 和会话状态下的多个 webRole 实例
我有 webRole,其中一些数据存储在会话中。数据是几十个小变量(字符串)和一到两个大对象(一些兆字节)。我需要在多个实例中运行此 webRole。由于来自单个用户的两个请求可以发送到不同的实例,因此 Session 变得毫无用处。因此,我正在寻找最有效和最简单的方法来存储这种情况下的易失性用户数据。我知道我可以将其存储在客户端的 cookie 中,但这对于大对象来说会失败。我还知道我可以使用 Azure 存储中的数据 - 但这似乎比会话更复杂。有人可以建议既有效又简单的方法,例如会话状态吗?或者可能有一些解决方法可以在启用多个实例时使会话状态正常工作。
I have webRole with some data stored in Session. The data is some tens of small variables (strings), and one-two big objects (some megabytes). I need to run this webRole in multiple instances. Since two requests from the single user can go to different instances, Session became useless. So, i am looking for most efficient and simplest method of storing volatile user data for this case. I know that i can store it in cookies at client side, but this will fail for big objects. I also know that i can user data in Azure storage - but this seems to be more complicated than Session. Can anybody suggest both efficient and simple method, like Session state? Or probably some workaround to get Session state working correctly when multiple instances enabled.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能有帮助
http://social. msdn.microsoft.com/Forums/en-US/windowsazure/thread/7ddc0ca8-0cc5-4549-b44e-5b8c39570896
This may help
http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/7ddc0ca8-0cc5-4549-b44e-5b8c39570896
您需要使用内存之外的另一个会话状态存储。在 Azure 中,您可以使用缓存、存储表或 SQL Server 在实例之间共享会话数据。
You need to use another session state storage than memory. In Azure you can use Cache, Storage tables or SQL server to share session data between instances.