ONRouter: An OpenResty-Compatible Gateway in Rust with a Preemptible Lua Runtime
Abstract
ONRouter (ORR) is a reverse proxy and application gateway written from scratch in Rust that reimplements the OpenResty programming model --- nginx's multi-phase request pipeline, an embedded Lua 5.4 scripting layer exposing the `ngx.*` API, native Rust modules, and TLS termination --- without reusing any gateway logic from nginx. This paper describes the architecture and reports an on-host A/B comparison against OpenResty 1.25.3.1 across four scenarios and five concurrency levels. Three design decisions carry most of the result. First, a per-core Lua VM pool driven by a coroutine scheduler in which every resume is armed with an instruction-count hook that yields the coroutine back to the scheduler, so a runaway script in a single-process gateway degrades to one busy core rather than stalling the gateway. Second, an explicit blocking analysis that moved every filesystem access off the async workers and added an in-process static-file cache; this is where the static path win comes from. Third, a front-proxy seam placed strictly after the real-IP trust gate, so that a client replaying a provider's entire header set cannot move its own identity. The measurements are reported together with their caveats: the load generator is a Python client, so absolute request rates are client-bound; the Lua paths are *slower* than OpenResty's LuaJIT (0.74x at one connection, 0.99x at thirty-two), while the reverse proxy and static paths reach 2.49x and 1.82x. A control endpoint that performs no I/O shows parity (0.99x), which isolates the difference to the I/O and scheduling path rather than to the harness.
Download
Body
Imported entry paper (unverified hypothesis)
This paper was imported into jetessays as an entry paper from the author's local archive (onrouter). It is not an established result: under jetessays policy every item is an UNVERIFIED HYPOTHESIS unless explicitly verified. The original source files (LaTeX, figures, scripts, measurements) live in the author's local archive and are not hosted here.
Abstract (as submitted)
ONRouter (ORR) is a reverse proxy and application gateway written from scratch in Rust that reimplements the OpenResty programming model --- nginx's multi-phase request pipeline, an embedded Lua 5.4 scripting layer exposing the ngx. API, native Rust modules, and TLS termination --- without reusing any gateway logic from nginx. This paper describes the architecture and reports an on-host A/B comparison against OpenResty 1.25.3.1 across four scenarios and five concurrency levels. Three design decisions carry most of the result. First, a per-core Lua VM pool driven by a coroutine scheduler in which every resume is armed with an instruction-count hook that yields the coroutine back to the scheduler, so a runaway script in a single-process gateway degrades to one busy core rather than stalling the gateway. Second, an explicit blocking analysis that moved every filesystem access off the async workers and added an in-process static-file cache; this is where the static path win comes from. Third, a front-proxy seam placed strictly after the real-IP trust gate, so that a client replaying a provider's entire header set cannot move its own identity. The measurements are reported together with their caveats: the load generator is a Python client, so absolute request rates are client-bound; the Lua paths are slower* than OpenResty's LuaJIT (0.74x at one connection, 0.99x at thirty-two), while the reverse proxy and static paths reach 2.49x and 1.82x. A control endpoint that performs no I/O shows parity (0.99x), which isolates the difference to the I/O and scheduling path rather than to the harness.
Note
Imported via the jetessays seed importer. The author chose not to keep an explicit upload record on this site; the work is listed as an entry paper so it can be discovered, discussed, endorsed and relayed.
No comments yet. Be the first to discuss this hypothesis.