Under Performance of Unique Permissions

In this article we can explore the Performance Impact on Unique Permissions.

clip_image002

What is Unique Permission?

In SharePoint there are mainly 2 types of Permissions:

1. Inherited Permission

2. Unique Permissions

While creating a site, list or library by default it INHERITS permissions from its parent. In this case whatever permission changed in the parent level will get carry forwarded to the new child.

For example you have a COMMON site where all the employees have READ access. You are creating a new RESTRICTED library under this site, which by default all the employees can read.

In the above case you can BREAK inherited permission at the list level & add only those users with read permission. This method is called BREAKING PERMISSION or assigning UNIQUE PERMISSION.

Performance Impact

Coming to the point, I have noticed that there are rumors spreading unique permission lead to UNDER PERFORMANCE meaning there is more time in loading the list or list items associated.

Following are the 3 cases which we are going to examine here:

· List with Inherited Permission vs. List with Unique Permission

· List Items with Inherited Permission vs. List Items with SOME having Unique Permissions

· List Items with Inherited Permission vs. List Items with ALL having Unique Permissions

Let us BENCHMARK the performance with a 1000 item scenario.


 

Benchmark Application

I am using a small WPF application which creates the lists & list items associated. Please note that the Performance is tested only for accessing the list items.

clip_image004

The Code

Following is the code to create Lists.

private void CreateList(string title)

{

using (SPSite site = new SPSite(UrlText.Text))

{

using (SPWeb web = site.OpenWeb())

{

// Delete List

if (web.Lists.TryGetList(title) != null)

{

web.Lists[title].Delete();

}

// Create List

Guid guid1 = web.Lists.Add(title, string.Empty, SPListTemplateType.Contacts);

web.Lists[guid1].OnQuickLaunch = true;

web.Lists[guid1].Update();

SPList list = web.Lists[title];

// Insert new items

for (int i = 1; i <= 1000; i++)

{

SPListItem item = list.Items.Add();

item[“Title”] = “Title” + i;

item[“ZIP/Postal Code”] = i;

item.Update();

}

}

}

}

Following is the code that breaks the inheritance in list level.

private void BreakListInheritance(string title)

{

using (SPSite site = new SPSite(UrlText.Text))

{

using (SPWeb web = site.OpenWeb())

{

web.Lists[title].BreakRoleInheritance(true);

}

}

}

Following is the code that breaks inheritance in item level.

private void BreakListItemsInheritance(string title, int count)

{

using (SPSite site = new SPSite(UrlText.Text))

{

using (SPWeb web = site.OpenWeb())

{

SPList list = web.Lists[title];

for (int i = 0; i < count; i++)

{

list.Items[i].BreakRoleInheritance(true);

}

}

}

}

On running the application the Milli Seconds observed were following:

· Case 1 with both lists around 90 milliseconds

· Case 2 with both lists around 90 milliseconds

· Case 3 with both lists around 90 milliseconds

You can use the source code attached to examine the code & run the application.

 

The Conclusion

As we have tested with Breaking Inheritance in List level, Items level, All Items level and still cannot find any enormous difference in Performance for a typical 1000 items scenario.

Please note that breaking inheritance in item level up to 1000 items is a rare case.

clip_image002[1]

clip_image007

Whenever Unique Permissions are implemented there are more calls to the database in fetching Permission Information. But we can see that if there are only few items involved (for example less than 100), the performance impact is negligible.

References

http://bit.ly/10uiVpB

Summary

In this article we have explored various case studies involving Unique Permissions. The typical benchmark scenario shows that there is no much impact in performance in just breaking permissions.

Leave a Reply

Your email address will not be published. Required fields are marked *