Can we control the amount of content that can be stored
within a Site Collection so that it doesn’t grow beyond acceptable boundaries?
Yes, Using Quotas
What is it?
A quota specifies
storage limit values for the maximum amount of data that can be stored in a
site collection. Quotas also specify the storage size that, when reached,
triggers an e-mail alert to the site collection administrator. Quota templates apply these settings
to any site collection in a SharePoint farm.
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
When sandboxed code
executes, certain metrics are collected such as % processor time and # of unhandled
exceptions. Timer jobs compile the metrics and calculate resource points
usage. When the total resource points used exceeds the daily limit (300
points by default), the sandbox is turned off for the entire site
collection. The following table describes the metrics collected and how
they are normalized to resource points:
Resource
|
Description
|
Units
|
Resources per Point
|
Limit
|
AbnormalProcessTerminationCount
|
Abnormally terminated process
|
count
|
1
|
1
|
CPUExecutionTime
|
CPU Execution Time for site
|
seconds
|
3,600
|
60
|
CriticalExceptionCount
|
Critical Exception Events
|
Events
|
10
|
3
|
InvocationCount
|
Solution Invocation Events
|
Events
|
<TBD>
|
<TBD>
|
PercentProcessorTime
|
% CPU usage by solution
|
%
|
85
|
100
|
ProcessCPUCycles
|
Solution CPU cycles
|
cycles
|
1 x10^11
|
1 x10^11
|
ProcessHandleCount
|
Windows handles count
|
items
|
10,000
|
1,000
|
ProcessIOBytes
|
Windows handles count
|
items
|
0
|
1 x10^8
|
ProcessThreadCount
|
Thread count in overall process
|
Thread instances
|
10,000
|
200
|
ProcessVirtualBytes
|
Memory consumed
|
Bytes
|
0
|
1.0x10^9
|
SharePointDatabaseQueryCount
|
Number of SharePoint database
queries
|
Query instances
|
20
|
100
|
SharePointDatabaseQueryTime
|
Elapsed time to execute query
|
seconds
|
120
|
60
|
UnhandledExceptionCount
|
Number of unhandled exceptions
|
Unhandled exception instances
|
50
|
3
|
UnresponsiveProcessCount
|
Number of unresponsive processes
|
Unresponsive process instances
|
2
|
1
|
For example, if
you developed a sandboxed web part that displayed data from a list, it would
perform a SharePoint database query each time it loads. 20 database
queries = 1 resource point, so if the web part was displayed 20 times, the site
collection would have used 1 resource point. The default site collection
maximum is 300 points, so the web part could be displayed 6,000 times in a 24
hour period; after that, the sandbox is turned off until a timer job resets
it. It's important to understand is that resource quotas can be
exceeded through high usage and is not necessarily an indicator of
poorly written code.
About planning quota management
The basic steps to plan quota management are the following:- Determine
quota template settings
There is no default quota template for site collections in a SharePoint Server 2010 environment
- Determine
recycle bin settings
The recycle bin can help to prevent the permanent deletion of content. The recycle bin enables site owners to retrieve items that users have deleted, without requiring administrator intervention such as restoring files from backup tapes. Key planning considerations include whether to use the second-stage recycle bin and how much space to allocate.
The recycle bin is turned on and off at the Web application level. By default, the recycle bin is turned on in all the site collections in a Web application.
- Delete
unused Web sites
You can delete a quota template if you change your quota structures. However deleting a quota template does not delete quota values from site collections to which a quota template has been applied. If you want to remove quotas from all site collections that use a specific quota template, you must use the object model or perform a SQL Server query.
Key Notes about Quota Management
- Quotas are only applied to Site Collections
- You can create a default quota template at the web application level, which will be used by new site collections created moving forward.
- Everything in a site encompasses the Quota space: files in document libraries, items in your lists, all web parts, all images, form templates, etc…
Create Quota using
Powershell
Get-SPWebTemplate | Out-File C:\SharepointWebTemplates.txt
Retreive the Current Quota settings for the site collection
(Get-SPSite -Identity "<Site Collection>").Quota
Where:
- <SiteCollection> is the URL of the site collection
Create
New Quota Template
$quota = New-Object
Microsoft.SharePoint.Administration.SPQuotaTemplate
$quota.Name = “Dhaval”
$quota.StorageMaximumLevel = ((10 * 1024) * 1024)
$quota.StorageWarningLevel = ((8 * 1024) * 1024)
$quota.UserCodeMaximumLevel = 100
$quota.UserCodeWarningLevel = 80
$service =
[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$service.QuotaTemplates.Add($quota)
$service.Update()
|
Delete Quota Template
$service =[Microsoft.SharePoint.Administration.SPWebService]::ContentService
$service.QuotaTemplates.Delete($QuotaTemplateName)
$service.Update()
|
Configure Quota and Locks
Option
|
Option Description
|
Unlock |
Not locked |
NoAdditions
|
Unlocks
the site collection and makes it available to users. |
ReadOnly |
Adding content prevented |
NoAccess
|
Prevents
users from adding new content to the site collection. Updates and deletions
are still allowed. |
To lock or unlock a site collection by using Windows
PowerShell
Set-SPSite
-Identity "<SiteCollection>" -LockState
"<State>" –QuotaTemplate “<Quota Template>”
Where:
- <SiteCollection> is the URL of the site collection that you want to
lock or unlock.
- <Quota Template> is the name of the quota
template
- <State>
is one of the following values:
- Unlock
to unlock the site collection and make it available to users.
- NoAdditions
to prevent users from adding new content to the site collection. Updates
and deletions are still allowed.
- ReadOnly
to prevent users from adding, updating, or deleting content.
- NoAccess
to prevent users from accessing the site collection and its content.
Users who attempt to access the site receive an error.
References:
No comments:
Post a Comment