I'm writing a stress testing application and I'm using FSharp.Data to handle the Http requests like this...
let! x = Http.AsyncRequestString(url, httpMethod = "POST", headers = getHeaders, body = getFormVals, silentHttpErrors = true)
That line gets executed 100s of times.
Looking at fiddler, I'm exhausting some pool of connections or threads very quickly and about 30 or so requests go off all at once. After that, the application starts to slow down and the throughput of requests looks to be tied to the responsiveness of the URI I'm hitting. As a 200 comes back, another request goes out.
The containing function is inside an async{} block (hence the let!).
What I want to do is completely ignore the response but if I change the line to ...
Http.AsyncRequestString(url, httpMethod = "POST", headers = getHeaders, body = getFormVals, silentHttpErrors = true) |> ignore
...no requests get dispatched at all. I have no idea why that's the case.
I'm relatively new to F# and very new to this particular library (http://fsharp.github.io/FSharp.Data/library/Http.html). Are there any options I have to instruct the library that I don't care what the response is and not to block or is there something I can do with the language to help?
If you're hitting the web server from the same client, you most likely run into client throttling on the server. It's quite normal for web servers to only allow a limited number of requests coming from the same client. Further requests are queued and only handled when one of the active requests are completed.
Exactly how many concurrent client requests a server allows is dependent on the specific server software, and how it's configured, but the number is typically measured in single or double digits.
The first time I was bitten by this issue was about 10 years ago, and back then, 2 concurrent client connections was all I got.
Please note that a web server will typically gladly handle thousands of concurrent requests, as long as they come from different clients.
Thus, you can't stress test an HTTP-based service from a single client. You need a distributed group of clients for that. Stress testing is difficult.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With