relic_native 2.0.0
relic_native: ^2.0.0 copied to clipboard
A Relic adapter backed by a Zig HTTP server on native I/O threads.
2.0.0 #
The first release of relic_native, a
Relic adapter on an HTTP server written in
Zig. It answers about five times the requests per second of relic_io. To
try it, add the package and call app.serveNative() where the program
called app.serve().
Benchmarks #
On a GCP c4d-standard-32 instance, 16 AMD EPYC 9B45 cores, one isolate
answers 295 thousand plaintext requests per second on relic_native and
61 thousand on relic_io. Over HTTPS it is 243 thousand and 25 thousand.
An idle WebSocket over TLS takes 14.8 KiB of the server's memory, and
61.6 KiB on relic_io. The
Relic changelog has the
other routes and how they were measured.
Features #
- Initial release:
NativeAdapter, a Relic adapter on a Zig HTTP server built on zio andstd.http.Server, which each isolate drives from its own thread.NativeExchange,NativeOptions,NativeTlsandserveNativego with it - HTTP/1.0 and HTTP/1.1 with keep-alive, streamed request and response
bodies, WebSockets and hijacked connections.
NativeOptionsholds the limits and timeouts,maxInlineBodyamong them, the body read before the handler runs - Several isolates serve one port: a
bindwith the samegroupjoins the server the first one created, and passes the sametls - HTTPS through
NativeTls, TLS 1.3 only: a certificate chain and a private key. The key is ECDSA, RSA or Ed25519 in PKCS#8 form, or a SEC 1 (EC PRIVATE KEY) or PKCS#1 (RSA PRIVATE KEY) one.passwordopens an encrypted key, a PKCS#8 key under PBES2 with PBKDF2 and AES-128 or AES-256 CBC, or one behind OpenSSL's DEK-Info headers.clientAuthoritiesnames the CAs a client certificate must chain to, and the handshake then requires one. ALPN selectshttp/1.1and refuses a client that offers only other protocols bindtakesv6Only, asIOAdapter.binddoes. Without it an IPv6 listener takes IPv4 clients- Prebuilt for Linux, macOS and Windows on x64 and arm64, so a project needs no Zig toolchain. The libraries use hardware AES for TLS. They need AES-NI, PCLMULQDQ and AVX on x64, and the ARMv8 crypto extensions on Linux and Windows arm64