Open finnefloyd opened 3 years ago
Merge conflict needs to be resolved
It's unclear to me if this will result in cookies and headers being shared between all GooseUser
s, which would be undesirable.
It's unclear to me if this will result in cookies and headers being shared between all GooseUsers, which would be undesirable.
Goose point, I did not think about it and I'm not using cookies in my current load tests, I didn't detect it. I moved the cookies handling to the GooseUser
so we can shared the connection pool
This addresses cookies, but there’s still a problem from shared headers. For example, if using http header authentication, with this PR once one GooseUser logs in all would be.
For example, as documented here it's currently possible to set different headers with different GooseUsers, and this is required functionality for many load tests: https://docs.rs/goose/*/goose/goose/struct.GooseUser.html#example-18
This example will also need to be updated to show how to set custom cookies: https://docs.rs/goose/*/goose/goose/struct.GooseUser.html#example-19
I added support for default headers and custom cookies to the GooseUser.
@finnefloyd Thanks for all your contributions so far!
I share Jeremy's sentiment that I would like to understand the motivation of the change a little bit more, before considering this PR.
@finnefloyd Thanks for all your contributions so far!
I share Jeremy's sentiment that I would like to understand the motivation of the change a little bit more, before considering this PR.
I used Goose recently, and I needed to create thoudands of users. Starting Goose took about thirty seconds. The tests themselves were not terribly long, so the startup time was significant.
I solved this by monkey-patching goose to use a single reqwest client. (Cookies and headers weren't an issue for me.) This way the statup time disappeared.
I know this is a corner case, but IMHO worth implementing client sharing.
The general argument would be "because it's just more resource efficient".
From Reqwest official documentation:
This PR, use a shared reqwest client among all GooseUser and allow the user the configure the global client.