Wednesday, October 2, 2013

Sandbox fail due to ProcessCPUCycles

If your sandboxed code is breaking due to the process cpu cycles, you will need to do 2 things:

1) Optimization

  • Try to reduce unneeded operations.
  • Try to reduce the amount of data requested/transmitted.
  • Optimize CRUD operations.
  • Follow the good practices.



2) Increase the ProcessCPUCycles value. My suggestion is to double the original value as starting point. Keep in mind that the ProcessCPUCycles may differ between environments, so if you have a pre-production, maybe you will need to set different values in production.

This is the PS code that you will need to run.

$spCodeService = [Microsoft.SharePoint.Administration.SPUserCodeService]::Local
$cycles = $spCodeService.ResourceMeasures["ProcessCPUCycles"]
$cycles.AbsoluteLimit = 2000000000000 # VALUE
$cycles.Update()



Regards.

No comments:

Post a Comment