AlexanderMihail / seastar_db

A key-value database engine with REST interface
http://seastar.io
Apache License 2.0
0 stars 0 forks source link

Better interlocking to avoid unnecessary read contention #10

Open AlexanderMihail opened 6 months ago

AlexanderMihail commented 6 months ago

The mutual exclusion Lock is currently used for everything. That yields unnecessary contention.

Got to use a different lock for readers. When a writer wants to get in, he/she waits to aquire the readers lock first. He then elevates that lock to a write lock. Readers wait on the write lock but share the read lock.

The read lock needs to be counted. It measures the number of concurrent readers. The write lock is a -1 value of this read-lock.

One lock per table. Table-of-tables is also a table, so it has its own lock.