Spring 生态解决方案

  • Post author:
  • Post category:其他


  • Microservices 微服务
  • Reactive 响应式编程
  • Event Driven 事件驱动编程
  • Cloud 云服务
  • Web Applications 网络服务应用
  • Serverless 无服务计算
  • Batch 批量计算



Spring 开发软件框架



Microservices 微服务解决方案

Spring Boot 可以作为最小单元进行微服务架构的开发。

Spring Cloud 提供容错、易管理的微服务架构方案。

Microservice architectures are the ‘new normal’. Building small, self-contained, ready to run applications can bring great flexibility and added resilience to your code. Spring Boot’s many purpose-built features make it easy to build and run your microservices in production at scale. And don’t forget, no microservice architecture is complete without Spring Cloud ‒ easing administration and boosting your fault-tolerance.

  • What are microservices?

Microservices are a modern approach to software whereby application code is delivered in small, manageable pieces, independent of others.

  • Why build microservices?

Their small scale and relative isolation can lead to many additional benefits, such as easier maintenance, improved productivity, greater fault tolerance, better business alignment, and more.



Microservices with Spring Boot 微服务开发框架Spring Boot

With Spring Boot, your microservices can start small and iterate fast. That’s why it has become the de facto standard for Java™ microservices. Quickstart your project with Spring Initializr and then package as a JAR. With Spring Boot’s embedded server model, you’re ready to go in minutes.



Microservice resilience with Spring Cloud 微服务治理

Spring Cloud 提供完整的SaaS服务管理架构,包括:

  • service discovery 服务发现
  • load-balancing 负载均衡
  • circuit-breaking 熔端
  • distributed tracing 分布式调用链路追踪
  • monitoring 应用监控
  • API gateway 开发能力网关

The distributed nature of microservices brings challenges. Spring helps you mitigate these. With several ready-to-run cloud patterns, Spring Cloud can help with service discovery, load-balancing, circuit-breaking, distributed tracing, and monitoring. It can even act as an API gateway.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-B9Do6Fz5-1645084334466)(https://gitee.com/r0ad/filebed/raw/master/study-docs/spring-project/imgs/diagram-microservices.svg)]



Build streaming data microservices with Spring Cloud Stream 微服务流式计算解决方案 Spring Cloud Stream

Spring Cloud Stream 优点:

  • 对多个消息中间件的api进行统一,使生产消费事件变得容易;
  • 支持实时消息编码,高可用、事件驱动的一个体系。

Spring Cloud Stream makes it easy to consume and produce events, no matter which messaging platform you choose. Spring Cloud Stream connects your microservices with real-time messaging in just a few lines of code, to help you build highly scalable, event-driven systems.



Manage microservices 微服务监控
  • distributed tracing 分布式调用链路追踪
  • monitoring 应用健康状态监控

提供可视化监控落地方案。

Spring Boot’s optional instrumentation framework, Micrometer, sends metrics straight to Prometheus, Atlas, and more to provide valuable insights. This is complemented by Spring Cloud’s Sleuth and Zipkin projects which offer distributed tracing so that you can follow along with what’s happening in real-time.



Microservices on Cloud Foundry 云原生解决方案

SpringBoot 可以作为 云原生软件架构的最小开发框架。

The small, stateless nature of microservices makes them ideal for horizontal scaling. Platforms like TAS and PKS can provide scalable infrastructure to match, with and greatly reduce your administrative overhead. Using cloud connectors, you can also consume multiple backend services with ease.



Reactive 响应式编程

响应式系统的特点有利于构建低延迟、高吞吐量的工作。

Project Reactor和Spring产品组合一起使开发人员能够构建可响应,有弹性,有弹性和消息驱动的企业级响应式系统。

Reactive systems have certain characteristics that make them ideal for low-latency, high-throughput workloads. Project Reactor and the Spring portfolio work together to enable developers to build enterprise-grade reactive systems that are responsive, resilient, elastic, and message-driven.

  • What is reactive processing?

Reactive processing is a paradigm that enables developers build non-blocking, asynchronous applications that can handle back-pressure (flow control).

响应式处理是使开发人员能够构建可处理背压(流控制)的非阻塞异步应用程序的范例。

  • Why use reactive processing?

Reactive systems better utilize modern processors. Also, the inclusion of back-pressure in reactive programming ensures better resilience between decoupled components.

响应式系统更好地利用了现代处理器。 另外,在响应式编程中包含背压可确保解耦组件之间具有更好的弹性。



Project Reactor 响应式编程项目

Project Reactor is a fully non-blocking foundation with back-pressure support included. It’s the foundation of the reactive stack in the Spring ecosystem and is featured in projects such as Spring WebFlux, Spring Data, and Spring Cloud Gateway.

更多项目: https://projectreactor.io/



Reactive Microservices 响应式微服务工程

One of the main reasons developers move from blocking to non-blocking code is efficiency. Reactive code does more work with fewer resources. Project Reactor and Spring WebFlux let developers take advantage of multi-core, next-generation processors—handling potentially massive numbers of concurrent connections. With reactive processing, you can satisfy more concurrent users with fewer microservice instances.



Reactive Microservices With Spring Boot 使用 Spring Boot 的响应式微服务工程

The Spring portfolio provides two parallel stacks. One is based on a Servlet API with Spring MVC and Spring Data constructs. The other is a fully reactive stack that takes advantage of Spring WebFlux and Spring Data’s reactive repositories. In both cases, Spring Security has you covered with native support for both stacks.

Spring产品组合提供了两个并行技术栈。

一种基于带有Spring MVC和Spring Data结构的Servlet API。 另一个是完全响应式技术栈,该技术栈利用了Spring WebFlux和Spring Data的响应式存储库。

Spring Security为两种技术栈都提供了原生支持。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-LxsSeQx8-1645084334467)(https://gitee.com/r0ad/filebed/raw/master/study-docs/spring-project/imgs/diagram-reactive.svg)]



Integration with common technologies 与通用技术的集成方案

以响应式访问和处理数据很重要。

  • MongoDB,Redis和Cassandra在Spring Data中都具有原生响应式支持。
  • 许多关系数据库(Postgres,Microsoft SQL Server,MySQL,H2和Google Spanner)都通过R2DBC提供了响应式支持。
  • 在消息传递领域,Spring Cloud Stream还支持对RabbitMQ和Kafka等平台的反应式访问。

Accessing and processing data in a reactive way is important. MongoDB, Redis, and Cassandra all have native reactive support in Spring Data. Many relational databases (Postgres, Microsoft SQL Server, MySQL, H2, and Google Spanner) have reactive support via R2DBC. In the world of messaging, Spring Cloud Stream also supports reactive access to platforms like RabbitMQ and Kafka.



Event Driven 事件驱动编程

事件驱动的系统反映了现代企业的实际工作方式-每天整天都有成千上万的小变化在发生。 Spring具有处理事件并使开发人员能够围绕事件进行开发的能力,这意味着您的应用将与您的业务保持同步。

Event-driven systems reflect how modern businesses actually work–thousands of small changes happening all day, every day. Spring’s ability to handle events and enable developers to build applications around them, means your apps will stay in sync with your business.

Spring has a number of event-driven options to choose from:

  • integration

  • streaming

  • cloud functions

  • data flows

  • Event-driven microservices 事件驱动微服务工程概念

When combined with microservices, event streaming opens up exciting opportunities—event-driven architecture being one common example. Spring simplifies the production, processing, and consumption of events, providing several useful abstractions.

  • Streaming data 流式数据事件概念

Streaming data represents a constant flow of events. One example might be a stock ticker. Every time a stock price changes, a new event is created. It’s called “streaming data” because there are thousands of these events resulting in a constant stream of data.

  • Integration 集成方案

事件驱动系统的核心是消息处理。The bedrock of any event-driven system is message handling.

Connecting to message platforms, routing messages, transforming messages, processing messages. With Spring you can solve these integration challenges quickly.



Spring Cloud Stream

Spring Cloud Stream 是集成 Apache Kafka, RabbitMQ, Azure Event Hub 开源项目的一个方案。优化和简化代码编写过程。

当与Apache Kafka,RabbitMQ,Azure Event Hub等一起使用时,Spring Cloud Stream可提高您的生产力,并提供三个关键抽象来简化您的代码。

  • “Binders”与外部消息传递系统集成。
  • “Bindings”弥合了消息传递系统和代码之间的鸿沟。
  • “Messages”提供了代码用于发送和接收数据的结构。

Spring Cloud Stream还为配置、内容转换、错误处理、配置管理、使用者组、分区、监视和运行状况检查提供支持。

Spring Cloud Stream improves your productivity when working with Apache Kafka, RabbitMQ, Azure Event Hub, and more, providing three key abstractions to simplify your code. “Binders” integrate with external messaging systems. “Bindings” bridge the gap between the messaging systems and your code. “Messages” provide the structure that your code uses to send and receive data.

Spring Cloud Stream also provides support for provisioning, content conversion, error handling, configuration management, consumer groups, partitioning, monitoring, and health checks.



Spring Cloud Function

Spring Cloud Function 提供使用 Spring API编写 FAAS 解决方案。

  • 编写一次函数并在任何地方(AWS,Azure等)运行它们;
  • 使用所有熟悉且全面的Spring API;
  • 将多个函数(function)链接在一起以创建新的函数(function);
  • 对多个输入和输出的支持,使得更容易的进行合并、连接和其他更高级。

Spring Cloud Function, enables you to write functions once and run them anywhere (AWS, Azure, etc.), while continuing to use all the familiar and comprehensive Spring APIs. You can chain multiple functions together to create new capabilities. Support for multiple inputs and outputs brings merging, joining, and other more advanced use cases within easy reach.



Spring Cloud Data Flow

Spring Cloud Data Flow 处理多种多个数据源的获取和推送解决方案。

  • 为开发人员提供了用于处理各种数据源和目标的一系列工具和自动化。
  • 可帮助跨多个云原生平台开发,部署,管理和扩展高吞吐量流数据管道。
  • 具有丰富的用户界面,可用于构建和监视应用程序。

Spring Cloud Data Flow offers developers a range of tools and automation for working with all kinds of data sources and destinations. Spring Cloud Data Flow helps you to develop, deploy, manage, and scale high-throughput streaming data pipelines across multiple cloud-native platforms. It also features a rich user interface for building and monitoring your applications.



Spring Cloud Kafka Streams

Spring Cloud Stream 集成 Kafka 的定制 Binder 解决方案。

  • 专注于开发人员的生产力,但是增加了对Kafka特定功能(如KStream,KTable和GlobalKTable)的支持。
  • 负责连接到Kafka,以及创建、配置和维护流和主题。

Spring Cloud Stream provides a second, more specific binder solely for working with Kafka Streams. This special binder still focuses on developer productivity but adds support for Kafka-specific features like KStream, KTable, and GlobalKTable. As with regular Spring Cloud Stream, the binder also takes care of connecting to Kafka, as well as creating, configuring, and maintaining the streams and topics.



Spring AMQP and Spring for Apache Kafka

使用Spring编写消息中间件编写框架。

  • 通过Spring AMQP和Spring for Apache Kafka项目,将Spring的核心概念应用于基于Kafka或RabbitMQ的消息传递解决方案的开发。
  • 两者都包括“模板”(template)作为高级消息处理抽象,并通过

    “侦听器容器”(listener container)

    支持消息驱动的POJO。

With the Spring AMQP and Spring for Apache Kafka projects, you can apply core Spring concepts to the development of Kafka- or RabbitMQ-based messaging solutions.

Both include “template” as a high-level message handling abstraction, and support message-driven POJOs with a “listener container.”



Spring Integration

应用程序集成是每个企业面临的挑战。Spring Integration 通过将流行的Spring编程模型扩展到包括所有最常见的集成模式来解决这个挑战。

Spring Connector 可用于消息传递平台、通信协议、文件系统和服务提供商,以及常见模式的实现,例如消息路由、数据转换和过滤器。

Application integration is a challenge for every enterprise. Spring Integration eases this burden by extending the popular Spring programming model to include all the most common integration patterns. There are ready made connectors for messaging platforms, communications protocols, file systems, and service providers, as well as implementations of common patterns like message routing, data transformation, and filters.



Cloud

Spring Cloud 为构建SaaS平台提供了一整套解决方案。

开发分布式系统具有挑战性。 复杂性已从应用程序层转移到网络层,并要求服务之间进行更大的交互。 将代码设为“云原生”意味着要处理 12-Factor ,例如外部配置,无状态,日志记录以及连接到支持服务。 Spring Cloud 项目套件包含使应用程序在云中运行所需的许多服务。

Developing distributed systems can be challenging. Complexity is moved from the application layer to the network layer and demands greater interaction between services. Making your code ‘cloud-native’ means dealing with 12-factor issues such as external configuration, statelessness, logging, and connecting to backing services. The Spring Cloud suite of projects contains many of the services you need to make your applications run in the cloud.

软件通常会作为一种服务来交付,它们被称为网络应用程序,或软件即服务(SaaS)。12-Factor 为构建如下的 SaaS 应用提供了方法论:

  • 使用标准化流程自动配置,从而使新的开发者花费最少的学习成本加入这个项目。
  • 和操作系统之间尽可能的划清界限,在各个系统中提供最大的可移植性。
  • 适合部署在现代的云计算平台,从而在服务器和系统管理方面节省资源。
  • 将开发环境和生产环境的差异降至最低,并使用持续交付实施敏捷开发。
  • 可以在工具、架构和开发流程不发生明显变化的前提下实现扩展。

这套理论适用于任意语言和后端服务(数据库、消息队列、缓存等)开发的应用程序。



Spring Cloud architecture highlights 架构设计

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nC2t8gXi-1645084334467)(https://gitee.com/r0ad/filebed/raw/master/study-docs/spring-project/imgs/cloud-diagram-dark.svg)]



Service discovery 服务发现

在云服务中,应用程序不能总是知道其他服务的确切位置。

  • 注册中心服务,比如Netflix Eureka,或者一个sidecar解决方案,比如HashiCorp Consul,都会有所帮助。
  • 注册中心客户端,springcloud为流行的注册中心提供DiscoveryClient实现,比如Eureka、Consul、Zookeeper,甚至Kubernetes的内置系统。
  • 服务负载均衡,springcloud负载均衡器可以在服务实例之间小心地分配负载。

In the cloud, applications can’t always know the exact location of other services. A service registry, such as Netflix Eureka, or a sidecar solution, such as HashiCorp Consul, can help. Spring Cloud provides DiscoveryClient implementations for popular registries such as Eureka, Consul, Zookeeper, and even Kubernetes’ built-in system. There’s also a Spring Cloud Load Balancer to help you distribute the load carefully among your service instances.



API gateway 能力开发网关

Spring Cloud Gateway 提供云架构中多客户端和多服务器访问权限、路由等问题的解决方案。

  • 网关可以保护和路由消息、隐藏服务、限制负载以及许多其他有用的事情。
  • Spring Cloud Gateway 为您提供了对API层的精确控制。
  • 集成了SpringCloud服务发现和客户端负载平衡解决方案,以简化配置和维护。

With so many clients and servers in play, it’s often helpful to include an API gateway in your cloud architecture. A gateway can take care of securing and routing messages, hiding services, throttling load, and many other useful things. Spring Cloud Gateway gives you precise control of your API layer, integrating Spring Cloud service discovery and client-side load-balancing solutions to simplify configuration and maintenance.



Cloud configuration 在线配置

Spring Cloud Config 提供多应用程序、多环境和多服务实例,动态配置、配置版本管理解决方案。

  • 云架构中配置不能简单地嵌入到应用程序中。配置必须足够灵活,以应对多个应用程序、环境和服务实例,并在不停机的情况下处理动态更改。
  • Spring Cloud Config 旨在减轻这些负担,并提供与Git等版本控制系统的集成,以帮助您确保配置的安全。

In the cloud, configuration can’t simply be embedded inside the application. The configuration has to be flexible enough to cope with multiple applications, environments, and service instances, as well as deal with dynamic changes without downtime. Spring Cloud Config is designed to ease these burdens and offers integration with version control systems like Git to help you keep your configuration safe.



Circuit breakers 服务断路器
  • 分布式系统存在不可靠的情况。请求可能会遇到超时或完全失败。
  • 断路器可以帮助缓解这些问题,Spring Cloud 断路器提供了三种流行的选择:Resilience4J、Sentinel或Hystrix。

Distributed systems can be unreliable. Requests might encounter timeouts or fail completely. A circuit breaker can help mitigate these issues, and Spring Cloud Circuit Breaker gives you the choice of three popular options: Resilience4J, Sentinel, or Hystrix.



Tracing 服务追踪

提供基于 Zipkin 的服务追踪方案。

Debugging distributed applications can be complex and take a long time. For any given failure, you might need to piece together traces of information from several independent services. Spring Cloud Sleuth can instrument your applications in a predictable and repeatable way. And when used in conjunction with Zipkin, you can zero in on any latency problems you might have.



Testing 服务测试

Contract-based 测试方案提高测试效率。

In the cloud, you get extra points for having reliable, trustworthy, stable APIs—but getting there can be a journey. Contract-based testing is one technique that high-performing teams often use to stay on track. It helps by formalizing the content of APIs and building tests around them to ensure code remains in check.



Web Applications 网络应用

Spring 提供完整的面向浏览器端的编码方案。

Spring makes building web applications fast and hassle-free. By removing much of the boilerplate code and configuration associated with web development, you get a modern web programming model that streamlines the development of server-side HTML applications, REST APIs, and bidirectional, event-based systems.



Developer productivity 开发效率

Spring Boot 作为一个开箱即用的框架、完整的工具生态可以提高开发效率。

Spring Boot is the starting point of your developer experience, whatever you’re building. Spring Boot is designed to get you up and running as quickly as possible, with minimal upfront configuration. With its embedded application servers, you can be serving in seconds.

Spring’s out-of-the-box, production-ready features (like tracing, metrics, and health status) provide developers with deep insight into their applications.

Finally, Spring supports multiple JVM languages: Java, Kotlin, and Groovy.



Battle-tested security 安全测试

Spring Security 支持工业级的授权协议,包括 SAML、OAuth、LDAP。

When it’s time to secure your web application, Spring Security supports many industry-standard authentication protocols, including SAML, OAuth, and LDAP.

Get protection from top

OWASP

attacks, such as session fixation, clickjacking, cross-site request forgery, and more.



Data access made easy 数据访问

Spring 提供对大数据、关系数据、非关系数据和基于云服务数据的访问能力api。

Spring helps developers connect their web applications to a number of data stores. It supports relational and non-relational databases, map-reduce frameworks, and cloud-based data services.



Serverless 无服务

  • 无服务器应用程序利用现代云计算功能和抽象,让您将重点放在逻辑上,而不是基础设施上。
  • 在无服务器环境中,您可以集中精力编写应用程序代码,而底层平台负责扩展、运行时、资源分配、安全性和其他“服务器”细节。

Serverless applications take advantage of modern cloud computing capabilities and abstractions to let you focus on logic rather than on infrastructure. In a serverless environment, you can concentrate on writing application code while the underlying platform takes care of scaling, runtimes, resource allocation, security, and other “server” specifics.


  • What is serverless?

无服务器工作负载是“事件驱动的工作负载,与通常由服务器基础结构处理的方面无关。”

诸如“要运行多少实例”和“要使用什么操作系统”之类的问题都由作为服务平台的函数(或FaaS)管理,使开发人员可以自由地关注业务逻辑。

Serverless workloads are “event-driven workloads that aren’t concerned with aspects normally handled by server infrastructure.” Concerns like “how many instances to run” and “what operating system to use” are all managed by a Function as a Service platform (or FaaS), leaving developers free to focus on business logic.


  • Serverless characteristics?

Serverless applications have a number of specific characteristics, including:

  • Event-driven code execution with triggers
  • Platform handles all the starting, stopping, and scaling chores
  • Scales to zero, with low to no cost when idle
  • Stateless

无服务器应用程序具有许多特定特性,包括:

  • 事件驱动的触发器代码执行
  • 平台处理所有启动、停止和缩放任务
  • 规模扩大成本为零,空闲时成本为零
  • 无状态的


Serverless vs Traditional Stack 传统应用和无服务对比


Function as a Service (FaaS)
  • Event-driven execution.

  • Developers delegate all server-specific tasks to the FaaS platform.

  • Developers only write business logic that is invoked by the platform, allowing for a more resilient requirement evolution as business needs change.

  • 事件驱动执行。

  • 开发人员将所有特定于服务器的任务委托给FaaS平台。

  • 开发人员只编写由平台调用的业务逻辑,允许随着业务需求的变化进行更具弹性的需求演化。



Traditional applications
  • Must maintain server infrastructure (installing, configuring, patching, upgrading, etc.).

  • Infrastructure scales in ways that might not be dynamic enough for the workload (wasting resources).

  • Developers write integration code to deal with messaging platforms, HTTP request/responses, etc.

  • 必须维护服务器基础设施(安装、配置、修补、升级等)。

  • 基础设施的扩展方式可能不够动态,无法满足工作负载(浪费资源)。

  • 开发人员编写集成代码来处理消息传递平台、HTTP请求/响应等。



Why Spring and Serverless? 选择 Spring Cloud Function原因
  • Spring产品组合提供了一个健壮的功能集合,可以在无服务器应用程序中使用。
  • 无论是使用Spring数据访问数据,使用Spring集成的企业集成模式,还是使用Spring框架和projectreactor的最新反应式编程,Spring都能让开发人员从一开始就在无服务器的环境中工作。
  • Spring还可以帮助您的函数避免供应商锁定。Spring Cloud Function 提供的适配器允许您在其平台上运行代码时与特定于供应商的api分离。

The Spring portfolio provides a robust collection of functionality for use within serverless applications. Whether accessing data with Spring Data, using the enterprise integration patterns with Spring Integration, or using the latest in reactive programming with Spring Framework and Project Reactor, Spring lets developers be productive in a serverless environment from day one.

Spring also helps your functions avoid vendor lock-in. The adapters provided by Spring Cloud Function let you decouple from vendor-specific APIs when running your code on their platform.



In detail: Spring Cloud Function

Spring Cloud Function 提供了一些功能,让Spring开发人员从无服务器或FaaS平台获益。


java.util.function

包是Spring云函数使用的编程模型的基础。简而言之,Spring云函数提供了:

  • 编程风格的选择:反应式、命令式或混合式。
  • 功能组合与顺应(如用被动语态组合祈使式功能)。
  • 支持具有多个输入和输出的反应函数,让函数处理合并、连接和其他复杂的流操作。
  • 输入和输出的透明类型转换。
  • 针对目标平台(如projectriff、awslambda等)的部署打包功能;见下文)。
  • 具有灵活签名的函数(POJO函数),“如果它看起来像一个函数,那么它就是一个函数”
  • Spring的习惯用法和编程模型的所有其他好处。

Spring Cloud Function 提供了适配器,可以在最常见的FaaS服务上运行您的函数,包括 AWS Lambda 、 Apache OpenWhisk 、 Microsoft Azure 和 Project Riff。

Spring Cloud Function provides capabilities that lets Spring developers take advantage of serverless or FaaS platforms.

The

java.util.function

package from core Java serves as the foundation of the programming model used by Spring Cloud Function. In a nutshell, Spring Cloud Function provides:

  • Choice of programming styles: reactive, imperative, or hybrid.
  • Function composition and adaptation (such as composing imperative functions with reactive).
  • Support for reactive function with multiple inputs and outputs to let functions handle merging, joining, and other complex streaming operations.
  • Transparent type conversion of inputs and outputs.
  • Packaging functions for deployments, specific to the target platform (such as Project Riff, AWS Lambda, and more; see below).
  • Functions with flexible signatures (POJO functions) – “if it looks like a function, it’s a function”
  • All other benefits of Spring’s idioms and programming model.

Spring Cloud Function provides adaptors so that you can run your functions on the most common FaaS services including Amazon Lambda, Apache OpenWhisk, Microsoft Azure, and Project Riff.



Batch

  • 批处理有效处理大量数据的能力使它非常适合许多工作场景。
  • Spring Batch 实现的行业标准处理模式允许您在JVM上构建健壮的批处理作业。
  • 通过从Spring产品组合中添加Spring引导和其他组件,可以构建任务关键型批处理应用程序(mission-critical batch applications)。

The ability of batch processing to efficiently process large amounts of data makes it ideal for many use cases. Spring Batch’s implementation of industry-standard processing patterns lets you build robust batch jobs on the JVM. Adding Spring Boot and other components from the Spring portfolio lets you build mission-critical batch applications.


  • What is batch processing?


    Batch processing is the processing of a finite amount of data in a manner that does not require external interaction or interruption.

    批处理是以不需要外部交互或中断的方式处理有限数量的数据。


  • Why build batch processes?


    Batch processes are an extremely efficient way of processing large amounts of data. The ability to schedule and prioritize work based on SLAs lets you allocate resources for best utilization.

    批处理是处理大量数据的一种非常有效的方法。基于SLA的工作计划和优先级的能力使您能够分配资源以获得最佳利用率。



Batch processing with Spring
  • Spring Batch 实际上是JVM上批处理的标准。
  • Spring Batch 对常见批处理模式(如基于块的处理和分区)的实现可以创建高性能、可伸缩的批处理应用程序,这些应用程序对于大多数任务关键型流程来说具有足够的弹性。
  • Spring Boot 提供了一个额外的生产级特性,可以让您加快批处理过程的开发。

Spring Batch is the de facto standard for batch processing on the JVM. Its implementation of common batch patterns, such as chunk-based processing and partitioning, lets you create high-performing, scalable batch applications that are resilient enough for your most mission-critical processes. Spring Boot provides an additional level of production-grade features to let you speed up the development of your batch processes.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6G3pDjsI-1645084334467)(https://gitee.com/r0ad/filebed/raw/master/study-docs/spring-project/imgs/Batch-processing-with-Spring.svg)]



Batch processing in the cloud

批处理非常适合云计算,尤其是基础设施即服务(IaaS)。Spring Batch可以很好的利用云特性,包括以按需、弹性可伸缩和容错方式运行应用程序的能力

Batch processing fits perfectly with cloud computing, and Infrastructure as a Service (IaaS), in particular. The ability to run applications in an on-demand, elastically scalable, and fault-tolerant manner are all cloud features that Spring Batch can use.



Integration with common technologies
  • Spring Batch 与其他 Spring API 的集成非常容易。
  • 通过对文件、关系数据库和NoSQL存储的 ItemReader 和 ItemWriter 支持。
  • 通过 Apache Kafka 和 RabbitMQ 提供的Spring数据和消息传递支持。
  • Spring Batch 能够即时处理大多数场景。

Spring Batch’s integration with other Spring APIs lets you be productive from day one. With ItemReader and ItemWriter support for files, relational databases and NoSQL stores support via Spring Data and messaging support through Apache Kafka and RabbitMQ, Spring Batch has the ability to handle most use cases out of the box.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-FXbh4Kg6-1645084334468)(https://gitee.com/r0ad/filebed/raw/master/study-docs/spring-project/imgs/diagram-batch2-dark.svg)]



参考



版权声明:本文为sunzroad原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。