windows azure网站如何处理会话?

iam*_*lin 5 session azure

我正在调查windows azure中的一个新产品.特别是"网站",我无法找到有关它如何处理会话数据的任何信息.有人知道吗?我将滑块移动到2个实例,它似乎"只是工作",但如果我确定它是在共享会话数据(或不是?),我会觉得使用它更好

Jor*_*rdi 5

你有一些选择来解决这个问题

  1. sql解决方案

  2. 表存储解决方案

  3. memcache解决方案

Sql是经典的解决方案.Sql处理具有经典sql请求的所有会话.

表存储可以创造奇迹(根据我的经验).它非常容易扩展,而且实现起来非常简单(只需几行代码就可以了).

Memcache解决方案是最佳解决方案.Azure提供了一个"缓存服务器"集群来存储会话(或其他可序列化对象).它非常容易扩展,并且工作非常快.我在我的生产环境中使用此解决方案,遇到0个问题并且性能非常好.

为了实现Memcache,您只需要在web.config上添加这些行:

<configuration>
    <configSections>        
        <section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere"/>
        <!-- more config sections here -->
    </configSections>
    <dataCacheClients>
    <dataCacheClient name="default">
        <hosts>
        <host name="YOUR_NAME_HERE.cache.windows.net" cachePort="YOUR_PORT_HERE"/>
        </hosts>
    <securityProperties mode="Message">
            <messageSecurity authorizationInfo="YOUR_KEY_HERE">
                            </messageSecurity>
            </securityProperties>
    </dataCacheClient>
</dataCacheClients>
<!-- more configurations here -->
Run Code Online (Sandbox Code Playgroud)

摘要

如果您不关心成本并且希望尽可能获得最佳性能,请使用memcache解决方案.如果您需要保持低成本,请选择桌面存储.


cor*_*ler 5

如果您想了解有关Windows Azure网站架构的更多信息,我建议您在TechEd 2012 Windows Azure网站上观看此会话:在引擎盖下

  • 目前尚不清楚会话数据是否在多个实例之间自动共享. (3认同)