|
| 1 | +--- |
| 2 | +title: Endpoints |
| 3 | +--- |
| 4 | + |
| 5 | +Your framework must implement endpoints depending on which test profiles it participates in. All endpoints are served on **port 8080** (HTTP/1.1) unless noted otherwise. |
| 6 | + |
| 7 | +## Core endpoints |
| 8 | + |
| 9 | +These are required for the `baseline`, `limited-conn`, and `noisy` profiles. |
| 10 | + |
| 11 | +### `GET/POST /baseline11?a=N&b=N` |
| 12 | + |
| 13 | +Parse query parameters `a` and `b`, compute their sum, and return it as plain text. |
| 14 | + |
| 15 | +For POST requests, the body contains an additional integer to add. The server must accept both `Content-Length` and `chunked Transfer-Encoding` bodies. |
| 16 | + |
| 17 | +``` |
| 18 | +GET /baseline11?a=13&b=42 → "55" |
| 19 | +POST /baseline11?a=13&b=42 (body: "20") → "75" |
| 20 | +``` |
| 21 | + |
| 22 | +### `GET /pipeline` |
| 23 | + |
| 24 | +Return a fixed `ok` response (exactly 2 bytes, `text/plain`). Used for the pipelined benchmark — should be as lightweight as possible. |
| 25 | + |
| 26 | +## JSON processing |
| 27 | + |
| 28 | +Required for the `json` profile. |
| 29 | + |
| 30 | +### `GET /json` |
| 31 | + |
| 32 | +Load `/data/dataset.json` at startup (50 items). For each request, compute `total = price * quantity` (rounded to 2 decimals) for every item and return: |
| 33 | + |
| 34 | +```json |
| 35 | +{ |
| 36 | + "items": [ |
| 37 | + {"id": 1, "name": "Alpha Widget", "category": "electronics", "price": 29.99, "quantity": 5, "active": true, "tags": ["fast", "new"], "rating": {"score": 4.2, "count": 127}, "total": 149.95} |
| 38 | + ], |
| 39 | + "count": 50 |
| 40 | +} |
| 41 | +``` |
| 42 | + |
| 43 | +Response must have `Content-Type: application/json`. |
| 44 | + |
| 45 | +## Upload |
| 46 | + |
| 47 | +Required for the `upload` profile. |
| 48 | + |
| 49 | +### `POST /upload` |
| 50 | + |
| 51 | +Read the entire request body (up to 20 MB binary) and return its CRC32 checksum as an 8-character lowercase hex string. |
| 52 | + |
| 53 | +``` |
| 54 | +POST /upload (body: 20MB binary) → "a1b2c3d4" |
| 55 | +``` |
| 56 | + |
| 57 | +The CRC32 uses the ISO 3309 polynomial (`0xEDB88320`), the same as `zlib.crc32`. |
| 58 | + |
| 59 | +## Compression |
| 60 | + |
| 61 | +Required for the `compression` profile. |
| 62 | + |
| 63 | +### `GET /compression` |
| 64 | + |
| 65 | +Load `/data/dataset-large.json` at startup (6000 items). Compute `total` for each item (same as `/json`), and return the response with `Content-Type: application/json`. |
| 66 | + |
| 67 | +The server **must** support gzip compression — when the client sends `Accept-Encoding: gzip`, the response should be gzip-compressed. Only frameworks with built-in gzip support are eligible. |
| 68 | + |
| 69 | +## Static files |
| 70 | + |
| 71 | +Required for the `static-h2` and `static-h3` profiles. Served over **HTTPS on port 8443**. |
| 72 | + |
| 73 | +### `GET /static/{filename}` |
| 74 | + |
| 75 | +Serve 20 pre-loaded static files from `/data/static/`. Files should be loaded into memory at startup and served with the correct `Content-Type`: |
| 76 | + |
| 77 | +| Extension | Content-Type | |
| 78 | +|-----------|-------------| |
| 79 | +| `.css` | `text/css` | |
| 80 | +| `.js` | `application/javascript` | |
| 81 | +| `.html` | `text/html` | |
| 82 | +| `.woff2` | `font/woff2` | |
| 83 | +| `.svg` | `image/svg+xml` | |
| 84 | +| `.webp` | `image/webp` | |
| 85 | +| `.json` | `application/json` | |
| 86 | + |
| 87 | +Return `404` for missing files. |
| 88 | + |
| 89 | +## HTTP/2 baseline |
| 90 | + |
| 91 | +Required for the `baseline-h2` profile. Served over **HTTPS on port 8443**. |
| 92 | + |
| 93 | +### `GET /baseline2?a=N&b=N` |
| 94 | + |
| 95 | +Same logic as `/baseline11` — parse query parameters and return their sum. Served over HTTP/2 with TLS. |
| 96 | + |
| 97 | +Read the TLS certificate and key from `/certs/server.crt` and `/certs/server.key` (mounted read-only by the benchmark runner). |
| 98 | + |
| 99 | +## HTTP/3 |
| 100 | + |
| 101 | +For `baseline-h3` and `static-h3` profiles. The same endpoints (`/baseline2` and `/static/*`) are served over **HTTP/3 (QUIC) on port 8443**. |
| 102 | + |
| 103 | +This requires native QUIC support in the framework. Only add H3 tests to your `meta.json` if your framework supports it. |
0 commit comments