The http package of Scaly's standard library and its siblings, used the way an application uses them — the entry scaly in HttpArena.
Scaly is a compiled language whose memory lives in regions the compiler infers: there is no garbage collector and no borrow checker. A server written in it looks like this:
SO_REUSEPORT): the kernel spreads the connections, and each scheduler accepts and serves its own.res.respond(404, "text/plain", "no such item"), res.send_json(value)); response compression switched on at the router, which answers text and JSON in gzip where the client takes it.json (a two-stage parser and a writer), pg (a Postgres pool with a prepared statement per connection), tls and https (TLS 1.3), h3 (HTTP/3), compress (gzip).http 0.2.0 and its siblings, in the Scaly repository — and comes with the toolchain.A handler takes the request and the response; the router maps paths to handlers. From the entry:
; baseline: a + b, plus the body when there is one. procedure baseline(req: ref[Request], mutable res: ref[Response]) { var sum parse_int_prefix(req.query_param("a")) + parse_int_prefix(req.query_param("b")) if req.body.length > 0 sum := sum + parse_int_prefix(trim(req.body)) res.send_int(sum) } ; async: waits ms without holding a thread, then answers the number. procedure delay(req: ref[Request], mutable res: ref[Response]) { let ms parse_int_prefix(req.param("ms")) if ms > 0 Scheduler.sleep(ms) res.send_int(ms) } var app Router.create(Page.allocate_page()) app.any("/baseline11", &baseline) app.get("/delay/{ms}", &delay) app.get("/json/{count}", &json_items) ; serializes with the json package's writer app.compress("", "gzip", &gzip_compress) ; text and JSON in gzip where the client takes it serve(app, 8080)
The whole entry is three files, arena.scaly (the routes and the core handlers), db.scaly (Postgres) and stack.scaly (the production stack behind a gateway); the directory has its Dockerfile and a table of how each profile is served. A procedure names what it writes (mutable res); the compiler checks it.
.proto files.SCALY_PGO=0 builds without it.With HttpArena itself, which builds the entry's image (the released toolchain at the version its Dockerfile names, as anyone installs it) and runs every profile the entry subscribes to:
git clone https://github.com/MDA2AV/HttpArena && cd HttpArena ./scripts/validate.sh scaly ./scripts/benchmark.sh scaly
Or the server alone, in the entry's directory, on Linux with OpenSSL 3.5, ngtcp2 and libdeflate installed (the Dockerfile shows how):
curl -fsSL https://scaly.io/install.sh | sh scaly build arena.scaly --release -o arena ./arena # :8080, TLS :8081, HTTP/2 :8443, h2c :8082 curl 'http://localhost:8080/baseline11?a=1&b=2' # 3
The numbers are HttpArena's, measured on its machine against every other entry: www.http-arena.com.