I have an application that spins up a bunch of HttpListener GetContextAsync' tasks- one per request ideally
However when running a stress test (Hitting it with JMeter) i seem to be CPU bound but to only 50% cpu usage in total (Machine has 2 vcpus)
Is there something i'm missing here or a quirk in .NET Core on linux that is required to get it to run with more than 1 core? It hits and sits at 50% exactly - I've also tried using a Semaphore to limit concurrent connections etc, but no luck
The code that is creating the tasks is below - from my understanding of .NET Tasks they will spin up new threads when required (But will share if not needed) until the thread pool is maxed out - which should result in 100% cpu utilization
while (_listener.IsListening)
{
HttpListenerContext c = await _listener.GetContextAsync();
Task unawaited = RunContext(c);
}