Heroku负载均衡器和Netflix zuul [英] Heroku load balancer vs Netflix zuul

查看:169
本文介绍了Heroku负载均衡器和Netflix zuul的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据这个答案 https://stackoverflow.com/a/41811770/2849613 我想得到一个有关Heroku上的微服务最佳实践的更多信息。



问题是哪种方法更好?


  1. 将每项服务安装为独立应用程序,并使用其中之一作为REST代理(例如Netflix Eureka)?

或者


  1. 创建基于Docker的方法,例如Netflix Zuul作为负载均衡器?

在我看来,我已经看到两种方法的优点和缺点:


  1. 优点:更好的可扩展性(易于为更大的负载创建新机器)。 缺点:服务之间的通信是在heroku之外换句话说:因为heroku应用程序具有公共地址,所有人都可以直接连接到服务(无需抛出Eureka),因为每个服务都需要提供一些身份验证方法并在彼此之间共享 - 我认为这很容易冒险。

  2. 优点:易于重现测试和开发的生产环境(docker image),服务之间的通信完成内部图像到图像,而不是应用程序)。 缺点:难以扩展(我认为Heroku应用程序和Docker镜像之间的负载平衡有点花销)。 哪种方法更好?也许我可以把它们混合在一起?或者,也许有一些不同的,更好的解决方案?



    诚实地说,我确信唯一的事情是我想使用rabbitMQ作为消息队列......

    解决方案

    我更喜欢方法1(特别是因为我知道你已经在使用Heroku了)。 b

    Docker非常棒,但是如果您在Heroku上部署,益处非常有限。之所以Heroku已经完成了Docker所做的一切:管理依赖关系,安装和流程管理。 Heroku已经为您完成了所有这些工作,而无需额外的Docker -izing化环境。



    关于负载平衡:实际上并不重要。在这两种情况下,如果您想在Heroku上运行,您将使用Heroku负载平衡器。这是因为没有办法绕过Heroku栈的那一层。



    如果你想使用Docker / zuul,你需要这样做:OUTSIDE的Heroku当然。这意味着你需要做各种其他的东西,找一个码头主持人,管理你自己的基础设施等等。

    所以,在我看来,#1是一个更好的选项(如果您使用的是Heroku),因为:


    1. 所有内容都已经妥善处理好。

    2. 您可以专注于编写可伸缩的代码,而不是管理各种其他的东西。

    3. 您的所有服务都位于同一个AWS区域,因此即使它们会彼此交谈通过HTTPs,它将非常快。


    According to this answer https://stackoverflow.com/a/41811770/2849613 I would like to get a little bit more information about best practices with microservices on Heroku.

    The question is which approach is better?

    1. Install every services as independent app, and use one of them as REST "proxy" (for example Netflix Eureka)?

    Or

    1. Create docker based approach with, for example Netflix Zuul as a load balancer?

    On my own I see already some pros and cons of both approaches:

    1. Pros: better scalability (easy to create new machines for bigger load). Cons: communication between services goes "outside of heroku" in other words: because heroku app have public address everyone can connect directly to service (without going threw Eureka), because of that every services need to provide some authentication method and share it between each other - I think that this is risk prone.

    2. Pros: easy to reproduce production environment for tests and develop (docker image), communication between services is done "internally" (image to image instead app to app). Cons: hard to scale (I think that load balancing between Heroku apps and then docker images is a little bit overhead).

    Which approach is better? Maybe I can mix them together? Or maybe there is some different, better solution?

    Do be honest the only thing which I am sure, is that I want to use rabbitMQ as a message queue...

    解决方案

    I prefer approach #1 (especially since I know you're using Heroku already).

    Docker is great, but the benefits are very limited if you're deploying on Heroku. The reason why is that Heroku already does everything docker does: manage dependencies, installation, and process management. Heroku does all this already for you without the extra work of Docker-izing your environment.

    Regarding the load balancing: it doesn't actually matter. In both of your cases, if you want to run on Heroku, you WILL be using the Heroku load balancer. This is because there is no way to 'bypass' that layer of the Heroku stack.

    If you want to use Docker / zuul, you'll need to do that OUTSIDE of Heroku for sure. This means you need to do all sorts of other stuff, find a docker host, manage your own infrastructure, etc.

    So, in my mind, #1 is a better option (if you're using Heroku) because:

    1. Everything is already taken care of for you.
    2. You can focus on writing scalable code instead of managing all sorts of other things.
    3. All your services will be in the same AWS region, so even though they will talk to each other over HTTPs, it will be VERY FAST.

    这篇关于Heroku负载均衡器和Netflix zuul的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆