Why doesn't my threaded .Net app scale linearly when allocating large amounts of memory?

前端 未结 5 2102
名媛妹妹
名媛妹妹 2021-01-05 06:06

I’ve run into something strange about the effect of large memory allocations on the scalability of the .Net runtime. In my test application I create lots of strings in a tig

5条回答
  •  北海茫月
    2021-01-05 07:00

    The hardware you're running this on is not capable of linear scaling of multiple processes or threads.

    You have a single memory bank. that's a bottle neck (multiple channel memory may improve access, but not for more precess than you have memory banks (seems like the e5320 processor support 1 - 4 memory channels).

    There is only one memory controller per physical cpu package (two in your case), that's a bottle neck.

    There are 2 l2 caches per cpu package. that's a bottle neck. Cache coherency issues will happen if that cache is exhausted.

    this doesn't even get to the OS/RTL/VM issues in managing process scheduling and memory management, which will also contribute to non-linear scaling.

    I think you're getting pretty reasonable results. Significant speedup with multiple threads and at each increment to 8...

    Truely, have you ever read anything to suggest that commodity multi-cpu hardware is capable of linear scaling of multiple processes/threads? I haven't.

提交回复
热议问题