Udostępnij za pośrednictwem


Configure resource points for sandboxed solutions (SharePoint Server 2010)

 

Applies to: SharePoint Foundation 2010, SharePoint Server 2010

To restrict the resources that your sandboxed solutions consume, you define resource points. Resource points correspond to specific levels of resource usage that you can define for up to 15 system resources that you want to monitor. Each of these resource measures accumulates points based on a single sandboxed solution's use of that resource, and those points are aggregated toward a quota that has been set for the whole site collection. If the number of accrued resource points exceeds the quota set for the site collection, all sandboxed solutions in the site collection are stopped. For a list of the individual resource measures and the minimum threshold, absolute limit, and resources per point for each resource, see Resource Usage Limits on Sandboxed Solutions in SharePoint 2010 (https://go.microsoft.com/fwlink/p/?LinkId=217149).

Quotas are managed through the SharePoint Central Administration Web site as a single number that controls the aggregate total of the resource points allowed per day for all sandboxed solutions in a site collection. For more information about quotas, see Sandboxed solutions overview (SharePoint Server 2010). For information about how to set the maximum resource quota for a site collection, see Change the storage limits for a site collection in Manage site collection storage limits (SharePoint Server 2010).

You can fine-tune the resource point distribution by using Windows PowerShell, as described in this article. When these Windows PowerShell commands are added to a script, you can configure the individual resource point distribution within the sandboxed solution quota for a site collection. For more information about quotas and resource points, see Sandboxed solutions overview (SharePoint Server 2010).

The Sandbox Solution framework provides a mechanism for executing user-provided code outside of the IIS worker process. The Sandbox Solution framework should not be used as a mechanism for enforcing security boundaries when executing user code. Sandbox Solutions are not supported as a security boundary with user code, especially code of unknown origin. We advise against executing Sandbox Solutions of unknown origins.

In this article:

  • Display resource point allocations for sandboxed solutions

  • Configure resource points for sandboxed solutions

Note

To perform the following procedures, you must be logged on to the server that hosts the site collection that you are modifying. The sandboxed solutions service must be running on this server.

Display resource point allocations for sandboxed solutions

The following procedure enables you to display the current resource point allocations for sandboxed solutions on the current SharePoint Server server. You can use Windows PowerShell commands to display the current resource point allocation in a script that alters the point distribution, and you can also use these commands to verify the current allocation.

To display resource point allocations for sandboxed solutions

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin. You must be a member of the farm administrators group.

  2. Copy the following code and paste it into a text editor, such as Notepad:

    $uc=[Microsoft.SharePoint.Administration.SPUserCodeService]::Local
    $uc.ResourceMeasures | Select-Object Name,ResourcesPerPoint,AbsoluteLimit
    
  3. Save the file, naming it DisplayQuotas.ps1.

  4. On the Start menu, click All Programs.

  5. Click Microsoft SharePoint 2010 Products.

  6. Click SharePoint 2010 Management Shell.

  7. Change to the directory where you saved the file.

  8. At the Windows PowerShell command prompt, type the following command:

    ./DisplayQuotas.ps1
    

Configure resource points for sandboxed solutions

You can use Windows PowerShell to modify the distribution of sandboxed solution resource points to fine-tune resource usage for specific SharePoint Server site collections.

To configure specific resource points

  1. Verify that you meet the following minimum requirements: See Add-SPShellAdmin.

  2. Copy the following code and paste it into a text editor, such as Notepad:

    $uc=[Microsoft.SharePoint.Administration.SPUserCodeService]::Local 
    $uc.ResourceMeasures["CPUExecutionTime"].AbsoluteLimit = <LimitValue>
    $uc.ResourceMeasures["CPUExecutionTime"].ResourcesPerPoint = <PointValue>
    $uc.ResourceMeasures["CPUExecutionTime"].Update()
    $uc.Update()
    

    Where:

    • <LimitValue> is the new maximum limit value.

    • <PointValue> is the new number of resources per resource point.

  3. Save the file, naming it ConfigurePoints.ps1.

  4. On the Start menu, click All Programs.

  5. Click Microsoft SharePoint 2010 Products.

  6. Click SharePoint 2010 Management Shell.

  7. Change to the directory where you saved the file.

  8. At the Windows PowerShell command prompt, type the following command:

    ./ConfigurePoints.ps1
    

See Also

Concepts

Sandboxed solutions overview (SharePoint Server 2010)
Plan sandboxed solutions (SharePoint Server 2010)
Enable sandboxed solutions on the farm (SharePoint Server 2010)
Block or unblock a sandboxed solution (SharePoint Server 2010)
Configure load balancing for sandboxed solutions (SharePoint Server 2010)
Configure sandboxed solutions service tiers (SharePoint Server 2010)