Friday 19 June 2015

SCCM 2012 R2 Collection Design

This post was actually inspired by this thread how often do we actually think of designing a series of collection to help us to group the devices functionally and at the same time not sacrificing the SQL performance? 

I have spend a lot of time gathering information and to my pleasant surprise it is a very big subject by itself, from Collection to the performance of SQL is closely knitted. 

First what is collection?

From technet:

"Provide you with the means to organize resources into manageable units, which then enable you to create an organized structure that logically represents the kinds of tasks that you want to perform. "

So how is collection closely related to SQL? Collection creation is done using WQL, WQL is a subset of SQL and is mainly used in SMS provider to view device WMI details.

In SQL, you are unable to execute WQL, all the WQL queries are kept in: Collection_Rules_SQL views, in here you can see that the WQL statements in the collection is converted into SQL statement.

Second, after we learn how the collection is related to SQL, in order to take care of the performance, the collection should refrain from complex queries as it will with temporary stored procedures, table variables or cursors. This is especially more true if your collection is too complex: https://msdn.microsoft.com/en-us/library/ms190768.aspx


Third, since tempdb is important and we cannot ignore this, you really want to setup your SCCM server or any other related products that uses MS SQL with at least four databases. From this KB: 
https://support.microsoft.com/en-us/kb/2154845
  

Initial setup of 4 tempdb will be a good start off point. And because of  heavy I/O involved it will be a good idea to place the tempdb in a separate hard disk, if  you cannot afford to do that, monitor the size of tempdb and manage from there, give the initial size of the tempdb last than half of the CM database size. 

Assuming the CM database is 100GB, 

40GB (40% of 100GB) / 4 tempdb = 10GB each.

A nice article on tempdb initial sizing: http://logicalread.solarwinds.com/sql-server-tempdb-best-practices-initial-sizing-w01/#.VYQzIPmqpBc

My personal preference is to let the tempdb to grow in MB instead of percentage. To grow in MB helps you to capped it at a controlled fashion. To grow by 10% of 20GB is equal to 2GB vs To grow by 500MB at a time. 

Fourth, how can we build a better collection query then? A general rule of thumb, a good collection query should avoid:


Finally, considering all the above, you should consider the design of the Collection, although there no hard and fast rule in the design, a good collection design will not impact the SQL performance and to start off with a good design you should consider: 

And thank you to Senthil's blog as well to help me understand better: 


I hope this article have help you to understand your SCCM collection better. :) 

SY 

No comments:

Post a Comment