1

How do I make use of all virtual processor in my .net application on an AWS c5.18xlarge instance? Currently the application tops out at 36 out of 72 virtual processors (50%).

On AWS, I launch a c5.18xlarge instance, advertised with 72 virtual processors.

  • When I run a .NET application, Task manager shows maximum load at 50%.
  • When I query Environment.ProcessorCount, it returns 36.
  • When I open Start > "System Information" > System Summary, I can see 2 entries for "Processor: Intel(R) Xeon(R) Platinum 8124M ... 18 cores, 36 logical processors".
  • However, when I run 2 separate .net applications, I achieve 100% load.
  • Initially I though it might be a maximum value in the the default task scheduler, but even when I create 72 threads explicitly, it still tops out at 50%.

Example application 1:

Parallel.For(0, 1000, i =>
{
    var w = new Stopwatch();
    w.Start();
    Console.Write("#");
    while (w.ElapsedMilliseconds < 1000);
});

Example 2:

for (var i = 0; i < 72; i++)
{
    new System.Threading.Thread(() =>
    {
        var w = new Stopwatch();
        w.Start();
        Console.Write("#");
        while (w.ElapsedMilliseconds < 5000);
    }).Start();
}

I'm using Roslyn / C# interactive.

Closest matching article I found didn't help..

typpo
  • 717
  • 7
  • 10

1 Answers1

2

Figured it out..

To enable .NET to use all NUMA nodes, add the following to your app.config:

<configuration>
  <runtime>
    <Thread_UseAllCpuGroups enabled="true"/>  
      <GCCpuGroup enabled="true"/>  
      <gcServer enabled="true"/>  
</runtime>
</configuration>

Now it's chirping away at 100%.

Sources:

typpo
  • 717
  • 7
  • 10