Go 1.27 now drains HTTP bodies on Close: what we measured

Go 1.27 drains an unread HTTP/1 response body when you call `Close`, up to 256 KiB or 50 milliseconds, whichever comes first, so the connection can be reused.

In our test of 100 requests with an unread 1 KiB body, Go 1.26.9 opened 100 new TCP connections and Go 1.27.2 opened 2.

The limit is a cliff: a 256 KiB body reused connections, while a 257 KiB body opened 100 connections again.

A streaming reply closed early, such as a cancelled LLM stream, still opened a new connection every time.

Read the full post

Read the full post