Dive Into the Collaboration Technology Behind Google Docs

This post dive into the collaboration technology behind Google Docs in three parts, starting with a look at the challenges encountered when building a collaborative application. Collaboration is technically difficult because many people can be making changes to same content at almost the same time. Since connection speeds aren't instantaneous, when you make a change, […]

This post dive into the collaboration technology behind Google Docs in three parts, starting with a look at the challenges encountered when building a collaborative application. Collaboration is technically difficult because many people can be making changes to same content at almost the same time. Since connection speeds aren't instantaneous, when you make a change, you're temporarily creating a local version of the document that's different from versions other collaborators see. The core implementation challenge is to make sure that all the editing sessions eventually converge on the same, correct, version of the document.

"The new Google documents does things differently. In new editor, a document is stored as a series of chronological changes. A change might be something like {InsertText 'T' @10}. That particular change was to insert the letter T at the 10th position in the document. A fundamental difference between new editor and the old one is that instead of computing the changes by comparing document versions, we now compute the versions by playing forward the history of changes.

This approach creates a better collaboration experience, because the editors'; intentions are never ambiguous. Since we know the revision of each change, we can check what the editor saw when he made that change and we can figure out how to correctly merge that change with any changes that were made since then," explains Google.

[Source]