Technical Deep Dive

How Roomzin achieves sub-millisecond searches at scale—without magic

Roomzin

Roomzin Cluster Architecture

🎯 Core Concepts

  • Leader — Handles writes only
  • Followers — Handle reads only
  • RzGate — HTTP proxy for non-SDK clients
  • Discovery — Address Resolution

🔌 Connection Protocols

  • TCP — SDK/RzGate ↔ Cluster nodes
  • QUIC — Raft consensus (node ↔ node)
  • HTTP/2 — Rzgate API | External Discovery

📋 Client Options

  • SDK Clients — Direct TCP connection to nodes
  • HTTP Clients — Connect via RzGate
  • Both are Topology-aware

🔍 Discovery Mechanism

  • All components query Discovery service
  • Returns node id to address mappings
  • Static: YAML file with node addresses
  • Dynamic: HTTP server with 3 endpoints

✨ Key Benefits

  • Zero client routing — SDKs/RzGate handle all request routing
  • RzGate scalable — Independent horizontal scaling
  • Leader isolation — Doesn't serve reads
  • Read distribution — All followers serve reads

The Engineering Behind the Speed

Roomzin's speed stems from a unique combination:

innovative architectural patterns, intentional trade-offs, and a domain-specific design.

Unlike generic systems, it's built exclusively for booking platforms—eliminating unnecessary complexity while optimizing for real-world performance.

Core Architectural Innovations

High-performance patterns enabling microsecond response times

PERFORMANCE

Fixed Schema = Bitmap Magic

All booking terms—like cancellation policies and included amenities—are efficiently stored as a 24-bit feature set.

Impact

  • Amenity filtering = bitwise AND (single CPU cycle)
  • No string comparisons or hash lookups
  • SIMD-able for multiple properties at once
MEMORY

String Elimination

All strings are converted to numeric IDs at ingest time:

"pool"
bit position 2
"Hilton"
16-bit ID: 142
GEOSPATIAL

H3 Hexagonal Grid Search

Uses Uber's H3 library for O(1) radius searches instead of O(log n) R-tree lookups.

PARALLELISM

Segment-Based Parallelism

Data is partitioned into segments (e.g., "paris_north", "paris_south") that operate independently.

Each segment has its own processing queue

Paris' 1,800 hotels → 5 segments = 5x CPU utilization

No cross-segment locking or coordination

QUEUING

Write Priority Streams

Decoupled read and write channels with priority queuing ensure writes never starve.

Write Channel
Priority Queue
Read Channels
Best-Effort
NETWORK

QUIC Protocol Layer

Modern transport protocol replacing TCP for secure, multiplexed node-to-node communication.

Zero-RTT handshake for fast connections
Native stream multiplexing
Built-in TLS 1.3 encryption
PROTOCOL

Custom Binary Protocol

Zero-parsing wire format (not HTTP/JSON) optimized for microsecond latencies.

Parsing Overhead Zero
Payload Size Much smaller
CLUSTERING

Full Replication Cluster

Complete data replication across all nodes with no sharding overhead.

No cross-node joins required

Consistent 1-2ms reads on follower nodes

All nodes contain complete dataset

PERSISTENCE

Lock-Free Snapshots

Snapshots use Rust's atomic references and copy-on-write for zero-downtime persistence.

Snapshot Pause Time 4-10ms
60M Records Load Time 3 seconds
Snapshot Size vs Raw Data ~15%

Deliberate Trade-offs

Constraint

Max 24 booking terms—like cancellation policies and included amenities

Benefit

Bitmask encoding enables SIMD and single-cycle filtering

In practice, this cap is much higher than real-life needs of booking platforms use cases.

Production Architecture

Foundation Layer

TiKV Raft Core

Battle-tested consensus from CNCF-graduated TiKV project.

  • Single-digit ms leader election
  • Strong consistency guarantees
  • Same reliability as etcd

Tuned Tokio Server

Custom-configured async runtime for high-throughput TCP.

  • 10k+ concurrent connections per node
  • Zero-copy binary protocol
  • Separate system/worker thread pools

Performance Layer

Adaptive Parallel Processing

Intelligent workload distribution across CPU cores.

  • Data automatically partitioned for parallel execution
  • Processors pinned to CPU cores when beneficial
  • Zero cross-processor synchronization overhead

QUIC Transport

Modern transport protocol with built-in encryption.

  • 0-RTT connection resumption
  • Stream multiplexing
  • Head-of-line blocking prevention

Complete Stack Integration

Roomzin integrates these battle-tested components into a cohesive system optimized for booking workloads.

Consensus

TiKV Raft ensures data consistency across cluster

Networking

Tokio + QUIC handle 10k+ connections with minimal latency

Processing

Adaptive partitioning delivers predictable performance

Intelligent Data Partitioning

Automatic Load Distribution
1
Segment: Paris North
360 properties • Assigned to Processor 1
Processor 1
2
Segment: Paris South
420 properties • Assigned to Processor 2
Processor 2
3
Segment: Paris Central
510 properties • Assigned to Processor 3
Processor 3
N
Large Segment
Multiple processors • Load-balanced
P 4
P 5
CPU Cores:
0
1
2
3
Smart Workload Distribution
1

Flexible Processor Allocation

Each logical processor can handle multiple segments if needed, or large segments can be split across multiple processors

2

CPU-Aware Scheduling

Processors are pinned to CPU cores for cache efficiency, but multiple processors can share a core when necessary

3

Automatic Load Balancing

The system intelligently partitions data within segments to ensure even distribution across available processors

💡

Key Insight: Roomzin adapts to your hardware

Whether you have 4 cores or 64 cores, the system automatically optimizes processor allocation for maximum throughput

Smart SDK & Protocol Architecture

Intelligent SDKs

1

Topology-Aware Routing

SDKs automatically discover cluster layout and route requests to optimal nodes

2

Automatic Failover

Leader election? Node down? SDKs reroute instantly—no code changes needed

3

Built-in Load Balancing

Reads go to fastest follower, writes to leader—all handled automatically

SDK Connection Flow
SDK
Connect to
any node
Fetch cluster
topology
Build
routing map
Auto-route requests
based on latency & role

Decoupled Request/Response Channels

Unlike traditional request/response blocking, Roomzin uses fully decoupled channels for maximum throughput.

Traditional Blocking

1
Client sends request
2
Connection blocks waiting
3
Server processes request
4
Server sends response
5
Client can send next request

Inefficient: Connection idle while processing

Roomzin Decoupled Channels

R
Request Stream: Client sends multiple requests
P
Processing: Server processes in parallel
D
Demux: Responses routed to correct callers
S
Streaming: Responses arrive out-of-order, async

Efficient: Full pipeline utilization

💡

How It Works

Client-side: Each request gets a unique correlation ID. SDK maintains request/response mapping.

Server-side: Separate threads handle requests and responses. No blocking, pure async processing.

Result: 10k RPS with predictable latency, even with mixed request sizes

Enterprise Context: Shard Isolation

In large booking platforms, data is sharded by region or zone. Each shard runs its own Roomzin cluster.

Shard = Independent Cluster

Each geographical region runs its own Roomzin cluster with full HA. SDKs only need to know their shard's nodes.

No Cross-Shard Communication

Like Redis deployments, each shard is isolated. Traffic stays within the shard for lowest latency.

Why This Matters for Booking Platforms

Revenue Impact

Every 100ms faster = 1-3% more conversions

Roomzin cuts 150ms → 2ms = potential 4-12% revenue lift

Zero overbooking during flash sales

Strong consistency prevents double bookings under load

Handle Black Friday traffic spikes

Predictable performance at 25k RPS per shard

Operational Impact

Eliminate cache debugging

No more TTL mismatches, invalidation storms, or cache stampedes

70% less infrastructure

Replace Redis cluster + DB tuning + application logic with one binary

Developer time reallocated

Instead of cache layer maintenance, build new features

Ready to See It in Action?

The best way to understand Roomzin is to run your own benchmarks. Download the benchmark tool and test against your real workload.