ResourceMeasures Gets the collection of measures for regulating the resource usage of services in the Microsoft SharePoint Foundation farm.
With this class you can have full control over the measures. That means you can disable them or just adjust the value you think are more appropriate for your farm. I will say it is dangerous to play around with these properties because it gives you a really powerful weapon.
For the time being these are the measures we can access, disable/enable or just assign a particular value:
I am going to show you two simple snippets two show you how these works.
- This example disables CriticalExceptionCount:
Microsoft.SharePoint.Administration.SPUserCodeService _spUserCode = Microsoft.SharePoint.Administration.SPUserCodeService.Local;_spUserCode.ResourceMeasures["CriticalExceptionCount"].ResourcesPerPoint = 0;_spUserCode.Update();
- This example assigns a limit of 50 to the CPUExecutionTime:
Microsoft.SharePoint.Administration.SPUserCodeService _spUserCode = Microsoft.SharePoint.Administration.SPUserCodeService.Local;_spUserCode.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit = 40;_spUserCode.Update();
Conclusion: Before playing around with these values, I highly recommend to back up the server. That is my conclusion… so good luck!