自动化微服务负载平衡

自动化微服务负载平衡

本文介绍了自动化微服务负载平衡/缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读微服务几天,我想知道人们如何去自动化负载平衡和扩展这些东西?



我有一个特定的场景记住我想要实现什么,但不知道是否可能,或者我正在考虑错误。所以在这里它... ...






假设我有一个名为A,B和C的3台CoreOS机器



我想要的第一件事是我可以使用舰队的透明部署。



然后,我想检测到,当其中一个服务负载巨大并部署了另一个实例,并且部署了另一个实例,并且部署了第一个实例,自动负载平衡在某种方式不会中断正在使用它的其他服务(流量从现在开始通过负载均衡器)。



另一种方式可能是我手动部署另一个版本的该服务然后自动负载平衡并将流量路由器连接到负载平衡器。



然后最后一个问题,这与Akka集群有什么不同,开发过程如何那些与微服务有所不同?

解决方案

在我看来,在你问的问题中,有一个提示你的答案(流量从现在开始



我会说 - 流量应该总是通过load-balancer



在你最简单的情况下,你有1每个服务的实例,它仍然必须通过负载平衡器(btw,我认为至少拥有2件事情是个好主意)。



在这种情况下当您获得3倍以上的流量并希望启动另一个同一服务的容器时,一旦容器启动并运行,它必须在服务发现工具中注册自身,并自动更新负载平衡器配置以添加新的上游条目。 p>

然后使用这种方法,您将能够更轻松地扩展/降低您的服务。


Reading up on micro services for a few days now I was wondering how do people go about automating the load balancing and scaling these things?

I have a specific scenario in mind what I would like to achieve but not sure if it's possible or maybe I'm thinking about it wrong. So here it goes...


Let's say I have a cluster of 3 CoreOS machines named A,B and C.

First thing I want is transparent deployment for which I can probably use fleet.

Then I would like to detect, when one of the services is under huge load and deploy another instance of it and have that one and the first one deployed, automatically load balanced in a way that would not disrupt other services that are using it (traffic goes through load balancer from now on).

Another way could be that I manually deploy another version of the services which then gets load balanced automatically and traffic router to the load balancer.

Then the last question, how is this all different to something like Akka cluster and how does development of those differ from micro services?

解决方案

In my opinion, In the question you asked, there's a hint to your answer "(traffic goes through load balancer from now on)".

I would say - traffic should always go thru load-balancer.

In your simplest case when you have 1 instance of each service, it still has to go thru load-balancer (btw, I think it's a good idea to have at least 2 of everything).

In that case, when you get 3x more traffic and want to spin up another container of the same service, once container is up and running it must register itself in service discovery tool and automatically update load-balancer config to add new 'upstream' entry.

And then using this approach you will be able to scale up/down your services more easily.

这篇关于自动化微服务负载平衡/缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 13:27