Squirix 0.2.0-preview.1 swaps ASP.NET Core for a custom binary TLS protocol

Squirix · Software: Squirix 0.2.0-preview.1 swaps ASP.NET Core for a custom binary TLS protocol

In version 0.2.0-preview.1 the Squirix cache library drops its ASP.NET Core web host and gRPC layer, moving to a hand‑rolled binary protocol over TLS that runs directly on sockets.

From Kestrel and gRPC to raw sockets

Early previews of Squirix were built as ASP.NET Core applications where Kestrel accepted connections and a shared .proto file defined the gRPC contract between client SDK and server. This arrangement let the author focus on replication logic while the web stack handled transport and serialization.

For the 0.2.0-preview.1 milestone the author wanted a cheaper path for cache reads – a short string already in memory – and therefore began extracting the request‑reply handling from the web framework.

New binary protocol and TLS handling

The SDK was the first component to migrate. It now talks to the server over a custom binary protocol wrapped in TLS, while the server still ran on Kestrel during the transition. The binary transport lets the server batch multiple ready replies in a single buffer and flush once, eliminating idle timers that gRPC introduced for request coalescing.

Node‑to‑node communication also moved off gRPC to a mutual‑TLS binary channel, removing the last internal gRPC dependency and requiring a coordinated upgrade across the whole cluster because the peer protocol changed.

After the switch, the .proto files, the gRPC build tools and the Google.Protobuf runtime were removed, replaced by a lightweight codec that formats cache replies as an eight‑byte header followed by the optional payload.

Runtime and deployment impact

Even after shedding the web stack, Squirix still starts as a console application that opens its own sockets and uses .NET’s SslStream for TLS. Health checks and Prometheus metrics keep using HTTP/1.1 over TLS on a dedicated management address.

Dropping the ASP.NET Core shared framework forced the project to take over background‑worker management, service lifetimes and logging. The readiness probe now inspects journal recovery and replica state, while bearer‑token validation was moved out of ASP.NET’s JWT middleware, allowing the removal of the Generic Host, health‑check and OpenID Connect packages from the runtime image.

The final Docker image is based on the slim `dotnet/runtime:10.0.15` base instead of the full SDK, reflecting the reduced dependency set.

Allocation and performance implications

CI runs on Ubuntu with .NET 10 measured managed allocations for short‑string reads and writes against a single node with persistence disabled. The reported numbers show a lower allocation budget after the binary transport was introduced, though the tests still used Protobuf for payload encoding.

Because the server writes the header and encoded value directly into the output pipe, no temporary byte array is needed for the reply. On a cache miss the server emits only the eight‑byte header; on a hit it appends the value in the same buffer, further reducing memory churn.

Why the rewrite matters for .NET cache developers

The transition from a heavyweight ASP.NET Core host to a minimal socket‑based server gives developers tighter control over latency and memory usage, two factors that often dominate caching performance at scale. By owning the protocol, Squirix can customize how cache misses are encoded, decide exactly when to flush data, and handle partial client disconnects without relying on framework‑level defaults. This flexibility is especially relevant for high‑throughput microservice environments where the overhead of gRPC‑generated code and the generic host can become noticeable. At the same time, the move adds operational complexity: teams now need to manage TLS certificates for both client‑server and peer‑to‑peer links, and the custom codec means they lose the automatic versioning and tooling that gRPC provides. The new Docker base image reduces container size, but the removal of built‑in health‑check and JWT middleware requires developers to replicate those features themselves. Overall, the rewrite positions Squirix as a more performance‑focused cache option for .NET teams willing to take on the additional responsibility of a bespoke networking layer.

Cover: AI-generated illustration with headline text; not a documentary photograph.

Source: Why Squirix shed its web stack · Why Squirix shed its web stack · Squirix Blog

Share this article
FacebookThreadsLinkedInX

Leave a Reply

Your email address will not be published. Required fields are marked *