Home / Companies / QuestDB / Blog / Post Details
Content Deep Dive

Concurrent Data Structure Design Walkthrough

Blog post from QuestDB

Post Details
Company
Date Published
Author
Jaromir Hamala
Word Count
4,480
Language
English
Hacker News Points
-
Summary

QuestDB, an open-source time-series database, is known for handling demanding workloads with ultra-low latency and high ingestion throughput. This article presents a detailed exploration of designing a concurrent data structure, specifically a concurrent map that favors readers by being lock-free on the read path. The author navigates the complexities of concurrent programming, including challenges such as pointer lifecycle management and consistency of map internals, while also addressing the need to integrate the map with Rust code for digital signatures verification. Through a detailed narrative, the article outlines the development of a concurrent map using techniques like Copy-On-Write and dual maps to maintain immutability and memory management efficiency. The process involves a series of trials, including the use of single-writer principles and reader counters, to ensure that readers and writers do not access the same map concurrently. The implementation, while effective, is recognized as still needing further development for production readiness, such as implementing a close method to prevent memory leaks and optimizing performance. The article acknowledges contributions from existing patterns and papers, highlighting the iterative learning and adaptation involved in concurrent programming design.