Is it possible to use Server Garbage Collection on Azure App Service?
I have set gcServer
in the web.config
(D:\home\site\wwwroot\web.config) as follows:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<gcServer enabled="true" />
</runtime>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\MyApplication.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
</system.webServer>
</configuration>
But GCSettings.IsServerGC
still returns false.
According to this, you could see the remark:
If server garbage collection is not enabled, workstation garbage collection is in effect (with or without concurrent collection). Server garbage collection is available only on multiprocessor computers.
By default, if your web app service plan is multiprocessor, like B2, S2, it will automatic enabled gcServer.
But if your web app service plan is B1,S1, it only has one core, it will enable workstation.
Here is test example:
I have a page which has below codes:
string result;
if (GCSettings.IsServerGC == true)
result = "server";
else
result = "workstation";
Response.Write(result);
Then I publish the web application to different app service plan.(B1,B2)
The result is as below:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With