如何在Spring Batch中使用基于Chuck的方法从数据库中从数据库中读取较大的数据集?

发布于 2025-02-13 05:56:54 字数 528 浏览 0 评论 0原文

我必须从数据库中进行几个数据读取,其中包括较大的数据集,并在处理后将内容写入文件。

示例

  • | < - 从数据库中读取帐户数据
  • | < - process&从数据库中读取较小的帐户数据集
  • | < - process&根据上述数据读取数据库中较小的数据子集
  • | < - process&从数据库中读取较大的数据集(基于块的方法首选)
  • | < - process&根据上述数据读取数据库中较小的数据子集
  • | - >过程&将上述所有收集/处理的数据写入文件

多步处理是可能的,但是它在阶跃处理中具有许多间接费用,包括步骤数据传输,因为我们必须从上述所有数据集中创建一个文件。

对于较大的数据集,无法缓存数据集和使用时使用。

简单的数据读取(通用)在处理器中的较大数据集中消耗了很多时间&记忆。

将其转换为基于春季的批处理处理服务的可能方法是什么?

I have to make several data reads from a database including a larger dataset in between and write the content to a file after processing.

Example

  • | <- read account data from the database
  • | <- Process & Read a smaller account dataset from the database
  • | <- Process & Read smaller data sub-set from the database based on the above data
  • | <- Process & read a larger dataset from the database (chunk-based approach preferred)
  • | <- Process & read smaller data sub-set from the database based on the above data
  • | -> Process & write all the above collected/ processed data to a file

Multi-step processing is possible but it has a lot of overheads in step handling including inter-step data transfer since we have to create a single file from all the above data sets.

Caching the data set and use while processing is not possible for the larger dataset.

Simple data reads (generic) within processors for a larger dataset consume a lot of time & memory.

What would be the possible approaches to convert this to a Spring-Batch-based batch processing service?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾城°AllureLove 2025-02-20 05:56:54

我认为Spring Batch提供的面向块的处理模型不适合您的用例。

我认为多步处理是要进行的方式,因为这是您的要求(这几乎是由您的要求决定的),至少这是我看到它在没有春季批处理的情况下实现的

I think the chunk-oriented processing model provided by Spring Batch is not suitable to your use case.

Multi-step processing is the way to go in my opinion, because this is what your requirement is about (this is almost dictated by your requirement), at least this is how I see it implemented without Spring Batch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文