Giter Club home page Giter Club logo

Comments (6)

Choms avatar Choms commented on June 9, 2024

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/[email protected]#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 :)

from vegeta.

Choms avatar Choms commented on June 9, 2024

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

from vegeta.

deepakdeore2004 avatar deepakdeore2004 commented on June 9, 2024

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)

from vegeta.

Choms avatar Choms commented on June 9, 2024

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 :)

from vegeta.

deepakdeore2004 avatar deepakdeore2004 commented on June 9, 2024

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 :-)

from vegeta.

Choms avatar Choms commented on June 9, 2024

yea it's a bug, not sure if this project is still active though

from vegeta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.