Concurrent Writes and Locking in Neo4j
summary
Demonstrates Neo4j lock behavior with live Cipher shells, using apoc.util.sleep to simulate long transactions and showing that MERGE creates duplicates under concurrency because uncommitted changes aren’t visible to other transactions; only uniqueness constraints prevent duplicates. Shows locks taken on nodes, labels and relationship groups, that relationship MERGE acquires node locks while plain CREATE relationships can run concurrently with property updates in 5.23, and that default dbms.lock_acquisition_timeout = 0 (infinite) — changed to 5s in the demo. Tests include creating 50 relationships concurrently to show throughput.
AI-written summary · about
chapters (12)
- 0:00Introduction and basics
- 1:31Transaction handling
- 3:40Demonstrating locking
- 6:12Merge and node concurrency
- 10:30Uniqueness constraints
- 12:23Updating properties and locks
- 13:49Label modification locks
- 15:32Data safety and errors
- 18:18Lock acquisition timeouts
- 20:04Relationship creation locks
- 23:16Strategies for parallel loads
- 26:01Advanced merge techniques
related talks
52mMy application is fully concurrent and async. What about the database?
42mEffective transaction management with Spring
41mConcurrency, Scalability and Transactions -- Myths and Surprises
42mA Race To The Bottom: Database Transactions Undermining Your AppSec
58mLocking And Concurrency Control
42mAnatomy of Table-Level Locks in PostgreSQL
48mUnderstanding and Reducing Application Contention
18mAvoiding Conflicts in Highly-Concurrent Applications
