Overview
Roomzin is a distributed in-memory inventory engine designed for booking workloads.
The application uses one logical inventory endpoint. Routing, shard topology, replication, and node failures are handled internally.
Why Booking Inventory Is Different
Booking queries combine availability, dates, geography, room types, pricing, amenities, and policies. Roomzin uses a fixed schema and specialized in-memory execution to make these queries predictable.
Platform Architecture
Request Flow
- SDK / RzProxy — client access
- Edge Router — routes requests to the appropriate zone
- Zone Router — routes requests to the appropriate shard
- RzBridge — routes within the shard
- Roomzin — executes the query
Applications do not need to know the active zone, shard, node, or leader.
Access Layer
SDKs
Supported SDKs:
Characteristics:
- Native binary protocol
- Connection pooling
- Asynchronous request/response
RzProxy
HTTP/JSON interface for legacy or non-native clients.
- Independently deployable
- Horizontally scalable
- Prometheus metrics
- HTTP/2 API
Routing Layer
RzRouter
One binary with two operating modes.
Edge Mode
- Client-facing entry point
- Routes requests to the appropriate zone
- Uses synchronized routing tables
Zone Mode
- Runs inside a zone
- Routes requests to the appropriate shard
- Uses RzBridge for shard-level routing
Routing occurs directly in the request path. No external proxy is required.
Bridge Layer
RzBridge
Shard-aware connector between routers and Roomzin nodes.
RzBridge knows:
- Nodes belonging to the shard
- Current shard leader
- Available followers
Routing:
Reads → Followers
RzBridge isolates shard topology from the routing layer.
Leader changes and node failures do not require application-level topology changes.
Storage Layer
Roomzin
Roomzin is an in-memory inventory engine.
The hot booking window is stored in memory and organized into replicated shards.
The query engine is optimized for:
- Geography
- Dates
- Availability
- Room type
- Price
- Amenities
- Policies
Each shard contains the complete dataset for that shard.
Query Execution
Fixed Schema
Booking attributes use fixed-size representations.
Attributes are represented as a bitmasks and numbers.
Benefits:
- Bitwise filtering
- SIMD-friendly execution
- No string comparisons
- No runtime hash lookups
- Compact memory layout
- Cache-friendly access
↓
bitmasks and numbers
↓
bitwise filtering
Maximum: 24 boolean attributes per each daily package.
Numeric Encoding
Human-readable values are converted to numeric identifiers during ingestion.
"Hilton" → 16-bit ID 142
The query path operates on integers.
There is no runtime parsing or string interning.
Geospatial Indexing
Roomzin uses H3 for geographic indexing.
- Hierarchical hexagonal grid
- Numeric cell identifiers
- Radius/area filtering
- Variable geographic resolution
- No tree traversal in the query path
Segment-Based Execution
Inventory is partitioned into independent segments.
│
├── Segment A → Core 1
├── Segment B → Core 2
├── Segment C → Core 3
└── Segment D → Core 4
Properties:
- Independent processing queues
- No cross-segment locking
- No cross-segment synchronization
- Large segments can be split across cores
- CPU/core pinning for cache locality
Segments execute in parallel and results are combined after processing.
Request / Response Pipeline
Roomzin uses independent request and response streams.
Request stream
Clients can send multiple requests without waiting for previous responses.
Response stream
Responses are returned asynchronously and may arrive out of order.
Each request contains a correlation ID.
Request 2 ─────┼──→ Processing
Request 3 ─────┘
Response 2 ←──────
Response 1 ←──────
Response 3 ←──────
This avoids connection-level head-of-line blocking.
Replication
Each shard is a Raft cluster.
Leader
- Handles writes
- Replicates state through Raft
Followers
- Hold the complete shard dataset
- Serve reads
Full Replication
Every node in a shard contains the complete shard dataset.
Therefore:
- Reads do not require cross-node joins
- Any follower can serve any read
- Read capacity increases by adding followers
- Shard queries require no distributed coordination
Persistence
Roomzin uses lock-free snapshots for persistence.
Implementation uses Rust atomic references and copy-on-write.
Current characteristics:
| Metric | Value |
|---|---|
| Snapshot pause | 4–10 ms |
| 60M record load | ~3 seconds |
| Snapshot size | ~90MB for 5.3GB of raw data |
Snapshot creation does not block query execution.
Global Distribution
Roomzin distributes inventory through zones and shards.
├── Zone A
│ ├── Shard 1
│ └── Shard 2
│
├── Zone B
│ ├── Shard 3
│ └── Shard 4
│
└── Zone C
├── Shard 5
└── Shard 6
Routing tables determine:
Segment → Zone → Shard → Node
The application only sees the logical Roomzin service.
Control Plane
RzID
Lightweight service registry.
Responsibilities:
- Component registration
- Heartbeats
- Topology management
- Segment → shard ownership
RzID is not on the request hot path.
RzPoint
Customer-provided HTTP service for resolving logical service identities to hostnames.
Works with:
- VMs
- Kubernetes
- Cloud infrastructure
- Custom infrastructure
RzPoint separates logical service identity from physical deployment.
Network Protocols
| Connection | Protocol |
|---|---|
| SDK / RzProxy ↔ Cluster | TCP |
| Roomzin Node ↔ Node | QUIC |
| RzProxy API | HTTP/2 |
| Discovery / RzPoint | HTTP |
Core Technologies
- Rust — Roomzin implementation
- TiKV Raft — consensus and replication
- Tokio — asynchronous runtime
- QUIC — internal node-to-node transport
- H3 — geospatial indexing
Architectural Constraints
Roomzin intentionally limits the query model.
- Maximum 24 attributes for room policy and rates
- Fixed schema
- Numeric-only query execution
- Full replication within a shard
- No distributed joins within a shard
- Hot booking window held in memory
These constraints are part of the execution model rather than configuration options.
Architecture Summary
Key properties:
- Fixed-size data representation
- In-memory execution
- Parallel segment processing
- Full shard replication
- Raft-based consistency
- Follower read scaling
- Topology-aware routing
- Lock-free snapshots
- Asynchronous request/response
- Custom binary protocol
Benchmarks
Run Roomzin against real booking inventory data.