K6 TCP segment size, is it configurable?

Hey All,
How can I change K6 TCP segmentation to be based on MSS?
In my case, I’m sending POST 10K JSON. Eventhough, MSS is 8961B, K6 will split it to 3 segments: 4164B, 4164B and 2296B.
If I use curl for the same POST, it will split it based on MSS to 2 packets: 9017B and 1536B.

Thanks!

Hi @fimal, welcome to the community forum! :tada:

You likely can not or at least I don’t know how that could be done.

From the looks of it you are hitting the issue here Strange k6 behaviour with HTTP2 and the thing is not that it conforms to MSS or something like that, but that the http2 implementation in golang will at most “buffer” 4kb before sending them.

Later the kernel/tcp stack might segment it further but in this case this isn’t needed.

I haven’t communicated this with the go team, sorry it has fallen through the cracks at some point. It also seems like either the constant will get bumped or it will be bogged down in a lot of discussions.

Hope this helps you understand it, but I have no workaround for you, sorry

Thanks a lot for you answeer @mstoykov , now it is clear!

Hey,
By the way, my test is HTTP/1.1.
Is it still using http2 golang package for HTTP/1.1?

Thanks,
Fima

Hi @fimal , sorry for the slow reply :frowning:

Is it still using http2 golang package for HTTP/1.1?

Yeah, this shouldn’t matter for you.

I did try locally on the loopback interface and I can get up to 32kb (or there about) in a single tcp package … even though the mtu for that is 65kb+ but definitely above the 4kb you are seeing.

I also looked into some fields on the http.Transport - WriteBufferSize and ReadBufferSize which didn’t change anythign for me. Which is expected in retrospect as those seems to be how much go should buffer in the app, not how much the OS should buffer.

I unfortunately do not have any > 1500MTU capable network equipment lying around, and it probably will take me a while to get enough access to run this in some cloud instance (which likely will have it).

I also have no idea where else to look :person_shrugging: There doesn’t seem to be any knobs we can turn from within k6. I also did spend almost an hour trying to get something with https://pkg.go.dev/golang.org/x/sys@v0.0.0-20220608164250-635b8c9b7f68/unix#GetsockoptTCPInfo and company but am only getting “protocol not available” so … that will probably take a while to figure out as well.

So if nothing else this seems involved enough to open an issue.