微服务各种框架简介对比

网关路由|服务注册发现|分布式配置中心|服务调用|客户端负载均衡|断路器|分布式事务|授权

Posted by Sunfy on 2021-09-05
Words 2.7k and Reading Time 11 Minutes
Viewed Times
Viewed Times
Visitors In Total

服务网关路由(Routing)

SpringCloud gateway

This project provides a library for building an API Gateway on top of Spring WebFlux. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency.

这个项目提供了一个在Spring WebFlux上构建API网关的库。Spring Cloud Gateway旨在提供一种简单而有效的方式来路由到api,并为它们提供横切关注点,如:安全性、监控/指标和弹性。

Zuul

Spring Cloud Netflix: Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with battle-tested Netflix components. The patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon)..

Spring Cloud Netflix通过自动配置和绑定到Spring环境和其他Spring编程模型习语,为Spring Boot应用提供了Netflix OSS集成。通过一些简单的注释,您可以在应用程序中快速启用和配置通用模式,并使用经过战斗考验的Netflix组件构建大型分布式系统。提供的模式包括服务发现(Eureka)、断路器(Hystrix)、智能路由(Zuul)和客户端负载均衡(Ribbon)。

服务注册发现(Service register and discovery)

Nacos

一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。

Eureka

Spring Cloud Netflix: Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with battle-tested Netflix components. The patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon)..

Spring Cloud Netflix通过自动配置和绑定到Spring环境和其他Spring编程模型习语,为Spring Boot应用提供了Netflix OSS集成。通过一些简单的注释,您可以在应用程序中快速启用和配置通用模式,并使用经过战斗考验的Netflix组件构建大型分布式系统。提供的模式包括服务发现(Eureka)、断路器(Hystrix)、智能路由(Zuul)和客户端负载均衡(Ribbon)。

Zookeeper

Apache ZooKeeper is an effort to develop and maintain an open-source server which enables highly reliable distributed coordination.

Apache ZooKeeper致力于开发和维护开源服务器,以实现高度可靠的分布式协调。

Consul

Spring Cloud Consul provides Consul integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with Hashicorp’s Consul. The patterns provided include Service Discovery, Distributed Configuration and Control Bus.

Spring Cloud Consul通过自动配置和绑定到Spring环境和其他Spring编程模型习语为Spring Boot应用程序提供Consul集成。通过一些简单的注释,您可以在应用程序中快速启用和配置公共模式,并使用Hashicorp的Consul构建大型分布式系统。提供的模式包括服务发现、分布式配置和控制总线。

分布式配置中心(Distributed confiuration)

SpringCloud config

Spring Cloud Config provides server and client-side support for externalized configuration in a distributed system. With the Config Server you have a central place to manage external properties for applications across all environments. The concepts on both client and server map identically to the Spring Environment and PropertySource abstractions, so they fit very well with Spring applications, but can be used with any application running in any language. As an application moves through the deployment pipeline from dev to test and into production you can manage the configuration between those environments and be certain that applications have everything they need to run when they migrate. The default implementation of the server storage backend uses git so it easily supports labelled versions of configuration environments, as well as being accessible to a wide range of tooling for managing the content. It is easy to add alternative implementations and plug them in with Spring configuration.

Spring Cloud Config为分布式系统中的外部化配置提供服务器和客户端支持。有了Config Server,您就有了一个中心位置来管理跨所有环境的应用程序的外部属性。客户机和服务器上的概念都与Spring Environment和PropertySource抽象相对应,因此它们非常适合Spring应用程序,但可以用于以任何语言运行的任何应用程序。当应用程序通过部署管道从开发到测试再到生产时,您可以管理这些环境之间的配置,并确保应用程序在迁移时拥有运行所需的一切。服务器存储后端的默认实现使用git,所以它很容易支持标签版本的配置环境,以及用于管理内容的各种工具。添加替代实现并将它们与Spring配置一起插入是很容易的。

Nacos

站内地址

Zookeeper

站内地址

服务调用(Service Call)

RestTemplate

Feign

OpenFeign

声明式、模板化的HTTP客户端

Spring Cloud OpenFeign

This project provides OpenFeign integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms.

该项目通过自动配置和绑定到Spring Environment和其他Spring编程模型习语,为Spring Boot应用程序提供OpenFeign集成。

客户端负载均衡(Loading blance)

Ribbon

客户端负载均衡

Spring Cloud Netflix: Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with battle-tested Netflix components. The patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon)..

Spring Cloud Netflix通过自动配置和绑定到Spring环境和其他Spring编程模型习语,为Spring Boot应用提供了Netflix OSS集成。通过一些简单的注释,您可以在应用程序中快速启用和配置通用模式,并使用经过战斗考验的Netflix组件构建大型分布式系统。提供的模式包括服务发现(Eureka)、断路器(Hystrix)、智能路由(Zuul)和客户端负载均衡(Ribbon)。

断路器(Circit Breakers)

Hystrix(停止开发)

在分布式系统中,服务与服务之间依赖错综复杂,一种不可避免的情况就是某些服务将会出现失败。Hystrix是一个库,它提供了服务与服务之间的容错功能,“容错”主要体现在延迟和异常上,从而做到控制分布式系统中的联动故障。Hystrix通过隔离服务的访问点,阻止联动故障,并提供故障的解决方案,从而提高了这个分布式系统的弹性。

Spring Cloud Netflix: Spring Cloud Netflix provides Netflix OSS integrations for Spring Boot apps through autoconfiguration and binding to the Spring Environment and other Spring programming model idioms. With a few simple annotations you can quickly enable and configure the common patterns inside your application and build large distributed systems with battle-tested Netflix components. The patterns provided include Service Discovery (Eureka), Circuit Breaker (Hystrix), Intelligent Routing (Zuul) and Client Side Load Balancing (Ribbon)..

Spring Cloud Netflix通过自动配置和绑定到Spring环境和其他Spring编程模型习语,为Spring Boot应用提供了Netflix OSS集成。通过一些简单的注释,您可以在应用程序中快速启用和配置通用模式,并使用经过战斗考验的Netflix组件构建大型分布式系统。提供的模式包括服务发现(Eureka)、断路器(Hystrix)、智能路由(Zuul)和客户端负载均衡(Ribbon)。

Sentinel

As distributed systems are becoming increasingly popular, the reliability between services is becoming more important than ever before. Sentinel is a powerful flow control component that takes “flow” as the breakthrough point and covers multiple fields including flow control, concurrency limiting, circuit breaking, and adaptive system protection to guarantee the reliability of microservices.

随着分布式系统越来越受欢迎,服务之间的可靠性变得比以往任何时候都更加重要。Sentinel是一款功能强大的流量控制组件,以“流”为突破点,涵盖流量控制、并发限制、断路、自适应系统保护等多个领域,保证微服务的可靠性。

二者的对比-Sentinel 与 Hystrix 的对比 · alibaba/Sentinel Wiki · GitHub

Sentinel Hystrix
隔离策略 信号量隔离 线程池隔离/信号量隔离
熔断降级策略 基于响应时间或失败比率 基于失败比率
实时指标实现 滑动窗口 滑动窗口(基于 RxJava)
规则配置 支持多种数据源 支持多种数据源
扩展性 多个扩展点 插件的形式
基于注解的支持 支持 支持
限流 基于 QPS,支持基于调用关系的限流 有限的支持
流量整形 支持慢启动、匀速器模式 不支持
系统负载保护 支持 不支持
控制台 开箱即用,可配置规则、查看秒级监控、机器发现等 不完善
常见框架的适配 Servlet、Spring Cloud、Dubbo、gRPC 等 Servlet、Spring Cloud Netflix

分布式事务(Distributed transaction)

Seata

Seata 是一款开源的分布式事务解决方案,致力于在微服务架构下提供高性能和简单易用的分布式事务服务。

授权(authorization)

Shiro

Apache Shiro™ is a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management. With Shiro’s easy-to-understand API, you can quickly and easily secure any application – from the smallest mobile applications to the largest web and enterprise applications.

Apache Shiro™是一个功能强大且易于使用的Java安全框架,可执行身份验证、授权、加密和会话管理。通过Shiro易于理解的API,您可以快速、轻松地保护任何应用程序——从最小的移动应用程序到最大的web和企业应用程序。

SpringSecurity

Spring Security is a powerful and highly customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications.

Spring Security is a framework that focuses on providing both authentication and authorization to Java applications. Like all Spring projects, the real power of Spring Security is found in how easily it can be extended to meet custom requirements

Spring Security是一个强大的、高度可定制的身份验证和访问控制框架。它是保护基于spring的应用程序的事实上的标准。

Spring Security是一个专注于为Java应用程序提供身份验证和授权的框架。与所有Spring项目一样,Spring Security的真正强大之处在于它可以很容易地扩展以满足定制需求


Copyright 2021 sunfy.top ALL Rights Reserved

...

...

00:00
00:00