Lightstream
High-throughput, composable table transport for Arrow-compatible data. Move tables between processes, services and storage without adopting gRPC or writing transport-specific framing.
[]
= { = "0.5.0", = ["tcp", "mmap", "zstd"] }
Quick start
Receiver
use StreamExt;
use TcpTableReader;
let mut reader = connect.await?;
while let Some = reader.next.await
Sender
use TcpTableWriter;
let mut writer = connect.await?;
writer.write_table.await?;
writer.finish.await?;
Other transports (HTTP/2, QUIC, WebSocket, UDS, files, memory maps) expose the same table-oriented interface.
Why
- One model, many transports. Identical table APIs across TCP, HTTP/2, QUIC, WebSocket, Unix sockets, files, memory maps and chunked datasets.
- Fast paths preserved. Minarrow's 64-byte-aligned buffers flow through supported transports zero-copy.
- Composable layers. Encoding, framing, buffering and transport remain independent — use complete readers/writers or assemble lower-level codecs directly.
- Practical optionality. TLS, compression (zstd/snappy), decode limits for untrusted input, Linux
io_uring, minimal dependencies.
Performance
| Workload | Throughput |
|---|---|
| TCP streaming (parallel) | ~8.0 GiB/s |
| TCP streaming (serial) | ~5.0 GiB/s |
UDS with io_uring |
~5.5 GiB/s |
| Arrow IPC file read | ~9 GiB/s |
| Memory-mapped Arrow IPC (warm) | ~170 GiB/s |
Lightstream typically outperforms Arrow-rs file readers by ~30% and Arrow Flight by ~60% on cross-host benchmarks. See benches/README.md for detailed methodology.
Capabilities
Transports: TCP, Unix domain sockets, HTTP/2, QUIC, WebSocket, WebTransport, standard I/O, io_uring.
Formats: Arrow IPC (file and stream), CSV, JSON, NDJSON, Parquet, TLV framing, memory maps, chunked datasets.
Protocol: Lightstream message multiplexing for Arrow tables, Protobuf and MessagePack over one connection.
Advanced: Parallel streams across TCP/QUIC/HTTP/2 with optional global ordering, compression, TLS, configurable decode safety.
Common patterns
Compression
Compress tables before sending or writing to disk.
use Compression;
let writer = connect.await?;
Memory-mapped Arrow IPC
The mmap reader is very fast. Warm mmap rivals standalone RAM speed, as it gets out the way. Try the benchmark.
use MmapTableReader;
let reader = open?;
for i in 0..reader.num_batches
Lightstream protocol (multiplex protobuf messages and arrow tables)
use TcpLightstreamConnection;
use LightstreamMessage;
let mut conn = from_tcp;
conn.register_message;
conn.register_table;
conn.send.await?;
conn.send_table.await?;
while let Some = conn.recv.await
Parallel streams
TCP, QUIC and HTTP/2 readers and writers distribute tables across multiple connections, aggregating throughput beyond single-flow limits. Readers can restore global send order or return items in arrival order.
The Lightstream protocol automatically provides total ordering across fanned out parallel streams. See the benchmarks for an example.
TLS
Enable the tls feature for TCP, WebSocket and HTTP/2. QUIC and WebTransport include TLS at the protocol level.
let writer = connect_tls.await?;
Examples
Feature flags
| Feature | Description |
|---|---|
tcp |
TCP transport |
http |
HTTP/2 transport |
quic |
QUIC transport |
websocket |
WebSocket transport |
uds |
Unix domain sockets |
stdio |
Standard I/O |
webtransport |
WebTransport (experimental) |
mmap |
Memory-mapped Arrow IPC |
csv, json, parquet |
File format support |
zstd, snappy |
Compression |
protocol |
Lightstream message multiplexing |
msgpack, protobuf |
Message encodings (enables protocol) |
tls |
TLS for TCP, WebSocket, HTTP/2 |
io_uring |
Linux async I/O (experimental) |
datetime, large_string, extended_numeric_types |
Schema extensions |
Buffering and safety
Streaming decoders use a per-stream arena reserving 2 GiB of virtual address space (configurable via LIGHTSTREAM_ARENA_CAPACITY). Physical memory is committed only as data arrives. Decode paths validate all input and enforce configurable limits on frame size, schema dimensions, strings, allocations and decompressed data.
Architecture
| Layer | Components |
|---|---|
| Table API | Transport, parallel and chunked readers and writers |
| Protocol | Lightstream message multiplexing |
| Formats | Arrow IPC, CSV, JSON, Parquet, TLV |
| Framing | IPC messages, TLV frames, WebSocket frames |
| Encoding | One-shot codecs, stream encoders and decoders |
| Buffering | Vec<u8>, Minarrow Vec64<u8> and stream arenas |
| Transport | TCP, UDS, stdio, WebSocket, HTTP/2, QUIC, WebTransport, io_uring |
| Storage | Files, memory maps, chunked directories, async disk |
Applications can use complete readers and writers or assemble lower-level components directly.
Licence
Mozilla Public License 2.0. © 2025–2026 Peter Garfield Bower.
Maintained by SpaceCell.