UCall · Open source · Network engine · Unum

What if clients and servers shared One Engine?

One connection state machine over io_uring, epoll, kqueue and IOCP, encrypted with Noise instead of TLS.

One C ABI for C, C++, Python, Rust, Go and Mojo, with no OpenSSL, no async runtime and no threads of its own. Python handlers at 3.7× FastAPI’s rate across two Graviton4 machines.

Open Source Use with your agent

Get started

The FastAPI handler, served from C.

Decorate a typed function, and UCall binds its parameters from the request.

Read the UCall docs

Python

import ucall

server = ucall.Server(ucall.Interface('0.0.0.0:8000'))

@server.get('/sum')
def sum(a: int, b: int):
    return a + b

server.run()

pip install ucall; parameters bind in C and the handler answers on the polling thread.

01 · Sync handlers

Asynchronous I/O, synchronous handlers.

No async, no await, no futures in your code.

A request often costs less to compute than to carry: the packets between an application and its network card cross several context switches and kernel calls. UCall hides that latency under io_uring, epoll and kqueue, and keeps the handler an ordinary function, with no async, await or futures.

UCall creates no threads. The application owns each event loop’s polling thread and runs its handlers there, so no event loop or coroutine sits between the socket and a Python handler. A first stop drains every request already held, and a second cuts what remains.

Fig. 1.1Python handlers at 3.7× FastAPI’s rate across two Graviton4 machines

UCall’s Python handlers serve 395,669 tool calls a second, 3.7 times FastAPI and 11 times Python gRPC. When a Rust server also acts as a client, calling 8 upstream servers for every tool call, UCall makes 854,288 upstream calls a second to actix-web’s 628,864 and axum’s 451,880. At 65,536 open connections, UCall holds 13.8 KB per connection, against 33.7 to 38.3 KB for actix-web, axum and tonic.

Two Graviton4 machines 4 server cores per card Python handlers tool calls/s, 1 KB of JSON in and 256 B out UCallPython 396K FastAPIPython · Uvicorn 108K gRPCPython 36.0K Rust servers calling 8 upstreams per tool call upstream calls/s UCallRust 854K actix-webRust 629K axumRust 452K Memory at 65,536 connections KB per connection, less is better UCallRust 13.8 actix-webRust 38.3 axumRust 33.7 gRPCRust · tonic 35.5
Two c8gn.metal-48xl, one driving the other over two 300 Gbit cards each
02 · Noise

TLS is a standard too large to embed.

One handshake, one cipher suite, no certificates.

TLS is the Internet’s encryption standard, and a massive one: several versions, dozens of cipher suites, countless options and a certificate chain to manage for every service. Integrating it cleanly through OpenSSL, BoringSSL, LibreSSL and mbedTLS failed twice in two years.

UCall speaks the Noise Protocol Framework beneath HTTP, addressed as http+noise://, with the XX, IK and KK handshakes and exactly one suite: Curve25519, AES-256-GCM and SHA-256. The cipher and hash run on StringZilla’s kernels and each CPU’s cryptographic instructions, with no OpenSSL, libsodium or third-party Noise. Static keys replace certificates, and a server admits its peers by key.

Fig. 2.1One round trip either way, and only TLS negotiates

TLS 1.3 offers suites and proves a certificate chain on every connection. Noise IK starts from a key the client already knows and settles a post-quantum session in one round trip.

Scroll horizontally to explore →

Negotiates its version, cipher suite, group and signature scheme on every connection.

Fixes one suite, Noise_IKhfs_25519+MLKEM768_AESGCM_SHA256, so nothing is negotiated.

Trusts a certificate chain up to a CA in the client’s store, renewed before it expires.

Trusts the server’s static key, which the client knows before it dials.

Sources: RFC 8446 · The Noise Protocol Framework

Fig. 2.2Noise keeps 80% of plaintext’s rate, 2.8× TLS 1.3 behind nginx

The TLS baseline is nginx terminating TLS 1.3 in front of the same plaintext server, the way deployments behind a proxy run. Across two Graviton4 machines, Noise adds 1.3 µs of server CPU to a kept-alive call, about what TLS 1.3 adds inside actix-web and axum, 1.5 and 1.3 µs.

Requests a second, 1 KiB over kept-alive connections
UCall plaintext 366,722
UCall Noise IK 292,451
UCall Noise XX 290,926
nginx plaintext proxy 141,445
nginx TLS 1.3 proxy 105,547

Measured on Intel Core i9-13950HX · one server thread · one nginx worker · two c8gn.metal-48xl, two 300 Gbit cards each, 4 server cores per card · Sources: UCall Noise cost

03 · Batching

Client-side batching is not server-side batching.

Gather requests across clients, answer each on its own.

A client-side batch is one request from one client, which the server must split, dispatch and reassemble. GPU inference and analytical queries want the opposite: many small requests from many clients, computed together.

A batch endpoint gathers independent requests from every connection and every event loop into one queue, closed by size and latency budgets, and the endpoint’s one polling owner, a thread the application picks and the library claims, takes each batch as a counted array. Every request keeps its own reply and transaction boundary, and pipelining lets one client fill a batch while its replies still leave in request order.

Fig. 3.1Eleven requests, two model calls

An illustration: a model call costs 120 µs alone, and a batch endpoint takes up to 8 requests and lets none wait past 500 µs. Batched, the model runs for 460 µs instead of 1,320, and the last reply leaves 340 µs sooner.

Scroll horizontally to explore →

04 · Every OS

One state machine on every operating system.

POSIX, epoll, io_uring, kqueue, IOCP and RIO.

Shared connection automata consume completions and emit I/O requests, so POSIX, Linux epoll with AIO, io_uring, macOS and FreeBSD kqueue, and Windows IOCP and Registered I/O drive the same HTTP framing, routing and Noise records. Each CPU class gets its own instantiation of every engine, picked once in the configuration rather than per call.

Header normalization and searches run on StringZilla, capability checks and atomics on ForkUnion, and containers on SmashTable. One event loop serves one core, and loops add up linearly: across two Graviton4 machines with two 300 Gbit cards each, 8, 16 and 32 server cores serve 1,771,397, 3,707,284 and 7,456,078 pipelined calls a second.

Fig. 4.1Seven backends, two ways to wait on the kernel

Readiness

The kernel reports which sockets are ready, and every read and write is a system call of its own.

  • poll POSIX
  • epoll Linux
  • kqueue macOS & FreeBSD

Completion

The application hands the kernel its buffers up front and collects finished operations in batches.

  • io_uring Linux 6.12 & 6.18
  • IOCP Windows
  • RIO Windows
05 · Zero copy

Requests read in place, large replies leave without a copy.

Borrowed views in, zero-copy sends out.

Paths, queries, headers and every multipart part arrive as views into the receive buffer, never copied, so an image or audio decoder reads a part where it landed, and a body whose length the head declares is received in place once it reaches a page. Routing is exact, as in axum and Envoy: literal segments before parameters before a trailing wildcard, a 404 for an unknown path and a 405 with an allow list for a wrong verb.

Files leave as byte ranges, read with O_DIRECT past the page cache into windows from the loop’s pool, the next window filling while the previous one sends. Replies of a page or more leave through zero-copy sends, and a reply can name the caller’s memory, pinned until the kernel releases it: across two Graviton4 machines, such memory parts cut the server CPU of a 256 KB download from 198.8 to 86.4 µs. Shorter replies and peers on the same host are copied, where a copy costs less than pinning, and under Noise each record seals in place inside its window.

06 · Questions

Before you swap your web framework

Protocols

Why HTTP/1.1 and not HTTP/2?

HTTP/2 multiplexes streams over one connection and compresses headers with HPACK. Its dynamic decompression tables and the nested state machine of every extended CONNECT stream widen the attack surface. UCall gets the throughput through pipelining and server-side batching instead.

Why TCP and not QUIC?

A QUIC-like protocol with Noise encryption is a natural fit, and building around UDP has been an ambition at Unum since 2015. TCP and HTTP/1.1 work with every load balancer, proxy and firewall already deployed, so UCall builds on them.

When would I prefer WebRTC?

On lossy networks. TCP holds every later packet back until a lost one is retransmitted, while WebRTC DataChannels offer message-oriented delivery with configurable reliability. On reliable networks, there is no noticeable difference.

Coming from elsewhere

What will I miss from FastAPI?

Its ecosystem of plugins for authentication, database integration and OpenAPI schema generation. Typed handlers, path parameters and greedy suffixes carry over, matched exactly as axum and Envoy match them.

What if I need TLS?

Deploy UCall behind a reverse proxy such as nginx or Envoy, which terminates TLS and forwards plaintext HTTP over a local interface, a common pattern in production. The docs carry a deployment template.

Which languages can call it?

C, C++, Python, Rust, Go and Mojo, all over one C ABI with the same caller-owned polling threads, on Linux, macOS, FreeBSD and Windows. The C++ SDK is header-only over the C headers.