[Flask] Why is a small response broken into 3 TCP segments?

Ben Kinsella kinsella.ben at gmail.com
Fri Apr 27 08:21:11 EDT 2018


 I am working with a very limited client in an embedded device, and I would
like the HTTP response from my Flask app to be contained in one IP packet.

I know a response will be automatically segmented if the size exceeds my
TCP MSS (1460 bytes).
But I find that, even with a minimal “Hello World” response (112 bytes),
the response is sent in multiple IP packets (each containing one TCP
segment).

With Flask's builtin server, the response comes in 3 segments: start line,
headers, body.
With Gevent as the server, the same response comes in 2 segments: start
line & headers, body.

Is this behaviour configurable at any level? (Werkzeug, Flask, Gevent, any
another server?).

Thanks,
Ben.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/flask/attachments/20180427/212f46c5/attachment.html>


More information about the Flask mailing list