缩放会改变系统的大小。在扩展过程中,我们要么压缩,要么扩展系统以满足预期的需求。伸缩操作可以通过增加资源以满足当前系统中较小的期望来实现,或者通过在现有系统中增加一个新系统,或两者兼而有之。
缩放类型:
缩放可以分为两种类型:
- 纵向扩展:当在现有系统中添加新资源以满足预期时,称为纵向扩展。
考虑一个包含现有系统的服务器和资源机架。 (如图所示)。现在当现有系统无法满足预期需求,而只需增加资源即可满足预期需求时,这被认为是垂直扩展。
垂直扩展不仅容易,而且比水平扩展便宜。它还需要更少的时间来修复。
- 横向扩展:当在现有系统中添加新的服务器机架以满足更高的期望时,称为横向扩展。
考虑一个包含现有系统的服务器和资源机架。 (如图所示)。现在当现有的系统不能满足预期的需求,仅仅增加资源也不能满足预期的需求时,我们需要添加全新的服务器。这被视为水平缩放。
水平扩展比垂直扩展困难且成本更高。它也需要更多的时间来修复。
水平和垂直缩放的区别:
Horizontal Scaling | Vertical Scaling |
---|---|
When new server racks are added in the existing system to meet the higher expectation, it is known as horizontal scaling. | When new resources are added in the existing system to meet the expectation, it is known as vertical scaling |
It expands the size of the existing system horizontally. | It expands the size of the existing system vertically. |
It is difficult to implement | It is easy to implement |
It is costlier, as new server racks comprises of a lot of resources | It is cheaper as we need to just add new resources |
It takes more time to be done | It takes less time to be done |