Sk

Sklad, a key-value database in Zig

Hacker News

Sklad, a key-value database in Zig

I’ve been building Sklad, a small key-value database in Zig. Right now it supports basic set/get/delete operations, TTL, and range queries. The main idea behind it is to use lock-free data structures and to build the engine around an asynchronous task queue processed by a small pool of worker threads. The task queue is a lock-free MPMC queue. Memtable is also a lock-free skip-list. I also use lock-free append-only queues and stacks throughout the code. The only place where I currently use locking is writing to WAL. The request processing pipeline is split into small tasks. A single I/O worker accepts incoming requests. When a new request arrives, the I/O worker publishes a read-request task, which is then picked up by one of the generic workers. From there, the request continues through a series of smaller tasks: a query-processing task parses the query, an execution task performs the operation, and finally a write-response task sends the result back to the client. Each stage publishes the next task to the queue, and that task may be picked up by a different worker. The maximum number of workers is controlled by a configuration parameter, and there is simple logic to retire idle workers and spawn new ones as the workload increases. Sklad also collects internal metrics such as request latency, task latency, queue wait time, and the number of pending memtables and active workers. Right now these metrics are exposed through a dedicated metrics request, but I’d like to use them as inputs for adaptive behavior in the engine, for example scaling the worker pool, deciding when to run compaction, and potentially tuning SSTable parameters such as memtable size or Bloom filter bits per key. GitHub: https://github.com/sklad-dev/Sklad

Share card

Actual performance

2points
Did not reach leaderboard

Launch Intel predictions

Analyze your own launch →
Product HuntOn track for Day 1 leaderboard · Strong signals: new, single, tasks · Missing: mac, agents, macos
78%78% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Indie HackersFits the IH revenue-focused audience · Strong signals: supports, para · Missing: reddit linkedin, podcasting, created
61%61% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: ide, pipe, io · Missing: https docs, excited, just released
59%59% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
TrustMRRLess likely to generate early MRR · Strong signals: para · Missing: mobile apps, ios, personal
43%43% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
30%30% predicted probability of success on AppSumo, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: arr, active · Missing: mrr, revenue, profit
17%17% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Incorrect prediction on native model

Similar products

Bu
Build8 Key-Value service is a simple key-value database59%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Build8 Key-Value service is a simple key-value database

Hacker News1
Be
BerylDB – a small key-value database59%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

BerylDB – a small key-value database

Hacker News57
Ro
RonDB – fast key-value database in the cloud64%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

RonDB – fast key-value database in the cloud

Hacker News112
Ke
Key-Value-Exists48%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Key-Value-Exists

Hacker News2
Su
SuperMassive – Fast durable, in-memory, distributed key-value database72%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

SuperMassive – Fast durable, in-memory, distributed key-value database

Hacker News7
Fr
Framing: Context-Based Value-Key Database47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Framing: Context-Based Value-Key Database

Hacker News1
El
EloqKV – Scalable distributed ACID key-value database with Redis API69%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

EloqKV – Scalable distributed ACID key-value database with Redis API

Hacker News44
Wa
WaspDB, encrypted key/value database for Android61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

WaspDB, encrypted key/value database for Android

Hacker News3
Pe
PearlDB = LMDB and H2O. REST key-value database server in C62%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

PearlDB = LMDB and H2O. REST key-value database server in C

Hacker News6
Su
SuperMassive – Distributed scalable key-value database in 100% GO61%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

SuperMassive – Distributed scalable key-value database in 100% GO

Hacker News2