c# – Working with multiple processors (not cores)


There is some large .Net service application that does a lot of repetitive calculations, the calculations are bulky, but not the point. The main thing is that there are a lot of them. Well, we started using multi-threaded code and really saw a very strong performance gain.

We delivered this business to the clients, they are happy, everything is fine. They have a powerful server with a 24-core processor, we use almost all of these cores. And as time goes by, customers say MORE PERFORMANCE IS NEEDED. And they change the server, on which there are TWO PROCESSORS with 24 cores each. Our .net application code hasn't changed.

As a result, it began to work 3-4 times worse and slower. But as soon as you physically disconnect ONE processor, everything starts to work just as quickly.

And the question is, can anyone come across. How, in this case, can I correctly distribute the load not among the cores (it seems to work), but among the processors?


Not really an answer to the question, but still:

The program does not care about the number of processors, since this is the task of the OS. It is she who plans on which core of which processor to run the thread.

It seems to me that the problem is that by increasing one characteristic of the PC, another characteristic of the PC was not increased.

For example, you were running large collections in multi-threaded mode at 1 gig per thread and you were using 24 GB of memory (24 cores), which was available on the PC. Now you are using 48 gigs, although on a PC only 28 gigs => swap and everything is bad.

Also, the problem may be that you ran into IO-operations – the grid does not cope, the database dies.

In general, the problem may not be with the processors and need to be profiled. Look in the resource monitor, for example.

Scroll to Top