← Home
💬Real-life Scenario-based Interview QuestionsInterview QuestionsNEW
Advanced
Experience levelSenior · 5+ YOESenior / staff depth expected

Users from different continents update the same document at nearly the same time. How would you handle concurrent updates and conflict resolution?

ConcurrencyCRDTCollaborationDistributed Systems

How I frame it

Clarify document type: collaborative editor (Google Doc) vs form/settings (last-write-wins dangerous). Solution depends on whether conflicts can auto-merge.

Approaches

  • Optimistic concurrency (OCV): Client sends version; server rejects stale with 409 + latest doc — user merges manually. Good for profiles, config.
  • Operational Transform / CRDT: Real-time collab — concurrent edits commute to same final state. Figma/Notion model.
  • Field-level merge: JSON patch per field with vector clock; conflict only on same field.
  • Last-write-wins: Only if business accepts data loss — timestamp + tie-breaker node id.
User IN: title "Draft" @ v5
User US: body edit @ v5
  OCV: second save fails → merge UI
  CRDT: both ops merge → converged doc

Offline-first mobile

Queue ops with client vector clock; sync on reconnect. Divergent branches → CRDT merge or explicit conflict resolution UI.

Walkthrough

Shared spec doc at version 5. Engineer in Bangalore edits title; PM in SF edits introduction — same version. OCV: second save gets 409 with latest doc; merge UI shows diff. CRDT editor: both keystrokes merge; converged doc has both changes without user intervention.

Weak answer

"Last-write-wins by timestamp." Clock skew across continents silently drops one user's work. "Lock document on open" — poor UX for async collaboration; fine for rare admin forms only.

Follow-up questions

Financial document — can we use CRDT?

No — use strict OCV + audit log; human approval on conflict.

Presence / cursors?

Ephemeral WebSocket state — not persisted; OT/CRDT for document body only.