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

5530017-d55ee6f5f0cb6b76.png
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
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了小程序应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 适合毕业设计、课程设计作业。这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。 所有源码均经过严格测试,可以直接运行,可以放心下载使用。有任何使用问题欢迎随时与博主沟通,第一时间进行解答!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值