Home Database Mysql Tutorial 二、服务器优化(1)负载平衡

二、服务器优化(1)负载平衡

Jun 07, 2016 pm 05:42 PM
load balancing

一、SQLServerClustervs.RAC1.RAC RAC,全称RealApplicationClusters,译为“真正应用群集”,是Oracle9i开始采用的一项新技术,是高可用..

一、SQL Server Cluster vs. RAC

1. RAC

  RAC,全称Real Application Clusters,译为“真正应用群集”, 是 Oracle 9i 开始采用的一项新技术,是高可用性的一种。 

  当一个客户端发送请求到某一台服务器的 listener(侦听器)后,这台服务器根据我们的负载均衡策略,会把请求发送给本机的 RAC 组件处理,也可能会发送给另外一台服务器的RAC组件处理,处理完请求后,RAC 会通过群集软件来访问该数据库的共享存储设备。

 二、服务器优化(1)负载平衡

  RAC的每个节点都可以实现Read/Write 的实时访问,因此带来性能的提升,相当于“负载均衡”。

 

2. SQL Server Cluster

  SQL Server 的群集(cluster)最多可以部署16 个节点,但是,在任一时刻只有一个节点(称为主节点)在提供SQL Server 服务,其它节点都处于“休息”状态。当主节点发生故障导致SQL Server 服务停止时,listener 才通知下一个节点接管SQL Server 服务,因此该技术全称为Fail-over Cluster(故障转移群集)。

 二、服务器优化(1)负载平衡

 

  SQL Server 数据库群集技术的最大缺点,在于数据库文件(mdf/ndf/ldf)都必须保存在共享存储(shared storage),意味着数据实际上只有一份。这是群集架构中的“单一故障点”,一旦共享存储发生故障,数据库群集就完全失效。

  SQL Server 2005 sp1 提供了镜像(Mirror)功能。主体(主节点)和镜像(即辅助节点,服务器空间,仅可以有1个)拥有各自的独立存储,意味着数据实际上是独立的2份。主体的数据可以同步提交到镜像(实时同步),也可以异步提交到镜像(主节点发出提交请求后无需等待镜像的回应)。辅助节点的副本可以通过建立快照(snapshot)实现只读访问。

  SQL Server 2012 提供了新的功能:可用性组(Availability Group)。主节点(Primary Node)和辅助副本(Secondary Replica,最多4个副本)拥有各自的独立存储。主节点的数据被单向复制到各个辅助节点,其中最多2个辅助节点可以实现同步提交,其余的辅助节点只能实现异步提交。主节点的数据可以实现Read/Write 访问;辅助节点可以直接提供3种访问模式:不可读、只读、意向读(仅允许部分访问)。

 

 

二、SQL Server为何不实现RAC功能

  既然RAC有诸多优势,SQL Server为何不实现RAC功能?

  从纯粹的技术角度来看,可以肯定 Microsoft 完全有能力实现这项技术,甚至已经有部分第三方厂家开发了SQL Server的插件以实现RAC功能。那么Microsoft 为何要说“不”呢?大致可以分为以下几种原因:

 

1. RAC的扩展程度有限

  RAC 可以便于用户对数据库节点数量进行扩展,但是,各个节点之间必须实现数据实时的、多向的同步,而这种同步是以牺牲性能为代价的,因此,随着节点数量的增加,性能的扩展并不是线性的,甚至可能随着节点的增加而导致性能下降。SQL Server 2012 的可用性组技术最多只允许2个辅助节点实现单向的“同步提交”,也是基于这种因素而不得不采取的一种限制措施。

  一般来说,RAC 在双机(2个节点)的时候性能最佳,双机性能大约是单机性能的1.8 倍。一般的工程经验可以按照1.6 倍性能进行设计。

  在设计近期目标时,RAC 是一项很不错的选择。如果从长远角度来看,当数据量和负载越来越大时,RAC 也就越来越显得力不从心。这也是大多数的Oracle 客户(特别是大型客户)不愿意使用RAC 的主要原因。

 

2. RAC不符合“性价比”、“易学易用”原则

  与SQL Server 相比,RAC 的强项在于它可以部署在高性能的小型机甚至大型机上,如果性能提供1.6倍,可以视为性能的大幅提升(但是,也意味着提升到极限了)。而SQL Server 仅可部署在PC Server 上,由于PC Server 的性能相对有限,即使通过双机部署将性能提升1.8 倍仍然不是最理想的目标。因此,从性价比角度考虑,部署尽可能多的PC Server 仍然比RAC 更具有竞争优势。

  而且,部署和维护 RAC 并不是一项简单轻松的工作,其复杂程度远远大于SQL Server 常规技术,不符合Microsoft 一贯坚持的“易学易用”原则。

  据了解,中国移动的部分省公司BI、网管、客服等模块已经采用DB2、SQL Server 等数据库,明确表明这些模块不可能使用RAC。另据报道,中国移动2009年发文,要求各省公司新建IT 系统中所需的数据库使用Syabase。

 

3. Microsoft有替代方法

  基于前述各项原则和理由,Microsoft有变通的方法实现负载平衡。下文会有详细讲述。

 

 

三、SQL Server的负载平衡规划

  正是由于SQL Server 部署在PC Server 上,因此可以充分利用PC Server 的极高的性价比优势实现负载平衡。值得注意的是,这里使用了“平衡”,而不是“均衡”。 

 

  可以独立或同时实施下述方案与技术:

1.  规划设计----平衡分布

  在系统规则时,就需要设计一定的策略,将数据库分布部署在不同的数据库(甚至不同的服务器)。

  例如,工厂的流水线生产过程中的数据采集,可以根据车间与流水线的分布情况,部署多套SQL Server。

  又如,一家从事鞋服销售的电商,可以根据产品类别(鞋、童装、成人套装、等),将不同的业务数据分布部署到多套SQL Server。

  实现数据库分布部署之后,对于其中某些共通数据,既可以集中到某一套SQL Server,也可以在多套SQL Server 中通过复制(replicate)实现数据同步(如下图)。

 二、服务器优化(1)负载平衡

  SQL Server 的日志传送、可用组性等技术,香港空间,实现了多个副本的read-only 访问,实际上也能承担负载平衡,但仅限于“读写分离”。

 

 

2. 技术实现----复制(replication)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to optimize TCP/IP performance and network performance of Linux systems How to optimize TCP/IP performance and network performance of Linux systems Nov 07, 2023 am 11:15 AM

In the field of modern computers, the TCP/IP protocol is the basis for network communication. As an open source operating system, Linux has become the preferred operating system used by many businesses and organizations. However, as network applications and services become more and more critical components of business, administrators often need to optimize network performance to ensure fast and reliable data transfer. This article will introduce how to improve the network transmission speed of Linux systems by optimizing TCP/IP performance and network performance of Linux systems. This article will discuss a

Failover and recovery mechanism in Nginx load balancing solution Failover and recovery mechanism in Nginx load balancing solution Oct 15, 2023 am 11:14 AM

Introduction to the failover and recovery mechanism in the Nginx load balancing solution: For high-load websites, the use of load balancing is one of the important means to ensure high availability of the website and improve performance. As a powerful open source web server, Nginx's load balancing function has been widely used. In load balancing, how to implement failover and recovery mechanisms is an important issue that needs to be considered. This article will introduce the failover and recovery mechanism in Nginx load balancing and give specific code examples. 1. Failover mechanism

High availability and disaster recovery solution for Nginx load balancing solution High availability and disaster recovery solution for Nginx load balancing solution Oct 15, 2023 am 11:43 AM

High Availability and Disaster Recovery Solution of Nginx Load Balancing Solution With the rapid development of the Internet, the high availability of Web services has become a key requirement. In order to achieve high availability and disaster tolerance, Nginx has always been one of the most commonly used and reliable load balancers. In this article, we will introduce Nginx’s high availability and disaster recovery solutions and provide specific code examples. High availability of Nginx is mainly achieved through the use of multiple servers. As a load balancer, Nginx can distribute traffic to multiple backend servers to

Building a high-availability load balancing system: Best practices for Nginx Proxy Manager Building a high-availability load balancing system: Best practices for Nginx Proxy Manager Sep 27, 2023 am 08:22 AM

Building a high-availability load balancing system: Best practices for NginxProxyManager Introduction: In the development of Internet applications, the load balancing system is one of the essential components. It can achieve high concurrency and high availability services by distributing requests to multiple servers. NginxProxyManager is a commonly used load balancing software. This article will introduce how to use NginxProxyManager to build a high-availability load balancing system and provide

Dynamic failure detection and load weight adjustment strategy in Nginx load balancing solution Dynamic failure detection and load weight adjustment strategy in Nginx load balancing solution Oct 15, 2023 pm 03:54 PM

Dynamic failure detection and load weight adjustment strategies in the Nginx load balancing solution require specific code examples. Introduction In high-concurrency network environments, load balancing is a common solution that can effectively improve the availability and performance of the website. Nginx is an open source, high-performance web server that provides powerful load balancing capabilities. This article will introduce two important features in Nginx load balancing, dynamic failure detection and load weight adjustment strategy, and provide specific code examples. 1. Dynamic failure detection Dynamic failure detection

Application of load balancing strategy in Java framework performance optimization Application of load balancing strategy in Java framework performance optimization May 31, 2024 pm 08:02 PM

Load balancing strategies are crucial in Java frameworks for efficient distribution of requests. Depending on the concurrency situation, different strategies have different performance: Polling method: stable performance under low concurrency. Weighted polling method: The performance is similar to the polling method under low concurrency. Least number of connections method: best performance under high concurrency. Random method: simple but poor performance. Consistent Hashing: Balancing server load. Combined with practical cases, this article explains how to choose appropriate strategies based on performance data to significantly improve application performance.

Using Nginx Proxy Manager to implement reverse proxy load balancing strategy Using Nginx Proxy Manager to implement reverse proxy load balancing strategy Sep 26, 2023 pm 12:05 PM

Use NginxProxyManager to implement reverse proxy load balancing strategy NginxProxyManager is an Nginx-based proxy management tool that can help us easily implement reverse proxy and load balancing. By configuring NginxProxyManager, we can distribute requests to multiple backend servers to achieve load balancing and improve system availability and performance. 1. Install and configure NginxProxyManager

Backend server health check and dynamic adjustment in Nginx load balancing solution Backend server health check and dynamic adjustment in Nginx load balancing solution Oct 15, 2023 am 11:37 AM

Backend server health check and dynamic adjustment in the Nginx load balancing solution require specific code examples Summary: In the Nginx load balancing solution, the health status of the backend server is an important consideration. This article will introduce how to use Nginx's health check module and dynamic adjustment module to implement health check and dynamic adjustment of the back-end server, and give specific code examples. Introduction In modern application architecture, load balancing is one of the commonly used solutions to improve application performance and reliability. Ngi

See all articles