SharePointDsc icon indicating copy to clipboard operation
SharePointDsc copied to clipboard

SPDistributedCacheService: Add support for backgroundGC

Open ChristophHannappel opened this issue 3 years ago • 3 comments

Resource proposal

The Article Installing Windows Server AppFabric updates SharePoint 2013 Servers recommends enabling the backgroundGC for the DistributedCacheService.exe via the DistributedCacheService.exe.config file.

Details Cumulative update package 3 for Microsoft AppFabric 1.1 for Windows Server.

SharePoint Subscription Edition enables this by default. All previous versions need to enable it manually. Since the SPDistributedCacheService has to run on every Node it would be a good fit, to add this to the ressource.

I can create a pull request, if this is the right ressource

Proposed properties

Property Type qualifier Data type Description Default value Allowed values
backgroundGC write boolean Should the DistributedCacheService use the nonblocking garbage collection (background server garbage collection) None $true, $false

Special considerations or limitations

Code Example

[system.reflection.assembly]::LoadWithPartialName("System.Configuration") | Out-Null

# intentionally leave off the trailing ".config" as OpenExeConfiguration will auto-append that
$configFilePath = "$env:ProgramFiles\AppFabric 1.1 for Windows Server\DistributedCacheService.exe"
$appFabricConfig = [System.Configuration.ConfigurationManager]::OpenExeConfiguration($configFilePath)

# if backgroundGC setting does not exist add it, else check if value is "false" and change to "true"
if($appFabricConfig.AppSettings.Settings.AllKeys -notcontains "backgroundGC")
{
    $appFabricConfig.AppSettings.Settings.Add("backgroundGC", "true")
}
elseif ($appFabricConfig.AppSettings.Settings["backgroundGC"].Value -eq "false")
{
    $appFabricConfig.AppSettings.Settings["backgroundGC"].Value = "true"
}

# save changes to config file
$appFabricConfig.Save()

ChristophHannappel avatar Mar 09 '22 12:03 ChristophHannappel

Hi @ChristophHannappel, I agree that the SPDistributedCacheService resource indeed sounds like the best resource for this enhancement! I have assigned this issue to you!

ykuijs avatar Mar 09 '22 22:03 ykuijs

Hi @ChristophHannappel, any idea when you are able to fix this issue?

ykuijs avatar May 13 '22 21:05 ykuijs

@ykuijs I think within the next 3 weeks. Ill have kinda working code and think creating a meaning full unit test is the largest challange for me

ChristophHannappel avatar May 14 '22 10:05 ChristophHannappel