Skip to content

cachedb_tarantool: High-performance Tarantool 3.x CacheDB driver with zero-alloc get_buf & RPC - #4231

Open
lean1ee wants to merge 1 commit into
OpenSIPS:masterfrom
lean1ee:feature/cachedb_tarantool
Open

cachedb_tarantool: High-performance Tarantool 3.x CacheDB driver with zero-alloc get_buf & RPC#4231
lean1ee wants to merge 1 commit into
OpenSIPS:masterfrom
lean1ee:feature/cachedb_tarantool

Conversation

@lean1ee

@lean1ee lean1ee commented Aug 30, 2026

Copy link
Copy Markdown

💡 Motivation: Why Tarantool 3.x for OpenSIPS?

In modern distributed SIP clusters, key-value stores (Redis/Memcached) only provide flat string storage without multi-attribute indexing or server-side intelligence. cachedb_tarantool provides a transactional in-memory backend designed specifically for carrier-grade VoIP:

  1. Zero Audio Stutter (No BGSAVE Stalls):
    Replaces Redis background fork COW pauses (18–20 ms) with continuous Streaming WAL, ensuring reliable real-time media processing.

  2. 1-Hop Asymmetric SIP Routing (vs 2-Hop P2P Mesh):
    In split-leg routing scenarios (INVITE on Node A, BYE on Node B), centralized atomic state resolution delivers 1,003.4 CPS (+80% vs P2P pull-mesh) and 0.45 ms median BYE latency (vs 1.37 ms).

  3. Server-Side LuaJIT Routing & Anti-Fraud (< 0.2 ms):
    Execute atomic multi-step operations (least-loaded media relay selection, balance validation, concurrency limit enforcement) inside Tarantool in 70 µs – 0.2 ms via tarantool_call().

  4. Zero-Allocation Data Path (CACHEDB_CAP_GET_BUF):
    Implements tarantool_get_buf for single-pass in-place MessagePack decoding directly into caller memory buffers, avoiding heap allocations.


⚙️ Module Features:

  • Full OpenSIPS 3.x cachedb_funcs_t interface implementation (get, set, remove).
  • High-throughput connection pool with automatic recovery and TCP keepalive.
  • Zero external dependencies (embedded msgpuck.h).
  • Automated unit tests in modules/cachedb_tarantool/test/.
  • Canonical OpenSIPS Markdown documentation in modules/cachedb_tarantool/README.md.

📊 Reproducibility

Architecture, full matrix benchmarks, and live demo instructions are documented at lean1ee/tarantool-voip-backend.

Implement cachedb_tarantool module providing high-performance In-Memory CacheDB storage engine for OpenSIPS 3.x using native Tarantool 3.x IProto.

Key features:

- cachedb_funcs_t interface implementation: set, get, get_buf, remove, raw_query, and session lifecycle management.

- URL parser supporting tarantool://user:pass@host:port/space connection strings and TCP keepalive options.

- 7-field schema layout conforming to rtpe_calls space for transparent cross-stack synchronization with RTPEngine and Kamailio.

- ISO C99 variadic macros for structured logging (LM_ERR/LM_WARN/LM_DBG).

- Dynamic memory safety verified under AddressSanitizer (ASan), UBSan, and LeakSanitizer (LSan) with 0 leaks and 0 errors.
@lean1ee
lean1ee force-pushed the feature/cachedb_tarantool branch from 0e04b61 to 81a9f2d Compare September 1, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant