tsenart / vegeta

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

vegeta run with -h2c option doesn't match what curl does #442

Open ljnelson opened 5 years ago

ljnelson commented 5 years ago

Version and Runtime

Version: 12.7.0
Commit: 9c95632b3e8562be6df690c639a3f5a6f40d3004
Runtime: go1.12.4 darwin/amd64
Date: 2019-07-21T12:38:16Z"

Expected Behaviour

I wanted to have vegeta issue a "plain text" HTTP/2 call to my example application. I believe elsewhere this is known as a "prior knowledge" situation. I ran echo http://localhost:8080/example/data | vegeta attack -duration 2s -rate 1/2s -h2c | tee results.bin | vegeta report following the examples, and (hopefully) telling vegeta to send only one request through (my -rate option is intended to express "one request every two seconds", and two seconds is the duration of the attack). I expected that from looking at my application's verbose logs I would see the same request as issued by curl --http2-prior-knowledge http://localhost:8080/example/get.

Actual Behaviour

My application's logs show a different request coming in. Here is the initial log of the vegeta request (I am using a Netty-based server; these logs are what Netty can output to help diagnose issues):

FINE: [id: 0x3e6827ab, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:56563] READ: 119B
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 50 52 49 20 2a 20 48 54 54 50 2f 32 2e 30 0d 0a |PRI * HTTP/2.0..|
|00000010| 0d 0a 53 4d 0d 0a 0d 0a 00 00 12 04 00 00 00 00 |..SM............|
|00000020| 00 00 02 00 00 00 00 00 04 00 40 00 00 00 06 00 |..........@.....|
|00000030| a0 00 00 00 00 04 08 00 00 00 00 00 40 00 00 00 |............@...|
|00000040| 00 00 2e 01 05 00 00 00 03 41 8a a0 e4 1d 13 9d |.........A......|
|00000050| 09 b8 f0 1e 07 82 45 8a 60 be 47 4d 74 15 89 06 |......E.`.GMt...|
|00000060| 91 ff 86 50 83 9b d9 ab 7a 8d c4 75 a7 4a 6b 58 |...P....z..u.JkX|
|00000070| 94 18 b5 25 81 2e 0f                            |...%...         |
+--------+-------------------------------------------------+----------------+

Here are the curl logs:

FINE: [id: 0x94e667dc, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:56571] READ: 114B
         +-------------------------------------------------+
         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |
+--------+-------------------------------------------------+----------------+
|00000000| 50 52 49 20 2a 20 48 54 54 50 2f 32 2e 30 0d 0a |PRI * HTTP/2.0..|
|00000010| 0d 0a 53 4d 0d 0a 0d 0a 00 00 12 04 00 00 00 00 |..SM............|
|00000020| 00 00 03 00 00 00 64 00 04 40 00 00 00 00 02 00 |......d..@......|
|00000030| 00 00 00 00 00 04 08 00 00 00 00 00 3f ff 00 01 |............?...|
|00000040| 00 00 29 01 05 00 00 00 01 82 04 8a 60 be 47 4d |..).........`.GM|
|00000050| 74 15 89 06 91 ff 86 41 8a a0 e4 1d 13 9d 09 b8 |t......A........|
|00000060| f0 1e 07 7a 88 25 b6 50 c3 ab b6 d2 e0 53 03 2a |...z.%.P.....S.*|
|00000070| 2f 2a                                           |/*              |
+--------+-------------------------------------------------+----------------+

Steps to Reproduce

See above; you should be able to see differences with any arbitrary HTTP/2-aware server/endpoint.

Additional Context

(No additional Github issues.)

I raise this because vegeta reports that there was a timeout while reading the body:

Error Set:
net/http: request canceled (Client.Timeout exceeded while reading body)

…whereas the curl request has no such issues.

I am no kind of HTTP/2 expert so perhaps the problem lies elsewhere.

Thanks for a neat little tool.

tsenart commented 4 years ago

I raise this because vegeta reports that there was a timeout while reading the body:

Vegeta has a default -timeout of 30s. I think curl has no default timeout. Set -timeout=0 and try again.

The requests being different is likely due to different request headers being sent (e.g. User-Agent).