Sitecore 8: Using the Azure Module Causes Slow Response Times When Utilizing Analytics Sessions

If you are using Sitecore’s Azure Module 7.5 with Sitecore 8, you may experience extremely slow response times when your site is utilizing Analytics.

To fix this, you should use Mongo’s session state provider instead.  To configure, you have to do a few things.

1) Make sure you have installed MongoDB.

2) Add in connection strings to your Azure Role’s Azure Deployment Node:

Azure Deployment Node

3) Modify the Connection Strings Patch field to point the session and sharedSession databases to your instance of Mongo.  NOTE – Make to only add in the session and sharedSession connection strings.  Also, make sure you configure this appropriately for your environment.

[code lang=”xml”]
 <add name="session" connectionString="mongodb://user:pass@10.1.1.1,10.1.1.2/sc8_session?authSource=admin" />
<add name="sharedSession" connectionString="mongodb://user:pass@10.1.1.1,10.1.1.2/sc8_sharedSession?authSource=admin" />
[/code]

4) Modify the Custom Web Config Patch field by adding the following nodes into your root xsl:stylesheet node:

[code lang=”xml”]

<xsl:template match="configuration/system.web/sessionState">
<sessionState mode="Custom" customProvider="mongo" cookieless="false" timeout="20">
<providers>
<add name="mongo" type="Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider, Sitecore.SessionProvider.MongoDB" connectionStringName="session" pollingInterval="2" compression="true" sessionType="private" />
</providers>
</sessionState>
</xsl:template>

<xsl:template match="configuration/sitecore/tracking/sharedSessionState">
<sharedSessionState defaultProvider="mongo">
<providers>
<clear />
<add name="mongo" type="Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider, Sitecore.SessionProvider.MongoDB" connectionStringName="sharedSession" pollingInterval="2" compression="true" sessionType="shared" />
</providers>
<manager type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateManager, Sitecore.Analytics">
<param desc="configuration" ref="tracking/sharedSessionState/config" />
</manager>
<config type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateConfig, Sitecore.Analytics">
<param desc="maxLockAge">5000</param>
</config>

</sharedSessionState>
</xsl:template>

[/code]

Basically, you are following the instructions here, but you are applying these concepts to the Azure Module.

Once you have configured this and re-deployed, everything should be good to go!

We also experienced a similar problem using Sitecore 6.6 and the Azure Module, however we were never able to resolve this.  I suspect that we could have utilized the SQL Session state provider and all would have been good.