7

I have 3 Sitecore 9.0.2 Azure IaaS Content Delivery Servers running. All are using Azure Redis Cache for private AND shared session. And all behind an Azure Load Balancer.

Configuring session and sharedsession connectionstrings out of ConnectionString.config wouldn't work (read: generated .NET 500 errors in Sitecore log) and I had to specify the hostname and port directly on provider configuration instead of Connection string name. No errors are being generated by Sitecore.

I see requests going to all 3 servers in IIS logs, especially for the same session. I can tell the user is bouncing between CD's through the Load Balancer.

How can tell definatively that shared and private session is working the way it should?

  • For clarity, I have supspicion that something is wrong, but have no generated error message to back that up. – Pete Navarra Nov 11 '18 at 0:30
8

How we did for AWS, on Azure I think should be pretty the same:

  1. Create test1 page that will display server name(CD1, CD2, etc.) and put information to session: trigger some goal and save some information directly to session. For example something like:

//Register goal var goalTrigger = Sitecore.Analytics.Tracker.MarketingDefinitions.Goals[{SomeGuid}]; var goalEventData = Sitecore.Analytics.Tracker.Current.CurrentPage.RegisterGoal(goalTrigger); goalEventData.Data = goalItem["Name"]; goalEventData.ItemId = goalItem.ID.ToGuid(); goalEventData.DataKey = goalItem.Paths.Path; goalEventData.Text = "Goal for Logic"; Sitecore.Analytics.Tracker.Current.Interaction.AcceptModifications(); //Put value to session HttpContext.Current.Session["test"] = "value in session";

  1. Create test2 page that will display server name(CD1, CD2, etc.), Session identifier, list of triggered goals, value that is shared in session. For example something like:

//Check that goal was triggered var cache = Tracker.Current.Contact.KeyBehaviorCache; bool goalTriggered = cache.Goals.Any(x => x.Id == SomeGuid); //Check that value is present in session var sessionValue = HttpContext.Current.Session["test"];

  1. Remove all CD servers except one(CD1) from load balancer(LB) and open test1 page in incognito mode(or after cleaning cookies in browser). (We suppose that goal(s) should be triggered and value should be in session)
  2. Remove CD server that was present in LB(CD1). Add another one server to LB(CD2). Open test2 page. Expected result: It should display expected Sitecore analytics information and information that you put directly to session.
  3. Close and re-open incognito window of your browser. Or clean cookies.
  4. Repeat 3-4 step with different combinations of servers. (CD2 <=> CD1, or other if you have more than 2 CD servers)

P.S. May be it is too general and obvious answer. I wanted to make it as comment. But there are too many characters to to fit in the comment.

  • I think checking the private session with HttpContext.Current.Session["test"] is obvious and easy, but checking the shared session using the goal is a great idea. – Mark Gibbons Nov 13 '18 at 4:19

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.