Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 3.18 KB

README.md

File metadata and controls

68 lines (48 loc) · 3.18 KB

zzz

zzz logo

Installing

Latest Zig Stable: 0.13.0

Latest zzz release: 0.2.0

zig fetch --save git+https://github.com/mookums/zzz#v0.2.0

You can then add the dependency in your build.zig file:

const zzz = b.dependency("zzz", .{
    .target = target,
    .optimize = optimize,
}).module("zzz");

exe.root_module.addImport(zzz);

zzz?

zzz is a framework for writing performant and reliable networked services in Zig. It supports both HTTP and HTTPS (using BearSSL for TLS).

zzz currently supports Linux, Mac and Windows. Linux is currently the recommended target for deployments.

Important

zzz is currently alpha software and there is still a lot changing at a fairly quick pace and certain places where things are less polished.

It focuses on modularity and portability, allowing you to swap in your own implementations for various things. Consumers can provide an async implementation, allowing for maximum flexibility. This allows for use in standard servers as well as embedded/bare metal domains.

For more information, look here:

  1. Getting Started
  2. HTTPS
  3. Performance Tuning
  4. Custom Async

Optimization

zzz is very fast. Through a combination of methods, such as allocation at start up and avoiding thread contention, we are able to extract tons of performance out of a fairly simple implementation. zzz is quite robust currently but is still early stage software. It's currently been running in production, serving my site.

With the recent migration to tardy, zzz is about as fast as gnet, the fastest plaintext HTTP server according to TechEmpower, while consuming only ~22% of the memory that gnet requires.

benchmark (request per sec)

Raw Data

benchmark (peak memory)

Raw Data

On the CCX63 instance on Hetzner with 2000 max connections, we are 70.9% faster than zap and 83.8% faster than http.zig. We also utilize less memory, using only ~3% of the memory used by zap and ~1.6% of the memory used by http.zig.

zzz can be configured to utilize minimal memory while remaining performant. The provided minram example only uses 256 kB!

Features

  • Built on top of Tardy, an asynchronous runtime.
  • Modular Asynchronous Implementation
    • io_uring for Linux (>= 5.1.0).
    • epoll for Linux (>= 2.5.45).
    • kqueue for BSD & Mac.
    • busy_loop for Linux, Mac and Windows.
  • Single and Multithreaded Support
  • TLS using BearSSL
  • Memory Pooling for minimal allocations

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in zzz by you, shall be licensed as MPL2.0, without any additional terms or conditions.