hbs · http benchmark server

v1.0.0

$ hbs
    $ hbs -p 8080
    $ hbs --port 8080

    $ curl http://localhost/
    [HBS documentation]

    $ wrk -t8 -c512 -d30s http://localhost/
    Running 30s test @ http://localhost/

methodpathdescription
GET / documentation · this page
GET /static benchmark-ready static text response
GET /bytes/{n} n-byte payload
GET /random/{n} random n bytes
POST /sink upload · discards
POST /echo round-trip · streams back
POST /count returns bytes received

$ curl http://localhost/
    [HBS documentation]

    $ curl http://localhost/static
    HTTP Benchmark Server - Ready for Benchmark Testing!

    $ curl http://localhost/bytes/1024 -o /dev/null
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  1024  100  1024    0     0   1024      0 --:--:-- --:--:-- --:--:--  1024

    $ curl -X POST --data-binary @file.bin http://localhost/count
    2048

{
  "ip": "10.20.40.9",
  "remote_addr": "10.20.40.9:38194",
  "method": "GET",
  "scheme": "http",
  "host": "app-bench.rsa.my.id",
  "path": "/",
  "request_uri": "/",
  "proto": "HTTP/1.1",
  "content_length": -2,
  "user_agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)",
  "headers": {
    "Host": [
      "app-bench.rsa.my.id"
    ],
    "User-Agent": [
      "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)"
    ],
    "X-Forwarded-For": [
      "216.73.217.9"
    ],
    "X-Forwarded-Host": [
      "app-bench.rsa.my.id"
    ],
    "X-Forwarded-Prefix": [
      "/"
    ],
    "X-Forwarded-Proto": [
      "https"
    ],
    "X-Forwarded-Protocol": [
      "https"
    ],
    "X-Real-IP": [
      "216.73.217.9"
    ],
    "accept": [
      "*/*"
    ],
    "accept-encoding": [
      "gzip, br, zstd, deflate"
    ]
  },
  "tls": null
}