How nirjhardebnath/anemodb works
Anemo DB accepts SQL-over-TCP requests, queues them for worker processing, and returns read results from an LRU/TTL cache or PostgreSQL on a miss. Its in-band stats feed the terminal monitor and Flask dashboard; the dashboard also controls optional cache-versus-database traffic simulation. Benchmark scripts and SQL dataset tooling are documented capabilities, but are outside the runtime workflow. Core request/cache wiring is supported by the README and sampled C++ excerpts; dashboard wiring is sampled, while unsampled implementation details are kept at subsystem level.
Main entry points: CacheEngine.hpp TCP Engine · web_dashboard.py Flask Backend · script.js Dashboard Scripts · traffic_generator.py Traffic Generator
Components 15
Cache Server
- Server Entry
Cache Components/main.cpp - TCP Engine
Cache Components/CacheEngine.hpp - Bounded Queue
Cache Components/ThreadSafeQueue.hpp - TTL LRU Cache
Cache Components/Cache.hpp - DB Pool
Cache Components/ConnectionPool.hpp
Monitoring
- Terminal Monitor
Cache Monitor/monitor_cache.py
Web Dashboard
- Dashboard UI
Web Dashboard/templates/index.html - Dashboard Scripts
Web Dashboard/static/script.js - Flask Backend
Web Dashboard/web_dashboard.py - Traffic Generator
Web Dashboard/traffic_generator.py
Benchmarking
- Benchmark Clients
Cache Benchmark - SQL Dataset
Cache Benchmark/create_db
Other components
- SQL Client
- PostgreSQL
- Dashboard User
Connections 20
- SQL Client → TCP Engine: sends SQL
- TCP Engine → Bounded Queue: enqueues request
- Bounded Queue → TCP Engine: dispatches task
- TCP Engine → TTL LRU Cache: looks up or reserves
- TCP Engine → DB Pool: fetches on miss
- DB Pool → PostgreSQL: queries
- TCP Engine → SQL Client: returns response
- TCP Engine → Terminal Monitor: serves STATS
- Terminal Monitor → TCP Engine: polls STATS
- Dashboard User → Dashboard UI: uses dashboard
- Dashboard UI → Dashboard Scripts: loads scripts
- Dashboard Scripts → Flask Backend: requests stats
- Flask Backend → TCP Engine: polls STATS_JSON
- Flask Backend → Traffic Generator: reads metrics
- Dashboard Scripts → Flask Backend: controls traffic
- Traffic Generator → TCP Engine: sends simulated SQL
- Traffic Generator → PostgreSQL: runs direct queries
- Benchmark Clients → TCP Engine: benchmarks cache
- Benchmark Clients → PostgreSQL: benchmarks direct DB
- SQL Dataset → PostgreSQL: initializes schema