NEW RasterizedDB 1.1.0 is out: sharding and the gateway, the message broker, roles and row-level security, compression, .NET on NuGet, and the enterprise edition. What's new ›
RASTCP

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.

TLS 1.3SCRAM-SHA-256 + CHANNEL BINDINGUNIX SOCKETSMULTIPLEXEDTYPED ANSWERS
12 s cycle

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.

caller 1 caller 2 caller 3 caller 4 caller 5 caller 6 MuxClientone dial for all ONE TLS 1.3 CONNECTION · ALPN rastcp/2 #7#3#12#9#4#15 #4#7#15#3#9#12 answers return as they finish, matched by id SERVER · ONE TASK PER REQUEST request #7 · point readrequest #3 · point readrequest #12 · scanrequest #9 · insertrequest #4 · point readrequest #15 · group by len u32 id u32 kind u8 payload: statement, or a typed answer
  1. 1
    ALPN picks rastcp/2

    The client offers rastcp/2 in the TLS handshake (or the preamble on a socket). Old clients keep rastcp/1.

  2. 2
    Frames get ids

    Each request is a tagged frame: length u32, id u32, kind u8, payload. Callers never wait for each other to send.

  3. 3
    Interleaved on one link

    Frames from every caller share one TLS stream; one dial serves everyone waiting on it.

  4. 4
    Handled concurrently

    The server runs each request as its own task, up to 256 in flight per connection.

  5. 5
    Answers out of order

    A fast point read overtakes a slow scan. The id puts each answer back with its caller.

  6. 6
    Fewer 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.

1.26Mecho req/s, 64 callers on one multiplexed connection (0.73M on 64 plain ones)
18,400 → 2,300server cycles per request, plain vs multiplexed (echo)
67 → 56 µsp50 of one native point query, TCP vs unix socket
~83kserver instructions per point query, the cheapest of the four protocols (16 clients)
Point query by key, 16 clientsserver k-instructions / query
rastcp, EXEC with parameters83
rastcp, text85
PostgreSQL wire, prepared89
PostgreSQL wire, text92

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.

CLIENT

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 →
main.rs
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?;
✓ page rendered in 138 µs axum + tera + htmx · no other javascript