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

前端 未结 5 2140
名媛妹妹
名媛妹妹 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:07

    Great question Luke! I'm very interested in the answer.

    I suspect that you were not expecting linear scaling, but something better than a 39% variance.

    NoBugz - Based on 280Z28's links, there would actually be a GC heap per core with GCMode=Server. There should also be a GC thread per heap. This shouldn't result in the concurrency issues you mention?

    ran into a similar problem that was due to the fact that the CLR performs inter-thread synchronization when allocating memory to avoid overlapping allocations. Now, with the server GC, the locking algorithm may be different - but something along those same lines may be affecting your code

    LBushkin - I think that that is the key question, does GCMode=Server still cause inter-thread locking when allocating memory? Anyone know - or can it simply be explained by hardware limitations as mentioned by SuperMagic?

提交回复
热议问题