Balancing Resources for SQL Server Clustering and Consolidation

By:   |   Updated: 2008-08-13   |   Comments   |   Related: > Clustering


Problem

In my SQL Server environment we initially clustered to support a consolidation effort in which we were focusing on elimination of approximately thirteen Microsoft SQL Server 2000 and 2005 instances.  Along the way we had a mission critical application that was backed by SQL 2000 that was budgeted without hardware for supporting a dedicated SQL Server instance.  We were forced into hosting this database on our relatively new SQL 2005 Enterprise cluster as a result.  Our consolidation effort essentially ended on the day that decision was made.  I've finally been able to make the case that this application needs a dedicated SQL environment.  What started as a single database for supporting this product has morphed into an eight-database suite that, through design and support, requires more than its share of system (and Database Administrator) resources because of where it is hosted. 

Just because you have disk space, plenty of memory, and abundant CPU does not mean you can pile databases onto an instance of Microsoft SQL Server; you need to pay attention to load balancing.  In the case of a clustered environment I take it one-step-removed: a step I like to call node balancing.

Author's Note:  This is part three of a continuing series on Microsoft SQL Server 2005 Clustering.  Some of the terminology used in this tip and future clustering tips in the series were defined and explained in parts 1 and 2.  While parts 1 and 2 are not pre-requisites for this tip it is advised that you also read those tips in this series (and any future tips as well!) 

Solution

Node Balancing

Microsoft Clustering Services are not designed for load balancing, but rather failover in the event of hardware failure.  Therefore when I play off the concept of load balancing what I am actually referring to is the process by which I make a determination of which databases to host on my various SQL Server instances.  I base this determination on a number of factors:

  • Relative importance of the application to the entity
  • Amount of resources required by the database(s) that support this application
  • Level of access required by the support staff (possibly Third-Party Vendor)
  • Architectural considerations
  • Collation requirements

Each one of these factors may determine how I formulate my architectural recommendations for hosting any particular database that is a candidate for clustering.  However it is usually a combination of factors that determine why I may choose to host a database or set of databases on their own cluster, own active node in a cluster, or on a shared node with multiple non-related databases.  I detail each of these factors next with recommendations based upon my experience for each.

Relative Importance of the Application

There are two distinct reasons for clustering Microsoft SQL Server:  consolidation and fail-over.  Consolidation will allow you to host multiple databases together on a single SQL instance up to a point where the resources of the server can no longer support additional database activity.  Clustering for failover allows you to maintain an actively-accessible database instance in the event a node in the cluster encounters stress or damage and a shutdown occurs.  Databases that are considered "mission critical" should be hosted in such a way that affords high-availability.  For the purposes of this tip we will state that the solution we're recommending for that purpose is failover clustering.  Conversely, databases that don't meet the requirements of being "mission critical" do not necessarily need to be available if a hardware failure is encountered.  They may be able to be down for a short period of time, perhaps even for days depending upon their usage patterns.  These databases may be hosted on the cluster only for the sake of consolidating multiple instances worth of databases on a more powerful clustered instance of SQL Server.  More powerful?  Certainly.  If you're going to take advantage of clustering I strongly suggest that you do so based upon the 64-bit platform and with Enterprise Edition SQL Server.  The limitations against Standard Edition SQL (no online indexing, limitation on only two nodes in a cluster) make it a less-expensive, yet less scalable solution.

For the basis of this tip I will break down the database classes, based upon criticality into three tiers.  These are the classifications we use in our company and it works well for us (so far).

  • Tier 1 - Your company's most-important databases.  You may perhaps have only one of these - maybe as many as a half dozen.  These are the systems that keep your company running or service your customers with their critical data requirements:  databases providing data related to Patient Care, Online Banking, or Criminal History information would be candidates for this class of databases.
  • Tier 2 - These are the databases that host data for applications that, while important, may allow some appreciable measure of downtime.  Payroll , Educational Registration, Annual Employee Performance Review programs, and E-Commerce sites would fall into this category.
  • Tier 3 - We all have plenty of these in our environments.  These are the databases that get created because someone in accounting wanted to "upsize their Excel Database".  These databases typically support department-level internal applications that run during business hours and can be down for periods of time with effect only on productivity of a select group on individuals.

Let's take care of the easy choice first:  Tier 3 databases should be hosted together.  There, that was easy.  Seriously, we do not need to dwell on the Tier 3 databases, we need to focus our attention on answering the following questions:

  • Should Tier 1 databases be hosted on a dedicated node in shared cluster or should they be hosted in their own active-passive cluster?

I've advocated both sides of this debate at different points in time.  By placing the Tier 1 database on a dedicated node within a larger, shared cluster you still reap the benefits of clustering, with only a single additional server to manage.  (So long as there is already a passive node in the cluster.)  If you were to dedicate a complete cluster for the sole purpose of hosting this database you must add at least two new servers to your environment along with all the maintenance and administration that entails - not only for you, but for the multitude of teams and staff that are responsible for supporting a server in today's IT environments.  One should also not forget the added costs associated with yet another passive node (hopefully) just sitting idle in your data center.  Conversely, what happens if this database or one of the others in the cluster require a patch or configuration change at the server level?  In a clustered architecture this requires all nodes in the cluster to be patched regardless of whether the database is currently being hosted on the server.  You need to be prepared for a failover situation and this requires that all nodes in the cluster be identical in content and configuration from a software perspective.  Therefore you may find yourself in a situation where a Tier 2 or Tier 3 database causes compatibility issues for a Tier 1 database in your shared cluster - even if the Tier 1 database is hosted on its own node.

Recommendation:  If you have the funding, Tier 1 databases, those that are most-critical to the well being of your company and customers, should be hosted on their own cluster.  Furthermore, it is recommended that you also provide additional redundancies to protect against media (disk) corruption on the SAN volumes assigned to the database via third-party SAN replication tools or by native SQL technologies such as replication, database mirroring, or log shipping.

  • Should Tier 2 databases be hosted on the same node as Tier 3 databases or should they be on their own dedicated node in a shared cluster?

Just because a database may be classified as Tier 2 using the definitions I've presented does not make it unimportant.  However, they seldom would require their own dedicated cluster unless you're company manufactures money or has worked out that whole alchemy process of turning rocks to gold.  These databases would need to compete for resources equally against less-important (and possibly more intrusive databases) if hosted on the same node with Tier 3 databases so in most situations that architecture is not advised either.  This is where you need to also take other factors such as resource requirements and activity trends into consideration in attempts of balancing a node for support of perhaps one or more Tier 2 databases.

Recommendation: if funding permits host Tier 2 databases on their own node in an shared cluster environment.  If resources allow, and your benchmarking proves that multiple Tier 2 databases can co-exist on the same node, host those databases together.  Considerations need to be taken for any database that is hosted on a shared Microsoft SQL Server instance.  Failovers, maintenance, and downtimes will impact all databases on the instance. 

 

Amount of Resources Required by The Database

I support hundreds of databases in my environment.  We have very large databases that have very little activity.  We have relatively small databases that have hundreds of concurrent static connections that remain open all day long.  We have a little bit of everything in between.  What may be the most consuming task for a Database Administrator is determining just what usage patterns each of your databases have.  The process for collecting this information is outside the scope of this tip, but I'll make suggestions for resources at the end of this tip on how to determine load over time for a specific database.  Once you've collected this data, the goal is to balance out the resource requirements across all your databases you plan on hosting on a given instance.  What makes this process extremely difficult is that some items that impact resources greatly may be out of your control - even as the Database Administrator.  A properly-indexed INSERT query may run in fractions of a second, however that same query, with inadequate indexes or out-of-date statistics, may run for minutes or worse.  If this is a database that was developed in-house you may have the ability and rights to correct the issue by adding or altering the indexes.  If this is a commercially-developed database your company purchased you may have the ability to make similar changes, but may be precluded from doing so by the nature of an existing support agreement with the vendor.  There is also the impact of application life cycles.  Your company comes to rely more (or perhaps less if the case may be) on a database over time.  This means your initial performance monitoring results used to determine how and where to host a given database may become outdated. The information you collect over a sampling period may not be indicative of the database activity or impact later in your production environment.

This is the grayest of gray areas - a sliding scale of metadata - one of the leading causes of premature baldness, depression, and substance abuse by Database Administrators.  Unfortunately it is also an important process in determining the hosting structure for your databases.  I highly recommend rounding up whenever possible for the sole reason that it is better to have excess resources sitting idle on your database servers than finding yourself in need of resources when your databases need it most.

Recommendation:  Use SQL Server Performance Monitor and Profiler to monitor activity against candidate databases for clustering to best determine high and low points in activity throughout a typical week in order to find databases that may be compatible for co-hosting on a shared SQL Server instance in your enterprise's cluster.

 

Level of Access Required by Support Staff/Vendor

So we move from difficult to easy.  This really is a simple line-in-the-sand for most Database Administrators.  On one side of the line: Database Role Rights.  The other side of the line: Server Role Rights.  If the support team (be they internal or third-party) is agreeable to having their permissions to a SQL instance capped at Database role rights (db-owner role rights or less) then this makes the database a candidate to be hosted on a shared SQL instance.  It is also quite common that a support team would need to have certain role permissions in msdb to support any jobs associated with their database(s).  I would still consider this a candidate for a shared database environment.  However, if the vendor or support team mandates that they have any level of Server Role membership (System Administrator, Database Creator, Security Administrator, etc.) then they are going to be isolated to a dedicated SQL instance.  The reason is that it is the primary responsibility of the Database Administrator to isolate access to only those individuals, teams, or entities that have legal, ethical, or commercial rights on any given database.  If you allow a vendor for database X to have server-level permissions on a SQL instance they could conceivably affect every other database on that instance.

Recommendation:  If you can not limit non-DBA access to database-only rights, and server-level permissions, role rights, or securables are required by the application support staff then the database(s) in question should be on a dedicated node within your cluster.

 

Architectural Considerations

This category exists for only a single question:  is there a mandate, by either the structure of the application and database or by support agreements, that the application and the database must reside on the same physical server?  If so, not only should you not look at clustering for this solution, but you should definitely plan to dedicate an instance to just the database(s) that support this application.

If the program architecture requires the database to reside on the same physical server as the application, web, or other non-SQL Server components then do not host the database within your cluster.  Instead dedicate a standalone SQL instance for the database(s) and provide redundancy/high-availability by other means such as replication, database mirroring, or log shipping.

 

Collation Requirements

Granted, in SQL Server 2005, the collation settings for the databases can be different from the collations for the system databases.  However, it is critical that you realize that there are implications when an vendor mandates their databases run under a specific non-standard collation.  Typically the issue is tempdb.  Think of all the processing that occurs in tempdb: this is where temporary objects are created for all databases such as temp tables, table variables and cursors.  Work tables used by SQL Server to internally sort data are created in tempdb.  Issues arise when tempdb is a different collation than the user database and results of computations may not match expectations.  My suggestion when non-standard collations are specified is to ask if this is a requirement or a preference.  If a requirement ask for specific reasons why this collation is required.  (You'll be shocked how many times vendors will erroneously cite "That's what Microsoft's documentation states!")  If a non-standard collation is required then you're looking at a dedicated instance of SQL Server.  I recently had to rebuild a cluster node only because I did not use the default collation for SQL 2005, but rather selected the same criteria piecemeal and built my own collation.  Since it did not match in name to "SQL_Latin1_CI_AS", scripts in a single database running alongside 40 other databases failed a validation check.

Recommendation:  If a non-standard collation is required it does not mean you can not host the database in the existing cluster, however it may require you to dedicate an instance of SQL only for this database.  You may be able to set the minimum and maximum memory requirements for this instance low enough to reside on an existing node with another SQL Server instance depending upon the required resources for the database in question.  You may need to dedicate a node for the SQL instance if you find resource contention between this instance and any other instances running on the same cluster node.  It is best to determine if the non-standard collation is a requirement or a request.

Next Steps


sql server categories

sql server webinars

subscribe to mssqltips

sql server tutorials

sql server white papers

next tip



About the author
MSSQLTips author Tim Ford Tim Ford is a Senior Database Administrator with MindBody.

This author pledges the content of this article is based on professional experience and not AI generated.

View all my tips


Article Last Updated: 2008-08-13

Comments For This Article

















get free sql tips
agree to terms