简体   繁体   English

PaaS云(PCF)上的客户端负载平衡(Ribbon)和服务发现(Eureka)

[英]Client side load balancing (Ribbon) and Service Discovery (Eureka) on PaaS cloud (PCF)

Currently we deploy our application to Pivotal Cloud Foundry (PCF), which operates in a Platform as a Service (PaaS) model. 当前,我们将应用程序部署到Pivotal Cloud Foundry(PCF),后者在平台即服务(PaaS)模型中运行。

It means whenever we deploy an app to PCF, PCF automatically (apart from the other actions it does) sets up a load balancer forwarding requests to the desired number of the instances it automatically provisioned. 这意味着每当我们将应用程序部署到PCF时,PCF就会自动(除了它执行的其他操作)设置负载平衡器,将请求转发到所需数量的自动设置的实例。

Having that in mind, is it possible to use a client side load balancer such as Ribbon in a PaaS cloud, so that the clients of your app will reach out directly to the instances running your app, not to the load balancer? 考虑到这一点,是否可以在PaaS云中使用客户端负载平衡器(例如Ribbon),以便应用程序的客户端直接与运行您的应用程序的实例(而不是负载平衡器)联系? If yes, what are the benefits? 如果是,有什么好处?

One more related question, if all my services follow the same naming convention eg myapp-service and therefore are available under https://myapp-service.cfapps.io is there any benefit of setting up a Service Discovery service (eg Eureka) in a PaaS cloud? 另一个相关的问题是,如果我所有的服务都遵循相同的命名约定,例如myapp-service ,因此可以在https://myapp-service.cfapps.io下使用,那么在以下位置设置服务发现服务(例如Eureka)有什么好处? PaaS云?

Having that in mind, is it possible to use a client side load balancer such as Ribbon in a PaaS cloud, so that the clients of your app will reach out directly to the instances running your app, not to the load balancer? 考虑到这一点,是否可以在PaaS云中使用客户端负载平衡器(例如Ribbon),以便应用程序的客户端直接与运行您的应用程序的实例(而不是负载平衡器)联系? If yes, what are the benefits? 如果是,有什么好处?

You certainly could. 你当然可以。 If you're using the route mapped to your app on PCF, you'd just have a client side load balancer with one server in it so it's not really adding any benefit. 如果您在PCF上使用映射到应用程序的路由,则只需要一个带有一台服务器的客户端负载平衡器,这样就不会真正增加任何好处。

Where you'd see more benefit is if you're using a client side load balancer and Cloud Foundry's Container to Container networking. 如果您使用的是客户端负载平衡器和Cloud Foundry的“容器到容器”网络,那么会发现更多的好处。 With C2C, you can talk directly to other apps. 使用C2C,您可以直接与其他应用对话。 The registry is needed in this case, so you can locate your service apps. 在这种情况下,需要注册表,因此您可以找到服务应用程序。

This blog post walks through a basic example of using SCS & C2C (it's for PWS, but should work on any PCF environment with C2C). 这篇博客文章介绍了使用SCS和C2C的基本示例(适用于PWS,但可以在具有C2C的任何PCF环境中使用)。

https://content.pivotal.io/blog/building-spring-microservices-with-cloud-foundrys-new-container-networking-stack https://content.pivotal.io/blog/building-spring-microservices-with-cloud-foundrys-new-container-networking-stack

One more related question, if all my services follow the same naming convention eg myapp-service and therefore are available under https://myapp-service.cfapps.io is there any benefit of setting up a Service Discovery service (eg Eureka) in a PaaS cloud? 另一个相关的问题是,如果我所有的服务都遵循相同的命名约定,例如myapp-service,因此可以在https://myapp-service.cfapps.io下使用,那么在以下位置设置服务发现服务(例如Eureka)有什么好处? PaaS云?

I think the question is how does your app find myapp-service.cfapps.io ? 我认为问题是您的应用如何找到myapp-service.cfapps.io If you have one app that's consuming one service, it's not too hard to have the app configured with the URL or perhaps to pass it in through an env variable or even a user provided, bound service. 如果您有一个使用一项服务的应用程序,则使用该URL配置该应用程序或者通过一个env变量甚至是一个用户提供的绑定服务来传递该应用程序并不难。 Problem solved. 问题解决了。

When you start to get lots of services, where "lots" is an arbitrarily large number, this get's to be a pain to manage. 当您开始获得很多服务时,“手数”是任意多的,要管理起来就很麻烦。 When you hit that point, using a service registry will make life easier. 当您达到这一点时,使用服务注册表将使生活更轻松。 Not to say you can't use a service registry with the one app / one service scenario, it's just probably not as big of an advantage. 并不是说您不能在一个应用程序/一个服务场景下使用服务注册表,这可能并不是一个很大的优势。

The other advantage of using a service registry is with C2C networking, as I mentioned above. 如上所述,使用服务注册表的另一个优势是使用C2C网络。 In that case, you need something to locate your services on the container network. 在这种情况下,您需要一些东西来在容器网络上定位服务。 The SCS registry will do that. SCS注册表将执行此操作。

For what it's worth, if you're on a pretty recent version of CF, there is actually platform provided service discovery via DNS. 值得一提的是,如果您使用的是最新版本的CF,则实际上是通过DNS提供了平台提供的服务发现。 If available, this could also be used to locate your service instances. 如果可用,这也可用于查找服务实例。 See here for details. 有关详细信息,请参见此处。

https://www.cloudfoundry.org/blog/polyglot-service-discovery-container-networking-cloud-foundry/ https://www.cloudfoundry.org/blog/polyglot-service-discovery-container-networking-cloud-foundry/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 服务发现与负载平衡 - Service discovery vs load balancing 功能区负载均衡器客户端未在 Spring 引导 2.4.3 和云 2020.0.1 中禁用。 改为使用 Consul 进行负载平衡 - Ribbon load balancer client not disabling in Spring boot 2.4.3 & Cloud 2020.0.1. Using Consul for load balancing instead 关键 Web 服务上的 Spring Cloud (Eureka/Ribbon) 连接被拒绝 - Connection refused for spring cloud (Eureka/Ribbon) on pivotal web service 云服务或Iaas或Paas - Cloud Service Or Iaas or Paas Kubernetes DNS /服务/ kubeproxy / configMap与Netflix功能区/ eureka /云配置与AWS ALB / S3 - Kubernetes DNS/service/kubeproxy/configMap vs Netflix ribbon/eureka/cloud config vs AWS ALB/S3 使用Azure极其不均衡的云服务负载平衡 - Extremely uneven cloud service load-balancing with Azure Spring Boot 微服务负载均衡 vs 云负载均衡 - Spring Boot Microservices load balancing vs cloud load balancing 用于演示云中负载平衡和调度的工具 - Tools to demonstrate load balancing and scheduling in the cloud 基于云分区的公共云负载均衡模型 - A load balancing model based on cloud partitioning for the public cloud Spring Cloud Netflix-如何从传统Web应用程序访问Eureka / Ribbon? - Spring Cloud Netflix - how to access Eureka/Ribbon from traditional web app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM