简体   繁体   English

Spring Cloud Gateway和容错

[英]Spring Cloud Gateway and fault tolerance

I was reading about spring cloud architecture and technologies (like eureka, hystrix circuit breaker) used to prevent your application from downtime because of failure of some of yours microservices. 我正在阅读有关弹簧云架构和技术(例如eureka,hystrix断路器)的信息,这些技术和技术用于防止由于某些微服务的故障而导致应用程序停机。 And all in all spring cloud suggests to use Spring Cloud Gateway as an entry point to all the micro services. 总体而言,Spring Cloud建议将Spring Cloud Gateway用作所有微服务的入口点。 So I am questioning myself how to provide fault tolerance of spring cloud gateway itself? 所以我在问自己如何提供Spring Cloud Gateway本身的容错能力? As I see right now if this entry point will fail then all these technologies like eureka and hystrix circuit breaker will not be available since they are implemented on the level of spring cloud gateway. 正如我现在所看到的,如果此入口点将失败,那么所有这些技术(如eureka和hystrix断路器)将不可用,因为它们是在Spring Cloud Gateway级别上实现的。 Now when spring cloud gateway is down - all clients will not be able to reach all services behind spring cloud gateway. 现在,当Spring Cloud Gateway关闭时,所有客户端将无法访问Spring Cloud Gateway后面的所有服务。 So how to deal with such kind of situations? 那么如何处理这种情况呢?

I don't think this is directly related to Spring Cloud Gateway, to be honest. 老实说,我认为这与Spring Cloud Gateway没有直接关系。 The question is more "How to deploy highly available Java application?" 问题更多是“如何部署高度可用的Java应用程序?” (SCG is a Spring application). (SCG是Spring应用程序)。

The answer depends on the platform you use. 答案取决于您使用的平台。

  • Most of IAAS platforms provide their own infrastructure load balancers, like ALB / ELB in AWS. IAAS的大多数平台都提供了自己的基础架构负载平衡器,例如AWS中的ALB / ELB。

  • PAAS platform usually include out of the box LB , eg Cloud Foundry or Kubernetes can do that for you. PAAS平台通常包括开箱即用的LB,例如Cloud Foundry或Kubernetes可以为您做到这一点。

DNS is probably not the best choice for the reasons you've described - TTL and client caching. 由于您所描述的原因-TTL和客户端缓存,DNS可能不是最佳选择。 Also, DNS doesn't really have a way to do a health check of an upstream service. 而且,DNS确实没有办法对上游服务进行健康检查。 So using DNS requires client-side load balancing, when the client needs to be smart and invalidate cache / retry if a request failed. 因此,使用DNS时需要客户端负载平衡,这是当客户端需要智能时,如果请求失败,则使缓存/重试无效。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM