Performance of an Api that mocks any Api #55224
Replies: 2 comments
-
You could consider instead using chaos engineering in your application that calls remote services and inject faults and delays into its |
Beta Was this translation helpful? Give feedback.
-
given the main question don't get me wrong, chaos eng is valuable... but the scope here is other |
Beta Was this translation helpful? Give feedback.
-
One of the challenges I face when I'm "battle-proofing" my Apis is determining how they behave when their dependencies are not behaving as expected.
It's easy to setup a test environment that performs "perfectly" and find out that your code can support 1000 req/s per sec. But the question im trying to answer is "How does my application behave when that Api that I have as a dependency stops responding at 15ms and starts fluctuating between 500 and 2500ms?"
In order to do that, I thought: what if I create a api, that you can dynamically setup a test, that accepts anything and replies a random-within-a-set-of-pre-defined-responses BUT delays the requests by a random value between 500 and 2500?
So, first I created a controller and
Then based on a lot of caching and optimizations, I got my part of the code working consistently under 5ms on my local machine, in debug mode... but that's only my part of the code. On the client side (fiddler everywhere) a call to my app running http on localhost takes no less than 10ms (for this case, my code took 1ms).
What can I do to cut that "infra" time?
Ideias i had so far but don't know how to implement:
Currently my "Program.cs" is:
Edit 1
Content-Length
helped a bit... somehowTransfer-Encoding: chunked
was adding-upBeta Was this translation helpful? Give feedback.
All reactions