InkStore is a high-performance, multi-threaded in-memory key-value store written in C++, designed to model real-world caching systems like Redis.
It acts as a caching layer to reduce backend latency and database load by serving frequently accessed data directly from memory.
Modern backend systems face:
- High latency due to repeated database queries
- Performance degradation under concurrent load
- Inefficient handling of frequently accessed data
InkStore introduces an in-memory caching layer:
Client → InkStore (cache) ⚡ → Database (fallback)
This significantly improves response time and reduces database pressure.
- In-memory key-value storage (O(1) average operations)
- TCP socket-based server
- Multi-threaded client handling
- Write-Ahead Logging (WAL) for durability
- TTL (Time-To-Live) for automatic key expiration
- LRU eviction policy for memory management
- Thread-safe operations using mutex synchronization
- Custom multi-threaded benchmarking client
- Throughput & latency measurement
- Concurrency stress testing
Client (ncat / custom client)
↓
TCP Socket
↓
InkStore Server (C++)
↓
In-Memory Store + WAL
| Threads | Throughput (req/sec) | Latency (ms) |
|---|---|---|
| 1 | ~7700 | 0.12 |
| 12 | ~7300 | 0.13 |
| 50 | ~4300 | 0.23 |
| 80 | ~3000 | 0.33 |
| 100 | ~3100 | 0.31 |
| 150 | ~3170 | 0.31 |
| 200 | ~1290 | 0.77 |
-
Best performance observed at low concurrency (1–10 threads)
-
Throughput decreases as thread count increases due to:
- Mutex lock contention
- Context switching overhead
- Socket connection overhead
-
Latency increases significantly under high concurrency
-
Demonstrates real-world limitations of shared locks in multi-threaded systems
- Language: C++ (C++17)
- Networking: POSIX Sockets
- Concurrency: std::thread, mutex
- Persistence: Write-Ahead Logging (WAL)
- Data Structures: HashMap + Doubly Linked List (LRU)
make./inkstoremake benchmark
./benchmark_appUsing ncat:
ncat 127.0.0.1 9090SET name abhijeet
GET name
GETALL
DEL name
- API response caching
- Session storage
- Rate limiting systems
- High-performance backend services
- Concurrency control and synchronization
- Performance vs scalability trade-offs
- Memory-efficient caching strategies
- Importance of benchmarking and profiling
InkStore demonstrates core backend infrastructure concepts including caching, concurrency, persistence, and performance analysis — closely mirroring real-world system design patterns used in high-performance services.

