Repository navigation
At the 1 KiB boundary: tracing a streaming translation request through NGINX #2026
FenjuFu
started this conversation in
Show and tell
Replies: 1 comment 1 reply
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
A translation client can stop waiting for tokens as soon as it sees HTTP 413. But did the model receive the request? I sent the same train notice through NGINX three times, changing only the number of trailing spaces in the JSON body. The access log and the event stream give two independent ways to see where the request stopped.
[DONE][DONE]This matches the known-length request check in
src/http/ngx_http_core_module.cat commit481d28cb4e04c8096b9b6134856891dc52ecc68f. It compares the configured limit with the parsed Content-Length using strict less-than. Equality passes. The last request produced413 | -for$status | $upstream_status. In a client, check the HTTP status before starting the SSE parser.Reproduce on loopback
I used NGINX 1.28.0 for Windows and the CPU backend of llama.cpp with Spark-X2.6-1.7B-GGUF, file
Spark-X2.6-1.7B-Q4_K_M.gguf, model revisionc4bc25be0e537d55266d90a08bdef931f4cf580a. Start the upstream in one terminal:Save this as
conf/lab.confin the extracted NGINX directory. From that directory runnginx -t -c conf/lab.conf, thennginx -c conf/lab.conf.This Python client sends a known Content-Length. Padding after the closing brace keeps the prompt identical while moving the serialized body across the limit.
Both accepted requests returned “The train tomorrow will be changed to depart at 9:00.” The reproduction covers one prompt and three known-length requests on loopback. The 1 KiB limit makes the boundary easy to exercise. Chunked uploads and concurrent clients would need separate measurements. To stop the proxy, run
nginx -s quit -c conf/lab.conffrom the same directory.All reactions