The shortest path
into the engine.
rastcp is RasterizedDB's own protocol: binary, typed, multiplexed, over TLS 1.3 or a unix socket. Statements go straight to the executor with no PostgreSQL translation in between, which makes it the cheapest of the four ways in.
rastcp/2: many callers, one connection
Chosen by ALPN. Every frame carries an id, so hundreds of unrelated callers share one TLS connection, the server runs their requests concurrently, and answers come back in whatever order they finish.
- 1ALPN picks rastcp/2
The client offers rastcp/2 in the TLS handshake (or the preamble on a socket). Old clients keep rastcp/1.
- 2Frames get ids
Each request is a tagged frame: length u32, id u32, kind u8, payload. Callers never wait for each other to send.
- 3Interleaved on one link
Frames from every caller share one TLS stream; one dial serves everyone waiting on it.
- 4Handled concurrently
The server runs each request as its own task, up to 256 in flight per connection.
- 5Answers out of order
A fast point read overtakes a slow scan. The id puts each answer back with its caller.
- 6Fewer cycles per request
One connection instead of 64: in the transport benchmark, server cycles per request fell from 18,400 to 2,300.
Capabilities.
Two wire versions
rastcp/1 carries one caller's statements in order, for transactions. rastcp/2, chosen by ALPN, tags every frame with an id so unrelated callers share one connection. Old clients keep working.
Security that binds
TLS 1.3 on TCP, always. SCRAM-SHA-256 with mandatory tls-exporter channel binding (RFC 9266), so a login cannot be relayed through a man in the middle.
Unix sockets and peer auth
An 8-byte preamble names the version on a socket. Peer authentication maps the kernel's uid to a role; file permissions and a socket group are the access control. TCP can be turned off.
Transactions
BEGIN, COMMIT, ROLLBACK, savepoints and LOCK TABLE on rastcp/1. The client gives each transaction its own connection and retries serialization failures.
Database selection
Hello v2 names the database at login, checked against that database's own roles. A missing database is refused, never swapped for the default.
Typed binary answers
Each value arrives with a type tag, little-endian: integers, floats, NUMERIC with its scale, UUID, timestamps, JSON, arrays, bytea. No text to parse.
Learned statements
A repeated statement shape is learned: its parse, its description and, for a unique key, its index plan. The next run skips straight to the lookup.
Timeouts that keep the link
statement_timeout answers 57014 and the connection survives; a block fails with 25P02. Notices are negotiated, so old clients see the bytes they always saw.
Batching
The server answers every buffered request before it writes once, and the client can send a batch while reading answers.
Measured.
Two kinds of number. Transport benchmarks use an echo handler, so they measure rastcp itself and nothing else. Database numbers count the server's own instructions per query, which do not drift with machine load the way wall-clock time does.
| Point query by key, 16 clients | server k-instructions / query |
|---|---|
| rastcp, EXEC with parameters | 83 |
| rastcp, text | 85 |
| PostgreSQL wire, prepared | 89 |
| PostgreSQL wire, text | 92 |
Measured 2026-11-21 over unix sockets on the 1.0 development line, counting the server process's instructions with perf in the timed window only. MySQL and SQL Server clients are bridged through the PostgreSQL path inside the server, so they pay extra per row.
rasterizeddb_client
The Rust client speaks rastcp: typed queries, transactions, an ORM, migrations and the KV API, multiplexed by default. It does not compile the engine.
THE RUST SDKS →use rasterizeddb_client::prelude::*;
let client = Client::connect("unix:/run/rdb/rdb.sock", Options::default()).await?;
let open: Vec<(i64, String)> = client
.fetch_all("SELECT id, customer FROM orders WHERE store_id = $1", params![42i64])
.await?;