Open deepakdeore2004 opened 7 months ago
Hi, on your steps you have --kepalive on
, it should be -keepalive=false
.
However, and to not open a new issue, I do actually see an issue regarding connections falling back to keepalive, when I specify --rate of 1000 or more, with rate under 500 seems ok but with 1k seems it's reusing connections regardless specifying keepalive false.
I did some research and I see Vegeta's code has references to this library https://cs.opensource.google/go/x/net that was in use originally, but since then I think you are using the built in 'net' library (https://github.com/tsenart/vegeta/blob/master/lib/attack.go#L10). However, these two libraries differ on the Dialer function regarding keepalive:
original (https://cs.opensource.google/go/x/net/+/master:internal/quic/config.go;l=92):
// an idle connection alive.
// If zero, keep alive packets are not sent.
// If greater than zero, the keep alive period is the smaller of KeepAlivePeriod and
// half the connection idle timeout.
new (https://pkg.go.dev/net@go1.22.0#Dialer):
// probes for an active network connection.
// If zero, keep-alive probes are sent with a default value
// (currently 15 seconds), if supported by the protocol and operating
// system. Network protocols or operating systems that do
// not support keep-alives ignore this field.
// If negative, keep-alive probes are disabled.
so if you are actually using the built in library you should be passing a negative integer here and not a 0 so this works correctly: https://github.com/tsenart/vegeta/blob/master/lib/attack.go#L188
note: I don't usually work with go, this is an educated guess reading through a bit here trying to explain the behavior I'm seeing, hopefully it helps :)
Hi all,
quick update, I did some more testing (using netstat -panto
to verify the connections) with the current code it does indeed use for any rate keepalive and retransmissions, I did a custom build changing the line referenced to -1 and now I'm actually seeing connections with keepalive off (though strangely I still see a bunch of retransmissions and one or two sporadic keepalives - but at least now I can see most of the traffic not using keepalive).
Cheers
thanks for the reply @Choms
there may be typo in my repoduction steps but i ran same command with keepalive off
but still see the keepalives
# vegeta --version
Version: v12.11.1
Commit: 6fbe391628eeeae1adf39522a55078797e6e7f2e
Runtime: go1.20.8 linux/amd64
Date: 2023-10-02T09:05:05Z+0000
echo "GET https://www.google.com/" | vegeta attack --duration=10m --rate=3 --keepalive off | vegeta report -every 3s
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 0 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 keepalive (24.63/0/0)
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 0 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 keepalive (23.15/0/0)
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 48 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 on (0.20/0/0)
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 0 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 keepalive (21.24/0/0)
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 0 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 keepalive (14.45/0/0)
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 0 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 keepalive (11.93/0/0)
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 0 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 keepalive (10.53/0/0)
root@48ec74f242ab:/# netstat -panto |grep :443 |grep ESTA
tcp 0 41 172.17.0.2:59877 142.250.182.132:443 ESTABLISHED 2926/qemu-x86_64 keepalive (9.82/0/0)
yeah, for that to work you need to change this line to be -1 instead of 0 https://github.com/tsenart/vegeta/blob/master/lib/attack.go#L188
then recompile Vegeta :)
yeah, for that to work you need to change this line to be -1 instead of 0 https://github.com/tsenart/vegeta/blob/master/lib/attack.go#L188
then recompile Vegeta :)
i see, then its a bug, i will wait for the fix, for now i am good with keepalive :-)
yea it's a bug, not sure if this project is still active though
Version and Runtime
Expected Behaviour
connections should not have
keepalive
when--keepalive off
is setActual Behaviour
netstat shows keepalive is set for the socket
Steps to Reproduce
netstat -panto |grep :443 |grep ESTA
in another terminal to see connections detailsAdditional Context