可伸缩性和弹性之间的区别是什么?

我听过很多人把这两个词交替使用,但是,在我看来,它们之间还是有区别的:

SCALABILITY -软件系统在其当前硬件资源(扩大规模)或当前和额外硬件资源(扩大规模)上处理较高工作负载的能力,而不会中断应用服务;

弹性 -下面的 硬件层(通常是云基础设施)能够增加或减少硬件层向上面的软件层提供的物理资源量。增加/减少由预先定义的业务规则触发(通常与应用程序的需求相关)。增加/减少发生在没有物理服务中断的情况下。

同样,可伸缩性是与工作负载相关的软件体系结构的特征,如果工作负载的弹性是下面物理层的特征,则完全与硬件预算优化相关。

这两个非功能性架构特征之间的区别对吗? 有人能举个具体的例子吗? 这样我们就可以在这两个术语之间划出更加明显的边界?

123652 次浏览

Usually, when someone says a platform or architectural scales, they mean that hardware costs increase linearly with demand. For example, if one server can handle 50 users, 2 servers can handle 100 users and 10 servers can handle 500 users. If every 1,000 users you get, you need 2x the amount of servers, then it can be said your design does not scale, as you would quickly run out of money as your user count grew.

Elasticity is used to describe how well your architecture can adapt to workload in real time. For example, if you had one user logon every hour to your site, then you'd really only need one server to handle this. However, if all of a sudden, 50,000 users all logged on at once, can your architecture quickly (and possibly automatically) provision new web servers on the fly to handle this load? If so, it could be said that your design is elastic.

Scalability is the ability of the system to accommodate larger loads just by adding resources either making hardware stronger (scale up) or adding additional nodes (scale out).

Elasticity is the ability to fit the resources needed to cope with loads dynamically usually in relation to scale out. So that when the load increases you scale by adding more resources and when demand wanes you shrink back and remove unneeded resources. Elasticity is mostly important in Cloud environments where you pay-per-use and don't want to pay for resources you do not currently need on the one hand, and want to meet rising demand when needed on the other hand.

_

Scalability: "Increasing" the capacity to meet the "increasing" workload.

Elasticity: "Increasing or reducing" the capacity to meet the "increasing or reducing" workload.


Scalability: In a scaling environment, the available resources may exceed to meet the "future demands".

Elasticity: In the elastic environment, the available resources match the "current demands" as closely as possible.


Scalability: Scalability adapts only to the "workload increase" by "provisioning" the resources in an "incremental" manner.

Elasticity: Elasticity adapts to both the "workload increase" as well as "workload decrease" by "provisioning and deprovisioning" resources in an "autonomic" manner.


Scalability: Increasing workload is served with increasing the power of a single computer resource or with increasing the power by a group of computer resources.

Elasticity: Varying workload is served with dynamic variations in the use of computer resources.


Scalability: Scalability enables a corporate to meet expected demands for services with "long-term, strategic needs".

Elasticity: Elasticity enables a corporate to meet unexpected changes in the demand for services with "short-term, tactical needs".


Scalability: It is "increasing" the capacity to serve an environment where workload is increasing.

This scalability could be "Scaling Up" or "Scaling Out".

(Example:

Scaling Up - increasing the ability of an individual server

Scaling out - increasing the ability by adding multiple servers to the individual server.)

Elasticity: It is the ability to "scale up or scale down" the capacity to serve at will.


Scalability: To use a simile, "scaling up" is an individual increasing her power to meet the increasing demands, and "scaling out" is building a team to meet the increasing demands.

Elasticity: To use a simile, a film actor increasing or reducing her body weight to meet differing needs of the film industry.

_

Elasticity is related to short-term requirements of a service or an application and its variation but scalability supports long-term needs.

From my limited understanding of those concepts, an example:

Say we have a system of 5 computers that does 5 work units, if we need one more work unit to be done we we'll have to use one more computer. That is a scalable system but it is not elastic. Somebody going to have to go and get that other computer. Also, if a new computer is purchased and the extra work unit is not needed any more, the system get stuck with a redundant resource.

Now, lets say that the same system uses, instead of it's own computers, a cloud service that is suited for it's needs. Ideally, when the workload is up one work unit the cloud will provide the system with another "computing unit", when workload goes back down the cloud will gracefully stop providing that computing unit. That is a situation where a system is both scalable and elastic.

Elasticity is the ability of a system to increase (or decrease) its compute, storage, netowrking, etc. capacity based on specified criteria such as the total load on the system.

For example, you can implement a backend system that initially has 1 server in its cluster but configure it to add an extra instance to the cluster if the average per minute CPU utilization of all the servers in the cluster exceeds a given threshold (e.g. 70%).

Similarly, you can configure your system to remove servers from the backend cluster if the load on the system decreases and the average per-minute CPU utilization goes below a threshold defined by you (e.g. 30%).

As another example, you can configure your system to increase the total disk space of your backend cluster by an order of 2 if more than 80% of the total storage currently available to it is used. If for whatever reason, at a later point, data is deleted from the storage and, say, the total used storage goes below 20%, you can decrease the total available disk space to its original value.

But some systems (e.g. legacy software) are not distributed and maybe they can only use 1 CPU core. So even though you can increase the compute capacity available to you on demand, the system cannot use this extra capacity in any shape or form. Such systems are not scalable. But a scalable system can use increased compute capacity and handle more load without impacting the overall performance of the system.

A scalable system does not depend on elasticity though. Traditionally, IT departments could replace their existing servers with newer servers that had more CPUs, RAM, and storage and port the system to the new hardware to employ the extra compute capacity available to it.

Cloud environments (AWS, Azure, Google Cloud, etc.) offer elasticity and some of their core services are also scalable out of the box. Furthermore, if you build a scalable software, you can deploy it to these cloud environments and benefit from the elastic infrastructure they provide you to automatically increase/decrease the compute resources available to you on-demand.

Scalability refers to the ability for your resources to increase or decrease in size or quantity.

There's a lot of infrastructures involved to make something like this happen, so it's no easy task.

Many of the services in AWS are scalable by default, which is one of the reasons that AWS is so successful.

Scalability is pretty simple to define, which is why some of the aspects of elasticity are often attributed to it.


Elasticity is the ability for your resources to scale in response to stated criteria, often CloudWatch rules.

This is what happens when a load balancer adds instances whenever a web application gets a lot of traffic.

Scalability is required for elasticity, but not the other way around.

Not all AWS services support elasticity, and even those that do often need to be configured in a certain way.

--

In resume, Scalability gives you the ability to increase or decrease your resources, and elasticity lets those operations happen automatically according to configured rules.

One picture is worth a thousand words. I found it in Fundamentals of Software Architecture: An Engineering Approach by Mark Richards and Neal Ford.

enter image description here

Scalability handles the increase and decrease of resources according to the system's workload demands. So scalability does not have to be done automatically.

Elasticity is the ability to automatically or dynamically increase or decrease the resources as needed. Elastic resources match the current needs and resources are added or removed automatically to meet future demands when it is needed.

So in short ability of a system to handle Scalability automatically is elasticity

Scalability and Elasticity both refer to meeting traffic demand but in two different situations.

Scalability is meeting predictable traffic demand while elasticity is meeting sudden traffic demand.

enter image description here

image ref: https://www.skylinesacademy.com/blog/2020/3/6/az-900-cloud-concepts-scalability-and-elasticity

Both, Scalability and Elasticity refer to the ability of a system to grow and shrink in capacity and resources and to this extent are effectively one and the same. The difference is usually in needs and conditions under which this happens. Scalability is mostly manual, predictive and planned for expected conditions. Elasticity is automatic and reactive to external stimuli and conditions. Elasticity is automatic scalability in response to external conditions and situations.