Not replaying all requests with --input-file?
I recorded more than 12,000 requests (one minute) as:
$ sudo ./gor --input-raw :80 --output-file requests.gor
$ sudo grep '^1' --binary-files=text requests.gor | wc -l
12374
However, it seems that replay with --input-file does not send all 12374 requests, but sends only 3977 requests.
$ sudo wc -l /var/log/nginx/access.log
4111 /var/log/nginx/access.log
$ sudo ./gor --input-file requests.gor --output-http localhost
$ sudo wc -l /var/log/nginx/access.log
8088 /var/log/nginx/access.log
Am I doing something wrong? How can I replay all requests? I also tried --output-http "http://localhost:80|100%", but nothing changed.
Current Version: 0.10.1
This is happening for me as well, I'm only getting partial file replays before it things it's finished reading the file.
Same issue here, I'm getting "FileInput: end of file" way too early.
I experienced the same issue... Is this tool designed to handle binary files like images, videos, etc?
+1
HI, I see the same issue. Digging a little deeper it looks like the data in the file is corrupted.
I see this with the record that breaks
1 cbe2a795a400a0e8d61b86f23e64ebcf156829a8 1449826235702007877
9nuZ7uf7X62%2........<deleted>....POST /endpoint HTTP/1.1
As far as I can tell the first line is correct, but the issue is with the second. I don't think there should be anything before the POST. There's around 1k of data that shouldn't be there.
So I suspect there is a race condition in the writing of the data to file. I guess workaround is fix that error (duh) or make the parsing of the file more robust.
A bit of further digging suggests that the corrupted record issue isn't the root cause. The underlying issue is that the size of the record is larger than the buffer used by bufio.Scanner, which is 64k. It's certainly possible for a POST payload to be larger than this.
Same issue here, it's not specific to POST requests either. I have a 16GB .gor file with about ~22 million requests in it:
$ grep GET foo.gor | wc -l
22498748
I replay this file to another server with:
$ gor --input-file foo.gor --output-http "http://127.0.0.1:9990|400%" --stats --output-http-stats --output-http-workers=200
which has the following output:
Version:
2016/01/14 10:33:19 output_http:latest,mean,max,count,count/second,gcount
2016/01/14 10:33:19 output_http:1,0,1,1,0,165
2016/01/14 10:33:24 output_http:1,1,2,6026,1205,226
2016/01/14 10:33:29 output_http:2,1,2,4023,804,226
2016/01/14 10:33:34 output_http:2,1,2,4574,914,226
2016/01/14 10:33:39 output_http:2,1,2,4490,898,226
2016/01/14 10:33:44 output_http:1,1,2,4505,901,226
2016/01/14 10:33:49 output_http:1,1,2,4563,912,226
2016/01/14 10:33:51 FileInput: end of file
The server at 127.0.0.1:9990 has a counter for incoming requests and replaying this file results in ~30K requests which is far less than the 22M in the .gor file. Any ideas, @buger?
I've created a pull request with a fix and also a workaround for now - I put details in a different issue at https://github.com/buger/gor/issues/233#issuecomment-171299726
@sonots this has been fixed in master Thanks