linkxzhou/http_bench

working with URLs from file uses only the first line (so it seems not random)

marcelloh opened this issue · 4 comments

I think reading URLs from a file doesn't work as expected.
(I expected all the lines to be used and even at random.)

http_bench -n 1000 -c 100 -m GET -url-file stress.txt -verbose 1
My stress.txt

http://localhost
http://localhost/todo
http://localhost/todo/1
http://localhost/country
http://localhost/country/1
http://localhost/language
http://localhost/language/1
http://localhost/user
http://localhost/user/1

I can see that multiple lines are recognised:

Request params: {
        "sequence_id": 1670661308,
        "cmd": 0,
        "request_method": "GET",
        "request_body": "",
        "request_script_body": "",
        "request_httptype": "http1",
        "n": 1000,
        "c": 100,
        "duration": 10,
        "timeout": 3000,
        "qps": 0,
        "disable_compression": false,
        "disable_keepalives": false,
        "auth_username": "",
        "auth_password": "",
        "headers": null,
        "urls": [
                "http://localhost/todo",
                "http://localhost/todo/1",
                "http://localhost/country",
                "http://localhost/country/1",
                "http://localhost/language",
                "http://localhost/language/1",
                "http://localhost/user",
                "http://localhost/user/1",
                "http://localhost"
        ],
        "output": ""

but when I look at my webserver logging, I can see that only the first URL gets all the hits.
When I shuffle my stress.txt URLs, another first line gets all the hist

I see, I will fix it

this commit fix issue(72d8fbb)

you should make a new release, because when I do this:

go install github.com/linkxzhou/http_bench@latest

it would still install v0.0.2

when I try to install the master, this happens:

go install github.com/linkxzhou/http_bench@master
go: downloading github.com/linkxzhou/http_bench v0.0.3-0.20230206042224-d5f4a30dabbb
go: downloading github.com/lucas-clemente/quic-go v0.29.0
go: downloading golang.org/x/net v0.0.0-20220909164309-bea034e7d591
go: downloading github.com/marten-seemann/qpack v0.2.1
go: downloading github.com/marten-seemann/qtls-go1-19 v0.1.0
go: downloading golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
# github.com/lucas-clemente/quic-go/internal/qtls
go/pkg/mod/github.com/lucas-clemente/quic-go@v0.29.0/internal/qtls/go120.go:5:13: cannot use "The version of quic-go you're using can't be built on Go 1.20 yet. For more details, please see https://github.com/lucas-clemente/quic-go/wiki/quic-go-and-Go-versions." (untyped string constant "The version of quic-go you're using can't be built on Go 1.20 yet. F...) as int value in variable declaration