I got caught on this one last week. I was load testing a web api resource using ApacheBench and was getting some really bad perf figures in the region of 40 req/sec when I would have expected an order of magnitude more at least. The data model being sent as JSON was:
1 2 3 4 5 6 7 8 9 10 11
When deserialising the request body into the dataModel, the constructor gets called and we have the overhead of the slow
ComputerInfo().AvailablePhysicalMemory call to get the available memory of the machine. Multiply this in a load test scenario and there’s the culprit.
The fix is simple:
1 2 3 4 5 6 7 8 9 10
The client changes to: