Sizing SharePoint - The 2nd stage Site collection recycle bin

One of my customers asked me about the impact about the 2nd stage recycle bin on sizing a new farm. They were concerned that the default value of 50% of the current site quota could have a negative impact on sizing the farm and could influence the expected size of the contentDBs. This setting can be changed on a web application level:

My initial response to the customer was that this value could be ignored most likely, and that this feature is there to help the administrators of SharePoint, since they don't need to start a restore if the item can be retrieved from there. Since I used "most likely", the answer did not pass, and the customer wanted a real percentage number that they could plug into their calculations.

So I started a PowerShell session on one of their farms in order to retrieve some actual values...

The Script I wrote for this is here:


 

asnp *sh* -ea 0

 

$countS1 =0

$countS2 = 0

$SizeS2 = 0

$SizeS1 = 0

$SizeSite = 0

 

### Get all sites in the farm

$sites = get-spsite -limit all

foreach ($site in $sites)

{

    $site.Url

    $SizeSite += $site.Usage.Storage / 1MB

    foreach ($item in $Site.Recyclebin)

    {

        if ($item.ItemState -eq "SecondStageRecycleBin")

        {

            $countS2 ++

            $SizeS2 += $item.Size / 1MB

        }

        else #Yes i know, stage can be "Invalid, but i dont care

        {

            $countS1 ++

            $SizeS1 += $item.Size / 1MB       

        }#End If

    } #End Item

    $site.Dispose()

} #End Sites

 

"Site count = " + $Sites.length

"Total recycled items = " + ($countS1 + $countS2)

"Total Size Site in MB = " + $SizeSite

"Total Size Stage 1 in MB =" + $SizeS1

"Total Size Stage 2 in MB =" + $SizeS2

"Stage 2 Percentage vs total size =" + ($SizeS2 / $SizeSite) * 100


And for our test farm, it generated the following output (Added decimal Points for clarity, and removed all Site URLs)...

Site count = 7894

Total recycled items = 333,003

Total Size Site in MB = 5,222,218.89358997

Total Size Stage 1 in MB =89,204.0437278748

Total Size Stage 2 in MB =45,874.8446807861

Stage 2 Percentage vs total size =0.878455032535985

Which means even with a 50% quota buffer, we are using less than a single % on a Farm with almost 5 TB of data. I know that this number can fluctuate a lot, but if your sizing is unable to handle this you should consider a very close monitoring of Farm, and then this should be no issue ;)

I would consider that a number I would ignore on a sizing calculation, esp. since there are other traps that can hurt you much more, like auditing data, workflows or whole sitecollections which wait for a restore in the contentDB. I would even go as far as suggesting to increase this value from 50% to 100% , which would allow even the recovery of a subweb, which can contain almost the whole sitecollection. The additional cost you pay for this is easily absorbed by the increased ease of recovery. Always remember that SharePoint has many options to recover a lost Document/Site... Make sure you try the internal options before you start to restore a database... And this includes Restore-SPDeletedSite

 

Greetings

Heiko Hatzfeld