FSharp.Data Http Utilities - can I not ask for an answer?

I am writing a stress testing application and I am using FSharp.Data to handle Http requests like this ...

let! x = Http.AsyncRequestString(url, httpMethod = "POST", headers = getHeaders, body = getFormVals, silentHttpErrors = true)

      

This line takes 100 seconds.

Looking at the fiddler, I very quickly drain some pool of connections or threads and about 30 requests disappear right away. After doing this, the application starts to slow down and the request throughput looks tied to the URI callback that I am encountering. When 200 returns, another request appears.

the containing function is inside the block async{}

(hence let it be!).

What I want to do is ignore the answer completely, but if I change the line to ...

Http.AsyncRequestString(url, httpMethod = "POST", headers = getHeaders, body = getFormVals, silentHttpErrors = true) |> ignore

      

... requests are not sent at all. I have no idea why this is the case.

I am relatively new to F # and very new to this particular library ( http://fsharp.github.io/FSharp.Data/library/Http.html ). Are there any options that I should instruct the library that I don't care what the answer is and not block or is there something I can do with the language to help?

+3


source to share


2 answers


If you are pushing to the web server from the same client, you are most likely doing a client setup on the server. It is perfectly okay for web servers to only allow a limited number of requests from the same client. Further requests are queued and processed only when one of the active requests has completed.

The exact amount of concurrent client requests allowed by a server depends on the specific server software and how it is configured, but the number is usually measured in one or two digits.

The first time I was bitten by this problem was about 10 years ago and there were 2 concurrent client connections at the time.



Note that a web server is usually happy to handle thousands of concurrent requests if they come from different clients.

This way, you cannot stress a test HTTP service from a single client. For this you need a distributed group of clients. Stress testing is hard.

+4


source


I don't have enough comments to comment, but as Mark said the default connection limit is actually 2.

Try setting the System.Net.ServicePointManager.DefaultConnectionLimit above in your code before making any HTTP requests.



System.Net.ServicePointManager.DefaultConnectionLimit <- numberOfConnections

      

+3


source







All Articles