翻译 | 3种方式提升云可扩展性

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: Cloud 本文在腾讯云+社区首发, 为原创翻译文章. 原文面向对较为专业的IT从业者, 为此译者将对文中一些概念进行注解 以扩大文章所面向的读者群体.
背景知识
有相关知识的读者可以跳过此部分内容

云计算作为一种资源, 它的可扩展性是指关于如何处理可变规模业务的能力. 包括 水平扩展垂直扩展.

什么意思呢?
水平扩展(horizontal scaling)
也称为横向扩展, 指能够连接多个软硬件的特性,这样可以将多个服务器从逻辑上看成一个实体.
垂直扩展(vertical scaling)
当一个现有IT资源被具有更大或更小容量的资源所代替,则为垂直扩展. 也就是对当前服务器的CPU性能等进行原地的扩大和缩小. 由于在进行垂直扩展的时候服务器需要停机(就如同我们平时使用虚拟机时, 要重新分配它的内存或CPU的时候需要先关机, 因此在云环境中这类扩展并不常见.


INTRO

在亚马逊云服务中部署被盛赞为是一个很好的方式来实现高扩展性, 并且你只需要支付你所使用的云计算机性能即可。那么,如何从这项技术中获得最佳的扩展性呢?

Deploying in the Amazon cloud is touted as a great way to achieve high scalability while paying only for the computing power you use. How do you get the best scalability from the technology?

1. 使用弹性伸缩(Use Auto-scaling)

亚马逊的EC2产品提供弹性伸缩这一云计算的独特功能。像往常一样为你的应用程序设置一个负载均衡器和几个Web服务器。在模板AMI的基础上设计你将不断复用的Web服务器。然后设置弹性伸缩并根据你预测的流量设置阈值。当超过阈值时,AWS将启动你的Web服务器的新实例,并自动将其置于负载均衡器池中。一旦流量低于最低阈值,亚马逊将从负载均衡器池中为你移除一台服务器。

Auto-scaling is a unique feature of cloud computing and Amazon's EC2 offering. Setup a load balancer and a couple of webservers for your application as you normally would. Design your webserver based on a template AMI that you'll reuse over and over. Then setup auto-scaling and set thresholds based on the traffic you forecast. When a threshold is passed, AWS will spinup a new instance of your webserver, and roll it into the load balancer pool automatically. Once traffic falls below the scale back threshold, Amazon will take a server out of the pool for you.

请务必要监视此活动的开始,并为之运行一些负载和压力测试。你需要确保它能如你所期望地正常运转,并且没有异常的情况就不会不必要地运转服务器。

Be sure to monitor this activity to start with, and also run some load and stress tests on it. You want to ensure that it behaves as you expect, and no anomalous cases will cause you to spinup servers unnecessarily.

2. 横向伸缩数据库层(Horizontally Scale the Database Tier)

MySQL在这里提供了一系列的解决方案。你可以在Master-Master(主对主)主动被动集群(也称为循环复制)中配置MySQL。在这种配置中,MySQL将把所有已完成的事务发送到集群中的其他服务器。你的被动服务器也可以处理你的应用程序的读取流量。在实现高可用性的同时,你也可以通过将大部分的SELECT操作流量发送到另一个服务器来获得可扩展性。

MySQL offers a number of solutions here. You can configure MySQL in a master-master active passive cluster, also known as circular replication. In this configuration, MySQL will send all completed transactions to the other server in the cluster. Your passive server can also handle read traffic for your application. At the same time as you achieve high availability, you also get scalability by sending much of the SELECT traffic off to another server.

随着负载的进一步增长,将额外的只读的从盘(read-only slave) 转入你的设置, 你就可以进一步扩大读取操作的规模。在执行此操作时,你可以继续将所有写入的内容发送到单个处于活动状态的主数据库。

As the load grows further, roll in an additional read-only slave into your setup. You can then further scale out reads. As you do this, you'll continue to send all writes to the single active master database.

[注]我们为PC配置额外硬盘时, 原有的装有系统的盘可以称为主盘(Master)
作为扩展的硬盘称为从盘(Slave), 在服务器上类似.

或者,你希望采用基于MySQL社区版( community)服务器的亚马逊RDS解决方案,但需要某些设置保持锁定。在这个配置中,你将不能使用诸如Percona的高速服务器之类的另一种MySQL发行版。这个配置提供的是multi-az(多可用区)配置。请记住,任何你启动的MySQL服务器都将有一个区域和可用性空间作为其配置的一部分,所以你可以在亚马逊网络服务中自由使用这些功能来提高可用性。

As an alternative, you may wish to employ Amazon's RDS solution, which is based on the MySQL community server, but with certain locked in settings. In this configuration you will not be able to use an alternate MySQL distribution such as Percona's high speed server. What this configuration does offer is multi-az configuration. Keep in mind though that any MySQL server you spinup will have a region and availability zone as part of it's configuration, so you are always free to use those features of Amazon's network to increase availability.

如果单个主数据库上的负载仍存在问题,那么可以垂直扩展该节点。通过在EBS的根卷(root volume)上实例化一个新的更大的EC2实例来完成此操作。然后分离该root volume,停止你的旧实例,分离旧实例的root volume,并将其移动到新的服务器。当你将那个活动的root volume附加上去,新的更大的EC2实例将是你原来的服务器,也就是你的服务器就地扩大了!

If the load on the single master database continues to be a problem, you can vertically scale that node in place. Do this by spinning up a new larger EC2 instance on and EBS root volume. Then detach that root volume, stop your old instance, detach it's root volume and move it over to the new server. Once you attach that live root volume, your new larger EC2 instance will be your original server, scaled UP in place!

3. 使用 条带化(Striped) EBS root volume

[注] EBS, Elastic Block Store, 即弹性块存储

EBS是一项非常棒的技术,因为它为每个EC2实例带来了存储区域网络的灵活性。这不是没有挑战,并且有时在磁盘I / O (input/output) 的吞吐量上还会有很大的变化。这个变化对数据库层而言是一个挑战。请记住,亚马逊的基础架构虚拟化层将根据实例的大小增加或减少实例接收的磁盘I / O数量。

EBS is a great technology, as it brings the flexibility of a storage area network to each of your EC2 instances. It's not without it's challenges though, and at times you will experience great variability in disk I/O throughput. This can pose a challenge for the database tier especially. Keep in mind too, that Amazon's infrastructure virtualization layer will dial up or dial down the amount of disk I/O your instance receives based on how large the instance is.

另一个获得更好EBS性能的方法是使用Linux软件的RAID技术。由于EBS内置冗余,因此你可以简单地在多个EBS卷上使用Striping或RAID 0 -- 我们推荐使用4个。

One additional way to get better EBS performance is by using Linux's software raid technology. Since EBS already has redundancy built in, you can simply use striping or RAID 0 across a number of EBS volumes - we recommend four.

[注] RAID, Redundant Arrays of Independent Disks
即磁盘阵列, 利用数组方式来作磁盘组, 将数据切割成许多区段
分别存放在各个硬盘上, 在数组中任意一个硬盘故障时,仍可读出数据

一共有0~6一共7种,这其中RAID 0、RAID1、RAID 5和RAID6比较常用。

RAID 0 又称为Stripe(条带化,串列)或Striping
它代表了所有RAID级别中最高的存储性能

RAID 0:如果你有n块磁盘,原来只能同时写一块磁盘,写满了再下一块,
做了RAID 0之后,n块可以同时写,速度提升很快,但由于没有备份,
可靠性很差。n最少为2。

引自知乎
作者:孙小霞
链接:https://www.zhihu.com/question/20131784/answer/28026813
来源:知乎

要小心地进行这些配置,因为现在每个EBS卷都不能自动操作,但要求四个都要完成。这也会影响EBS快照备份。

Be careful with such configurations as each of your EBS volumes won't operate by themselves now, but require all four to be complete. This will impact EBS snapshot backups, as well.


翻译人:FesonX
文章链接 : https://cloud.tencent.com/developer/article/1020235
原文链接:https://dzone.com/articles/3-ways-boost-cloud-scalability
原文作者:Sean Hull
封面图案:Julien Deveaux
相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
23天前
|
存储 JSON 数据库
【C++ 软件设计思路】跨平台应用开发:如何选择合适的格式保存信息
【C++ 软件设计思路】跨平台应用开发:如何选择合适的格式保存信息
89 0
|
1月前
|
JSON 前端开发 JavaScript
谈谈生成式企业级前端应用的二次开发方式
谈谈生成式企业级前端应用的二次开发方式
27 0
构建安全可靠的系统:第六章到第十章
构建安全可靠的系统:第六章到第十章
|
4月前
|
安全 API 数据处理
API接口技术:架构、设计、安全性与实践
随着数字化和信息化进程的加速,应用程序接口(API)在软件开发和数据处理中扮演着越来越重要的角色。API不仅是不同软件应用程序之间的桥梁,也是软件开发人员和数据科学家进行数据交换和功能调用的关键工具。本文将深入探讨API接口的技术,包括架构、设计、安全性以及实践应用。
|
缓存 安全 算法
CleanMyMacX2023功能优势介绍
CleanMyMac更新最新版本x4.12,完美适配新版系统macOS10.14,拥有全新的界面。CleanMyMac可以让您安全、智能地扫描和清理整个系统,删除大型未使用的文件,减少iPod库的大小,最精确的应用程序卸载,卸载不必要的应用程序或修复不能正常工作的程序,管理所有的扩展和做更多的事情-所有从一个新设计和美丽简单的界面。
124 0
|
弹性计算 运维 负载均衡
一文读懂 - 云上用户如何灵活应用定制化网络服务
在将传统数据中心业务迁移上云的过程中,如何将云下基于不同业务场景和设备角色灵活变化的网络配置基于云上网络统一服务能力进行转换,用户及其业务架构通常会面临诸多的挑战。阿里云混合云网络技术团队和阿里云网络产品团队自主创新研发的【开放网络服务平台】(简称:ONSP)构建在阿里云飞天洛神网络系统上,实现了飞天洛神网络和三方网络生态的充分融合,从而优化了企业客户生态服务的体验,更好的帮助客户迁云上云。
1463 0
一文读懂 - 云上用户如何灵活应用定制化网络服务