tsenart / vegeta

HTTP load testing tool and library. It's over 9000!
http://godoc.org/github.com/tsenart/vegeta/lib
MIT License
23.51k stars 1.36k forks source link

MaxBody(0) seems to be causing server to leak connections #549

Closed antoineco closed 1 year ago

antoineco commented 3 years ago

Question

I am flagging this as a question and not a bug because I haven't gathered sufficient proof yet, but I have a strong suspicion that maxBody=0 causes the target to leak connections.

I performed the same test multiple times against the exact same server and observed similar results: a ramp to 8000 req/s with a payload of 2 KB and a client timeout of 3s.

The charts below show the receive throughput measured from the target (not from vegeta), in one case with maxBody=-1, in the other case with maxBody=0. The "rt" series is the receive throughput, the "q" series is just an internal queue which has no influence on the results of the attack.


maxBody=-1

image

Running attack Ramp{5 intervals, 1600 hits/1s increments} for 20s
Attack completed
---- Results ----
duration     : 20.002541209s
bytes out    : {196608000 2048}
bytes in     : {0 0}
requests     : 96000
wait time    : 8.562478ms
rate         : 4799.390187323073
throughput   : 4797.336593801439
success %    : 100
status codes : map[200:96000]
errors       : []

maxBody=0

image

Running attack Ramp{5 intervals, 1600 hits/1s increments} for 20s
Attack completed
---- Results ----
duration     : 31.093824885s
bytes out    : {189184000 1987.8742027340836}
bytes in     : {0 0}
requests     : 95169
wait time    : 5.578920017s
rate         : 3060.704186505873
throughput   : 2518.9006235244256
success %    : 97.06417005537517
status codes : map[0:2794 200:92375]
errors       : [Post "http://thrpt-receiver.perf-thrpt-receiver": context deadline exceeded (Client.Timeout exceeded while awaiting headers)]

In the second case, I do observe some failures at about the same threshold every time, and noticed that the wait time was about 5s, which is my server's IdleConnTimeout (this could also be a pure coincidence).

This particular server only returns HTTP headers and no body, so I suppose it is normal to see 0 byte in in both results, regardless of the value of maxBody(?)

I checked the code of the lib and confirmed that the response body was being closed correctly in a deferred statement, so I'm a bit puzzled about what may be happening here.

tsenart commented 1 year ago

Sorry for not responding to this when you first posted it. I'm spending time maintaining Vegeta again. If you're still interested in looking into this, please re-open.