Wednesday, January 15, 2014

Failover Cluster Terminology

Failover Clustering Terminology

Node – A node is an individual server in the cluster.

Cluster Resource - A hardware or software component in the cluster such as disk, Virtual Name and IP Address.

Resource group – Cluster resources are contained within a cluster in a single unit and this is also called application and service group. 

Active Node – An active node is one that cluster is currently running, A resource or resource group is only be active on one node at a time.

Passive Node – A passive node is one that cluster is currently not running on it.

Cluster Access point – A cluster access point is the term used in windows server 2008 R2 failover clusters that represents the combination of network name and associated IP address resource. 

Virtual Server – Virtual server consists of network name and IP address to which clients are connect. This helps the client to connect the service which hosted in the cluster environment without knowing the details of server nodes.

Witness disk / file share – The cluster witness or the witness file share are used to store the cluster configuration information and help to determined the state of the cluster when some, if not all, of the cluster nodes cannot be contacted.

Cluster Quorum – The cluster quorum maintains the definitive cluster configuration data and the current state of each node, each services and application group and each resource network in the cluster.

Private storage – Local disks are referred as private storage; There will be one private disk for OS and SQL binaries.

Shared disk – Each server needs to be attached to external storage, in non-clustered environments data is stored under local disks whereas in clustered environment data is stored under shared disk, then only the nodes which are in cluster can access the shared disk.

Public network / private network – Each node needs two network cards, one is the public network and the other is private network between the nodes. The private network is used internal communication of network called as heartbeat. Public network is connected to LAN / WAN.
Heartbeat – It is a health check mechanism of the cluster, A single UDP packet is sent to all nodes in the cluster via private network to confirm whether all nodes in the cluster is online or not, By default cluster service will wait for 5 seconds (one hearbeat sent in every second) before considering the cluster node is unreachable.

LooksAlive – It’s a basic resource (SQL Service) health check to verify whether the service is running fine or not, to perform this cluster service queries the windows service control manager to check the status of the service. By default lookalive check will happen in every 5 seconds

IsAlive – An exhaustive check to verify that a resource is running properly. If this check fails the resource is moved offline and failover process is triggered, during the IsAlive check the cluster service connects to SQL Instance and executes @@servername. It will check only the SQL instance availability and doesnot check the availability of user databases.

Possible Owners – These are the server nodes of cluster group

Preferred Owners – This is the best suited for running application group. 

Friday, January 10, 2014

What is Cluster? And Types of Clusters and how to setup


What is Cluster? And Types of Clusters and how to setup

Cluster -- A cluster is a group of independent computers (nodes) that are presented to the network as a single system. There are different types of high availability solutions

NLB - Network Load Balancing Cluster, it works on network level but not at resource level. A server in the network load balancing cluster is known each other, when one server fails the other server automatically redistributes the connections among themselves. This offers horizontal scaling and you can simply add new server when network load increases. There will be no data sharing between the servers which are configured in NLB, it is widely used in few areas such as web servers, file servers, printer servers, terminal servers etc., This is primarily to distribute load (requests) to different nodes which are part of cluster. 

NLB doesn’t require any special hardware, an NLB farm can include 32 nodes, but you can start with high availability with 2 nodes and nodes can increased when traffic increases. For setting up network load balancing all you need is 2 or more nodes connected to a common network and additional IP (Virtual IP) where the clients will connect to that IP. The virtual IP is used load balancing nodes in the NLB cluster. 

Failover Cluster - A failover cluster is a group of independent computers or nodes which are physically connected by LAN and that are programmatically by cluster software. The group of nodes is worked together to increase the availability of applications and services that run on the cluster. In other words if NodeA fails then automatically the application will be served from NodeB that means the responsibilities of NodeA will takeover by NodeB. 

The primary difference between NLB and failover cluster is NLB offers scalability and failover cluster cannot improve the scalability, it can only support high availability.
 
Setting up failover cluster is little complex, we need two networks public and private (heartbeat) and a shared drive (called Quorum) and an additional public IP in addition to 2 public ips and 2 private ips for two systems that we will have. We will see detailed terminology and setting up cluster in further posts.

Thursday, January 2, 2014

SQL OS

SQL OS is a kind of operating system built for SQL Server and works on top of Windows Operating System. SQL OS will depend on windows API to perform tasks but it has its own way of handling things. SQL OS was introduced in SQL 2005 and it has the major functions like IO Management, Memory Management and Resource Scheduling. Prior to SQL Server 2005, SQL 2000 uses UMS (User Mode Scheduling) to performing scheduling and other tasks. The introduction of SQL OS is to bring everything into one place and we will have better visibility what is happening at what level, all these can be monitored through DMV’s, the DMV’s starts with sys.dm_os provides complete information of working of SQL OS such as schedulers information, wait tasks information, memory clerks etc.,
 
A CPU is a single-core or multi-core processor, core means processor, single core means one processor and multi core means two processors, even though a processor is one chip internally it has two physical cores. Dual core has 2 cores, Quad core has 4 cores, Hexa core has 6 cores, Octo core has 8 cores, Deca core has 10 cores. Intel CPUs uses a technology called “Hyperthreading” using which a single core processor itself represents has two logical cores to the system, which means if we use a quad core processor with hyperthreading technology you will be able to see 8 cores in the task manager. These are called logical CPUs these will be visible to Operating System (OS)
 
Thread 
 
A thread is a process or a part of process, Select statement is a process in SQL Server it might run as a single thread in the process (if it is simple query) or it splits into multiple threads and runs on multiple processors to complete the process (if it is complex query) to complete the process faster.  Each thread will get some amount of time in the processor and it will move out of the processor to give processor time to other waiting threads the process of moving threads into processor and out from processor is known as scheduling.
 
Scheduler 
 
Scheduler is a logical CPU in SQL Server, Each scheduler is mapped to one logical processor shown by operating system, and one logical processor can have multiple schedulers assigned to it. Visible schedulers are helps to process the user requests, hidden schedulers are only visible to SQL Server internal processes, and one scheduler is dedicated for DAC (Dedicated Administrator Connection). The scheduler’s information is available in sys.dm_os_schedulers DMV.
Scheduler maintains two components, Wait List and Runnable queue. The processor is processes one thread at a time, Wait list is the list of threads waiting for resources, Runnable queue is a set of threads that has resources but waiting for its turn to get into the processor, Scheduler will put thread into runnable queue and move that thread to processor. The runnable queue follows FIFO when thread moves from wait list it joins at the end of runnable queue.
The wait list is a list of threads waiting for resources and this is unordered queue, the waiting thread will pushed into runnable queue when it founds the resources. The thread which is in the wait list can be cancelled due to execution time out, sys.dm_os_waiting_tasks helps to examine the wait list queue.
 
Thread States

The thread can have any of the three states, Running, Runnable, Suspended, Running is the state where the thread is currently executing in the processor and utilizing the CPU. Only one thread per scheduler can have this state as the processor can process only one thread at a time. While a task is running it might requires other resources to proceed further (data page, memory etc) that time the thread state will become suspended and moves to wait list and it remains there until it gets the resource. Once the resource is available the task is moved to runnable state and waiting in queue for processor time. It gets executed once the task before in the queue is executed.