HttpArena
Knowledge BaseFrameworks

JSON over TLS Benchmark: Implementation Guide

Must use the framework standard JSON serialization and a standard TLS stack (OpenSSL, BoringSSL, rustls, SChannel, JDK JSSE, etc.). No pre-serialized caches, no bypassing the framework response pipeline, no TLS session-ticket shortcuts that skip real handshakes.
May use alternative JSON libraries, tuned TLS providers, and framework-specific optimizations. The JSON body must still be serialized per request from live data - pre-computed / pre-serialized response caches are not allowed on either type; they short-circuit the serialization workload the profile exists to measure.
No specific rules.
The JSON body must be serialized per request by the handler module. A static file on disk, a literal-response config directive, or any pre-serialized response cache does not qualify - the profile exists to measure serialization work. Configuration is otherwise free. TLS must come from a standard stack (OpenSSL, BoringSSL, rustls, quictls) and every connection must complete a real handshake.

The JSON over TLS profile serves GET /json/{count}?m={multiplier} over HTTP/1.1 + TLS on a dedicated port. It is the reference definition of the /json endpoint: JSON Compressed and JSON h2c serve the same response shape under content negotiation and over cleartext h2 respectively.

How it works

  1. The framework loads /data/dataset.json at startup (the 50-item mixed-type dataset)
  2. The framework listens on port 8081 with HTTPS, serving HTTP/1.1 only (ALPN advertises http/1.1)
  3. On each GET /json/{count}?m={multiplier} request, the server returns the first count items with total = price × quantity × m, wrapped in {items, count}
  4. Returns Content-Type: application/json
  5. Client sends no Accept-Encoding header - compression is out of scope for this profile

The load generator is wrk with a Lua rotation script (requests/json-tls-rotate.lua). gcannon is not used for this test because it doesn't support TLS.

What it measures

  • Dataset load, per-item derived fields and JSON serialization
  • TLS handshake cost amortized over keep-alive - connections are long-lived at 4096 concurrent
  • Record framing overhead - every HTTP request gets wrapped in one or more TLS records
  • Symmetric cipher throughput - AES-GCM / ChaCha20-Poly1305 on the hot path
  • Certificate private-key operations - RSA/ECDSA cost per new connection, mostly negligible with keep-alive but visible during ramp

Port, ALPN, and certificates

  • Port: 8081 (distinct from 8080 plaintext and 8443 which is dedicated to HTTP/2 / HTTP/3 profiles)
  • ALPN: advertise http/1.1 only. HTTP/1.1-only clients (wrk) negotiate correctly and never upgrade to h2.
  • Certificates: the same PEM files used by baseline-h2 / static-h2, mounted at /certs/server.crt and /certs/server.key. Frameworks typically read them via environment variables (TLS_CERT, TLS_KEY) or a hardcoded path, same pattern as the other TLS tests.

Dataset format

Each item in dataset.json:

{
  "id": 1,
  "name": "Alpha Widget",
  "category": "electronics",
  "price": 328,
  "quantity": 15,
  "active": true,
  "tags": ["fast", "new"],
  "rating": {
    "score": 48,
    "count": 127
  }
}

Expected response

For GET /json/5?m=3 over HTTPS on port 8081:

HTTP/1.1 200 OK
Content-Type: application/json

Body (the shared /json response shape):

{
  "items": [
    {
      "id": 1,
      "name": "Alpha Widget",
      "category": "electronics",
      "price": 328,
      "quantity": 15,
      "active": true,
      "tags": ["fast", "new"],
      "rating": { "score": 48, "count": 127 },
      "total": 14760
    }
  ],
  "count": 5
}

Parameters

ParameterValue
EndpointGET /json/{count}?m={multiplier}
TransportHTTP/1.1 over TLS
Port8081
ALPNhttp/1.1
Count × multiplier pairs(1,3), (5,7), (10,2), (15,5), (25,4), (40,8), (50,6) (round-robin)
Connections4,096
Pipeline1
Duration5s
Runs3 (best taken)
Load generatorwrk + requests/json-tls-rotate.lua
Certificatesmounted at /certs/server.crt + /certs/server.key
Dataset50 items, mounted at /data/dataset.json