This blog is based on one of the topic covered in my recent presentation in Auckland Sitecore user group where we discussed on Contact lock stages in Sitecore xDB while I presented on xDB and Personalization at Scale.
It was demonstrated for Sitecore 8.2(update 7 instance)
Assuming user has already visited website and the contact data and corresponding Interactions data are already stored in xDB(Collection Database in Mongo DB). So What happens next once same Contact visits website again and how is Contact data passed at different stages and how are the locking and unlocking of Contact data is done at various stages-
Pictorial Representation of the entire Process below-
Assuming there are no active sessions of the Contact and at this point of time , Contact data is stored in Mongo DB (Collection Database).
Contact data lies in Contact Collection.
User Interactions data lies in Interaction Collection.
As soon user session starts – Contact data gets locked in collection database and a copy of Contact data is loaded in Shared Session database. So at this Stage Contact data cannot be updated in Collection database.
On each individual Page request by same user – Contact Data then gets locked in Shared Session database and a copy of Contact Data gets loaded in Tracker object. At this point new user Interaction data is loaded as well in Tracker object. This is the point where Contact data is accessible in the Page Code.
When the Page request ends – Contact is removed from the Tracker object and at this point now Contact data gets unlocked in Shared Session database.
And in end of this process – as soon user Session ends – Contact data is removed from Shared Session database and is saved back to Collection database. To be noted: now Contact is unlocked in Collection database (Contact collection in mongo DB).
References : Sitecore documentation and Sugcon EU presentation from Dmytro Shevchenko