As reported in GH issue #3574, we're currently using an exact match for
text/event-stream, and it fails to match when a parameter is appended.
Let's add one here to trigger this problem.
Without the parameter:
=== gateway overhead (gateway minus loopback; negative = loopback noise) ===
emit->recv (1st token) mean +0.046ms p50 +0.046ms p95 +0.046ms p99 +0.046ms
emit->recv (tokens) mean +0.214ms p50 +0.234ms p95 +0.305ms p99 +0.322ms
TTFT (client) mean +0.493ms p50 +0.493ms p95 +0.493ms p99 +0.493ms
inter-token (client) mean -0.001ms p50 +0.230ms p95 +0.283ms p99 +0.299ms
With the parameter:
=== gateway overhead (gateway minus loopback; negative = loopback noise) ===
emit->recv (1st token) mean +214.379ms p50 +214.379ms p95 +214.379ms p99 +214.379ms
emit->recv (tokens) mean +303.484ms p50 +307.784ms p95 +405.797ms p99 +413.876ms
TTFT (client) mean +214.775ms p50 +214.775ms p95 +214.775ms p99 +214.775ms
inter-token (client) mean -0.026ms p50 -1.069ms p95 -1.260ms p99 -1.271ms
Let's backport this to 3.4 since sse-latency was backported there, and to
any version containing a backport of
345aa2b73 ("DEV: sse-latency: add a
latency measuring tool for SSE response streams")
/* response head + role chunk */
hl = snprintf(head, sizeof(head),
"HTTP/1.1 200 OK\r\n"
- "Content-Type: text/event-stream\r\n"
+ "Content-Type: text/event-stream; charset=utf-8\r\n"
"Cache-Control: no-cache\r\n"
"Connection: close\r\n"
"X-Accel-Buffering: no\r\n"