ANYKS
RU
in developmentv5 branch · C++17

AWH — ANYKS Web Hub

Our own networking foundation, from the memory allocator to HTTP/3. One library instead of a stack of four dozen third-party ones. Written from scratch against the text of the standards, running on twelve operating systems, measured against the reference implementations of its field.

01 What it is for

The foundation networked software is built on

Any program that talks over a network — a website, a banking app, a telecom system, an industrial controller — is made of the same layers: memory handling, data parsing, encryption, exchange protocols.

Usually these layers are taken ready-made from different authors and stacked like a construction kit. AWH is the same set of layers, written entirely by us as one whole: one style, one error contract, one way of handling memory across the whole stack.

1.1 Mlines of our own code plus 300 K lines of tests
6,091automated tests on every system
LayerWhat it doesLines
Networking and enginesdata exchange with the operating system476,777
CodecsJSON, XML, YAML, TOML, INI, CSV, CEF, SysLog, ABC181,032
ProtocolsHTTP/1, HTTP/2, HTTP/3, QUIC, SOCKS591,835
System layerthreads, fibers, signals, time, files56,237
EncodingsUTF-8, conversions, hashes53,772
Regular expressionsour own PCRE2 replacement with code generation51,319
EncryptionGOST, TLS, key storage48,734
Numbers and memorybig-number arithmetic, our own allocator47,421
Ready-made nodesDNS, NTP, ICMP, tunnels, cluster, timers45,510
02 Scale of replacement

One part instead of forty

This is a list, not an estimate: every one of these libraries physically sits in the repository as a benchmark reference and runs on the same data as our code. The replacement is proven by numbers, not claimed.

Protocols

nghttp2nghttp3ngtcp2llhttphttp-parserpicohttpparserBoost.Beastls-hpackls-qpackquichelsquic

Data parsing

nlohmann/jsonRapidJSONsimdjsonyyjsonlibxml2Expatpugixmlrapidxmltinyxml2Xerceslibyamlyaml-cpprapidyamltoml++toml11inihlibcsvrapidcsv

Foundation

PCRE2jemalloctcmallocmimalloclibevlibeventlibuvlibiconvlibidn2BoringSSLA-NTS · ours

Only compression libraries stay external — zlib, zstd, lz4, brotli, lzma, bz2. They are narrow, interchangeable, and carry neither protocol logic nor cryptography.

03 Why our own

The cost of building from other people's parts

More expensive

Forty libraries mean forty styles, type systems and memory ownership rules. Every security update to one of them is a separate compatibility check against all the others. Forty licences, some restricting distribution.

Slower

Data is copied between layers because neighbouring libraries use incompatible representations. One blocks the thread, another doesn't; one allocates memory, another expects someone else's. A bug at the seam belongs to nobody.

Riskier

Updates come from outside and can stop at any moment. Auditing forty foreign code bases for backdoors is unrealistic. A vulnerability in one library is a vulnerability in the whole product, fixed on someone else's schedule.

A single foundation: protocol parsing reads straight from the input buffer with no copies, one decision log and one test system cover the whole stack, and we fix a bug in any layer ourselves, on our own schedule.

04 Measured

HTTP/3 and HTTP/2: share of the reference implementation

One hundred percent is the reference: nghttp3 and nghttp2, which run a large part of the internet. Right of the line means we are faster. Measured with each side's own drivers on the same machine, Release build.

HTTP/3 · vs nghttp3

100 % — reference
Decoding180 %
Exchange, one stream154 %
Request parsing152 %
Multiplexing144 %
Field compression113 %
Body receive100 %
Encoding82 %

HTTP/2 · vs nghttp2

100 % — reference
Decoding182 %
Request parsing129 %
Multiplexing122 %
Exchange, one stream121 %
Header compression117 %
Body receive97 %
Encoding70 %

Header encoding is a known weakness of both implementations: broken down step by step, seven changes have already improved it, the remainder is measured. Reports live in benchmark/proto/*/COMPARISON.md.

05 Measured

Predictability matters more than peak speed

The memory allocator is called millions of times per second. We are not the fastest, but we are the same on every system, while competitors scatter by two or three orders of magnitude. For telecoms, embedded and real-time systems evenness is worth more than a record: it lets you plan for the worst case, not the average.

AWH10.0–11.8
jemalloc35–650
system11–2563
1010010003000

Nanoseconds per operation, log scale. Bar width is the spread across operating systems. More about the allocator →

MeasureResult
Regex vs PCRE2machine code faster in 37 of 41 scenarios, interpreter behind in none of 45; median ratios 1.18 and 1.46
HTTP/1: body parsing1st of 6 — 20,607 MB/s
HTTP/1: headers3rd of 6 — twice as fast as nginx, http-parser and Beast
HTTP/1: allocationszero per message, with a stronger contract
GOST vs gost-enginecorrectness proven against the reference's numbers
06 Honest review

Where we fall behind and why

Nothing below is hidden: each item is measured, and its cause is established and written down.

WeaknessSizeCause and lever
QUIC vs ngtcp21.05× / 1.38×copying on receive vs zero-copy hand-off; the lever is known and the work is planned
HTTP/2 header encoding70 %analysed step by step, seven changes already gained; the rest is measured
HTTP/3 encoding82 %same cause as HTTP/2
Allocator vs tcmalloc7–15 %the price of predictability and fault-address analysis; jemalloc and system allocators beaten everywhere
Regex compilation0.44 of PCRE2a one-off operation outside the hot path; the price of two programs — forward and reverse — and deeper analysis of the expression

How the risks are covered: 6,091 tests on each of twelve systems, runs under memory and undefined-behaviour sanitizers, fuzzers on protocol and data parsing, and a log of deliberate decisions where every departure from the obvious is recorded with its reasoning and pinned by a test.

07 Portability

Five kernel mechanisms behind one contract

SystemEngineArchitecture
Astra Linux, Alt Linuxepoll / io_uringx86-64
Debian, Ubuntu, Fedora, openSUSE, Alpineepoll / io_uringx86-64 · ARM64
macOSkqueuex86-64 · ARM64
FreeBSD, NetBSD, OpenBSDkqueuex86-64 · ARM64
DragonFly BSDkqueuex86-64
Solaris 11.4, OpenIndianaevent portsx86-64
OpenWRT (musl)epollx86-64
Windows · MSVC and MinGWIOCPx86-64 · ARM64
iOS, Androidkqueue / epollARM64
Elbrus Linux 8.1epoll / io_uringe2k · port in progress

Application code does not depend on the system. Five different kernel mechanisms — kqueue, epoll, io_uring, event ports and IOCP — sit behind one contract: porting to a new system means a new engine at the bottom, not a rewrite of the product.

  • Works in isolation. Neither the build nor the runtime needs internet access or external repositories.
  • Long product life. Rare and old systems without rewriting application code.
  • Process cluster, even on Windows. The master accepts connections and hands them to workers.
  • Static and shared builds — one CMake option.
08 Elbrus

The Elbrus port is under way, and the results are already good

Russian platforms get first-priority support, and AWH is now being ported to Elbrus-8C2 (Elbrus Linux 8.1, lcc compiler). The memory allocator, fibers and system modules already run, and the regular-expression code generator speaks the e2k instruction set.

The PCRE2 reference has no machine code for Elbrus at all and cannot get any: its code generator doesn't know the architecture. So on Elbrus our machine code is compared with its interpreter — and beats it almost everywhere.

Comparison on Elbrus-8C2Result
Our machine code vs PCRE2ahead in 39 of 41 scenarios, 6.6× at the median
Interpreter vs interpreterahead in 22, level in 23, behind in none; median 1.36
Best rows with codeup to 34× faster than the reference

Cryptography follows the same path: A-NTS on Elbrus already runs in full and is several times faster than OpenSSL in places.

09 Outlook

What is built on AWH

Ready to assemble today

  • Web server and API gateway — HTTP/1, HTTP/2, HTTP/3 and QUIC
  • Load balancer — cluster and hand-off of accepted connections
  • VPN and secure tunnels — TUN devices, SCTP, QUIC
  • Proxy server — SOCKS5 included
  • Network services — our own DNS, NTP, ICMP, portmap

Next step

  • Content delivery node on our own HTTP/3
  • Message broker on our own transport
  • Traffic and log analysis — regex and Grok
  • Industrial telemetry gateway
  • Embedded devices

Already being built

10 Components

Separate pages on parts of AWH