1

We have 2 load balanced CD servers. Session affinity is disabled on the load balancer and we are using MongoDB for session storage.

User authentication is performed on a separate site. They are redirected back to our servers and logged into Sitecore as a virtual user. Custom properties are set on the user profile such as first and last name.

Once signed in, the user is presented with a welcome message ie. "Hello Bob". The value Bob will only display on one server. If the user is bounced to the second server by refreshing it, will just display "Hello", without the custom property.

I have verified that the data is getting saved to the ClientData table in core with the correct session Id.

I am at a loss on, what to look at now to get this to work. Any suggestions?

Session state from web.config:

<sessionState mode="Custom" customProvider="mongo" cookieless="false" timeout="20">
<providers>
    <add name="mongo"
         type="Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider, 
     Sitecore.SessionProvider.MongoDB"
         connectionStringName="privateSession"
         pollingInterval="2"
         compression="true"
         sessionType="private"/>
</providers>

Shared session state:

<sharedSessionState patch:source="Sitecore.Analytics.Tracking.config" defaultProvider="mongo">
<providers>
    <clear />
    <add name="InProc" type="System.Web.SessionState.InProcSessionStateStore" />
    <add name="mongo" type="Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider, Sitecore.SessionProvider.MongoDB" connectionStringName="sharedSession" pollingInterval="2" compression="true" sessionType="shared" patch:source="SharedSession.config" />
</providers>
<manager type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateManager, Sitecore.Analytics">
    <param ref="tracking/sharedSessionState/config" desc="configuration" />
</manager>
<config type="Sitecore.Analytics.Tracking.SharedSessionState.SharedSessionStateConfig, Sitecore.Analytics">
    <param desc="maxLockAge">5000</param>
    <param desc="timeoutBetweenLockAttempts">10</param>
</config>
</sharedSessionState>
  • As far as I know to make it work you need to use sticky session. Here is a small documentation - doc.sitecore.net/sitecore_experience_platform/82/… – Tamás Tárnok Feb 8 '18 at 10:45
  • Thank you, but that document doesn’t address virtual users. Also, the user is still authenticated on both servers, it’s just the custom properties that are missing. If Sitecore is storing that data in the core database, why would the server matter? – Geoff Warren Feb 8 '18 at 14:30
  • We are having this same issue. Was it ever resolved? – Cody Watkins Mar 7 '18 at 21:37
  • We haven't found a solution. The client deprioritized the issue and has left sticky sessions on for now. – Geoff Warren Mar 14 '18 at 3:54
1

Virtual user information is saved in Session. By default Sitecore configuration doesn't share sessions information between few CD servers. That is why one CD server doesn't know anything about logged in users on others CD servers. You have few options, how to solve it:

  1. Configure your hosting environment to use sticky load balancer. Link that was mentioned by Tamas is useful. Sticky load balancer means that user always will be routed to same CD. Other CDs will not know anything about this session on one CD, but it doesn't matter.
  2. Use SessionState configuration that allows to share information between few servers. For Sitecore 8 it could be SQL Session State Provider. For Sitecore 7 you have a lot of options, you can use any ASPNet session state providers. It could be Redis, Couchbase, RavenDB, MongoDB, etc. This approach means that virtual user information will be saved in shared place and could be user by different CD servers.

P.S. Don't forget to use user.Profile.Save(); in your code.

  • Actually, I don't believe this will be enough. If they create a Virtual User on CD1 and logs it in - this would not automatically reflect onto CD2 regardless of shared session state – Mark Cassidy Feb 8 '18 at 14:49
  • We are using Mongo for shared and private session. I've read and observed that the custom properties for a virtual user are stored in the core database in the ClientData table, keyed off the session Id. I verified that the record is in the table. Is there a reason why one server get can to that data and another couldn't? – Geoff Warren Feb 8 '18 at 15:14
  • @GeoffWarren Can you find section sessionState in web.config and add to quesiton? – Anton Feb 9 '18 at 9:45
  • @Anton I added the the sessionState config for private and shared – Geoff Warren Feb 9 '18 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.