Tuesday, June 11, 2013

In the Resource Governor feature of SQL Server, there was a clear separation between the classification rules and the resource plans. This was because the classification rules were dynamic in nature and could change for assigning the connections to different groups. Groups of connections shared the same pool of resources. The server only needed to keep track of the resource plans. These plans were determined by the administrator for the server and were actively looked up by the server when assigning resources to workloads. To the server the requests did not matter, they belonged to a group but the resources mattered since the server had to account for all resources and divide them between groups. The groups were a label for different connections and was an identifier to denote how much resources could be guaranteed to the server. The rules were for the connections and connections were transient. In comparison, the resource plans were more stable. Second the connections could have different characteristics. So the classification based on connection properties which could change with the next connection. So there is a need for a  classification logic. This logic is a simple user defined function that assigns the incoming connection to a group. This function evaluates the connections based on program order and in the form of a decision tree. This function called the classifier can be maintained independently from the resource plans. By its nature the classifier is code where as the resource plans is data. Furthermore, the resource plan data for the server is constantly read when assigning the resources and requires server reconfiguration after each change since it affects resource throttling for incoming connections. However the server need not know anything about the connections or persist any connection properties since these have been evaluated to a group. The group is a tag for the server that says these are a group of incoming connections on which a policy is applied as defined by the resource plans that this group is assigned to. The groups can be hierarchical as well where as the resource plans are discrete and flat.  The resource plans also have to tally up to the full server capability. Therefore it is owned and enforced by the server. The user connections on the other hand are mapped only once to different pools. In addition, it is written as any other user defined function. Although in practice this is done by the administrator and requires server reconfiguration since the server needs to know that the memberships to the groups have changed, the classifier is connection facing and hence qualifies as just one other user defined function. The decision to reconfigure the server after every classifier change was an important one. It is not merely sufficient to change the classifier to impact the next incoming connection, it is important for the server to know that the memberships to groups are being redefined. This means that connections that were previously coming to a group might now be classified to another group and the plans for that may deny resources to the new connection. The server treats the classifier and the plan definitions as together constituting the resource management policy. So if one of them changes the server's resource management behavior changes. In a way this is a way to tell the server that the policy has changed and is intended as a control for the administrator. Lastly, the policies and the plans are different because there are checks placed on the plan whereas the policies are arbitrary and have no particular relevance to the server. The checks on the plan however determine whether the next quantum of processing or the next memory allocation is changed The calculations by the scheduler or memory manager are dependent on the plan information and this is a state that's persisted so that the server can automatically pick up the state between restarts. Thus the resource policies and plans are treated differently.

No comments:

Post a Comment