Experience using gcServer="true" to set garbage collector for .NET

Experience using gcServer="true" to set garbage collector for .NET

后知后觉 发布于 2021-11-28 字数 336 浏览 801 回复 3 原文

Has someone used a configuration enabling the garbage collector optimized for multi-processor machines using Aspnet.config with :

<gcServer enabled="true"/>
<gcConcurrent enabled="true"/>

Was there an improvement in the performance of your site?
Are any problems noticed?

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


昔梦 2022-06-07 3 楼

Simply put, the Workstation GC mode improves performance for a single user, while the server GC mode is designed for use on a program that has multiple requests all the time. I truly hope that this question isn't a symptom of a much larger problem. sometimes when people start questioning the garbage collector it's because they're not seeing memory footprint that they were expecting. don't expect great gains with a different garbage collector. In almost all the tests I've done, it's made little difference which collector you are using.

暖伴 2022-06-07 2 楼

(very old question, I know, but I thought to add this anyway)

There's one major difference between Server GC and Concurrent GC: the Server GC has one thread per processor and suspends the threads on that processor when doing a collection, the server Concurrent GC thread runs in parallel with the other threads, i.e., no suspension. See this MSDN article for more info and more subtle differences.

Depending on the time a cycle takes, this can make a rather big difference in user responsiveness of your application, so choose wisely. In case of ASP.NET, which does not have a UI, Server GC is the better (and default) option.

与君绝 2022-06-07 1 楼

First, Concurrent and Server are mutually exclusive options. See this blog post for some details on server GC misconceptions. However, ASP.NET, by default, hosts the server GC (see Scott Hanselman's discussion), so there will be no difference there.

I'd recommend sticking with server instead of concurrent for an ASP.NET website. For a user-mode application, the concurrent GC has been user responsiveness, since the server gc will cause "hangs".

I have used the server GC, and noticed significant improvements in certain situations.

The server mode GC does help user apps, though, if you're user application is working with huge memory pools, and getting highly fragmented.