giong

crates

The crates

7 crates that share one version number, 0.3.0. The runtime at the bottom, and the layers a service needs on top of it, each written for giong rather than wrapped around a Tokio crate.

about 40,000 lines of Rust and 643 tests in all · line counts are read from the sources when the site is built

giong

Runtime

cargo add giong

The runtime: TCP, UDP, Unix sockets, files, timers, DNS, channels and graceful shutdown.

  • Builder::new().workers(n), one worker per core
  • TcpListener, TcpStream, UdpSocket, UnixListener, UnixStream
  • fs::File with read_at and write_at, fs::read, read_dir, rename
  • net::lookup_host without blocking; sync::mpsc, bounded, oneshot
  • spawn_on, spawn_balanced and bind_balanced to spread new work

about 9,600 lines · 194 tests · 3 dependencies: io-uring, libc, socket2

giong-tls

Protocols

cargo add giong-tls

TLS 1.2 and 1.3 for servers and clients on rustls with ring. No OpenSSL.

  • TlsAcceptor::from_pem(cert, key); TlsConnector with the system's or built-in roots
  • recv() is cancel safe
  • A cancelled write poisons the sending side instead of corrupting the record stream
  • ALPN, client certificates and a handshake timeout

about 960 lines · 34 tests · TLS costs 4% on /json

giong-http

Protocols

cargo add giong-http

A small, strict HTTP/1.1 server with one async handler, and a client.

  • Keep-alive, pipelining, bodies by Content-Length or chunked
  • Limits on head and body size; timeouts for idle, slow and slow-reading clients
  • Answers 400 to any request a proxy in front could read differently
  • Server::serve, serve_unix, serve_tls; a pooled HTTPS Client with proxies and gzip behind client

about 6,900 lines · 109 tests · the parser fuzzed every night

giong-postgres

Clients

cargo add giong-postgres

A PostgreSQL client and pool. The statements of every task pipeline over a few connections.

  • Client::connect, query, execute, transaction, cancel_token
  • A Pool per worker: shared, pipelined statements; get() for a transaction
  • Every statement prepared once per connection and cached
  • TLS verified by default for remote hosts; SCRAM-SHA-256

about 5,600 lines · 79 tests · 2.6× deadpool's statements per core

giong-mysql

Clients

cargo add giong-mysql

A MySQL 8 client and pool, built the same way as giong-postgres.

  • Client::connect, query, execute, transaction
  • A Pool per worker: shared, pipelined statements; get() for a transaction
  • Prepared statements on the binary protocol, cached per connection
  • TLS; caching_sha2_password and mysql_native_password

about 6,500 lines · 88 tests · 4.7× SQLx's statements per core

giong-redis

Clients

cargo add giong-redis

A Redis client and pool on RESP3. The commands of every task pipeline over one connection.

  • Typed commands, query for any other, Pipeline for a batch
  • Transactions with watch; Pub/Sub
  • A Pool per worker; take() for a connection of your own
  • TLS; Redis 6 or newer (RESP3)

about 5,400 lines · 71 tests · 1.4× redis-rs's GETs per core

giong-web

Framework

cargo add giong-web

A router, middleware and JSON on giong-http. Handlers are plain async fns; every error is a coded problem+json answer.

  • Router::new().get("/users/{id}", user).nest("/api", api).build(state)
  • req.param::<u64>("id")?, req.query::<T>()?, req.json::<T>()?
  • RequestId, Logger (JSON lines), Cors, Compression (gzip), Timeout
  • 404, 405 with Allow, OPTIONS and HEAD answered for you; App::handle tests without a socket

about 5,000 lines · 68 tests · 1.3× axum's /json on one core

giong-mcp

Tooling · on the roadmap

A read-only MCP server: an agent reads workers, connections and pools.

See the roadmap