DiceDB is hyper-optimized for building and scaling truly real-time applications on modern hardware. It is a drop-in replacement for Redis with support for SQL-based reactivity.
With the addition of the WatchKeys goroutine (to enable real-time reactive query subscriptions), concurrent reads can happen on the store and keypool maps.
This change adds RW locks to guard access to these data structures to prevent race conditions.
Benchmarks
These benchmarks test existing workflows which are mostly single-threaded, we may see some unavoidable slowdowns once we benchmark more sophisticated scenarios (involving multiple clients, some of which are subscribing to existing queries.
Overall, the performance is quite close to the thread-unsafe implementation, and the time taken seems to have increased within reason.
With the addition of the WatchKeys goroutine (to enable real-time reactive query subscriptions), concurrent reads can happen on the
store
andkeypool
maps.This change adds RW locks to guard access to these data structures to prevent race conditions.
Benchmarks
These benchmarks test existing workflows which are mostly single-threaded, we may see some unavoidable slowdowns once we benchmark more sophisticated scenarios (involving multiple clients, some of which are subscribing to existing queries.
Overall, the performance is quite close to the thread-unsafe implementation, and the time taken seems to have increased within reason.
Thread-Safe Implementation
Thread-Unsafe Implementation (original)