Extract,Transform, and load(ETL)

Briefly stated, ETL is a process in the database anddata-warehousing world that performs the following steps:

  1. Extracts data from an external data source
  2. Transforms the extracted data to match a specific purpose
  3. Loads the transformed data into a data target; a database or data warehouse.

Many products, both free and commercial, can help create ETLprocesses. This is a bigger topic than we can address here, bt it isn’t alwaysas simple as these three steps. Writing an ETL process can present its own setof challenges invloving parallel processing, rerunnability, and recoverability.The ETL community has developeed its own set of best practices to meet theseand other requirements.

For the prurpose of our discussion, this ETL process is ablack box; it could be implemented with an ETL tool(like Talend) or even withanother Spring Batch job.

Spring Batch includes many ready-to-use components to readfrom and write to daa stores like files and databases.

Chunk Processing is particularly well suited to handle largedata operations because a job handles itenms in small chunks instead ofprocessing them all at once. Practically speaking, a large file won’t be loadedin memory; instead it’s streamed, which is more efficient in terms of memory consumption.Chunk processing allows more flexibility to manage the data flow in a job.Spring Batch also handles transactions and errors around read and writeoperations.

Spring Batch provides the FlatFileItemReader class to readrecords from a flat file. To use a FlatFileItemReader, you need to configuraresome Spring beans and implement a component that creates domain objects fromwhat the FlatFileItemReader reads;Spring Batch will handle the rest.

Choosing a chunk size and commit interval

First, the size of a chunk and the commit interval are thesame thing! Second, there’s no definitive value to choose. Our recommendationis a value between 10 and 200. Too small a chunk size creates too many transactions,which is costly and makes the job run slowly. Too alrge a chunk size makestransactional resources-like databases-run slowly too, because a database mustbe able to roll back operations. The best value for the commit interval dependson many factors:data, processing, nature of the resources, and so on. Thecommit interval is a parameter in Spring Batch, so don’t hesitate to change itto find the most appropriate value for your jobs.

Decompressing a file isn’t a read-write step, but Springbatch is flexible enough to implement such a task as part of a job.A 1-GB flatfile can compress to 100MB, which is a more reasonable size for file transfersover the internet.

Note that you could encrypt the file as well, ensuring thatno one could read the product data if the file were intercepted duringtransfer. The encryption could be done before the compression or as part of it.Spring Batch provides an extension point to handle processing in a batchprocess step: The Tasklet. You implement a Tasklet that decompresses a ZIParchive into its source flat file.

How does a job refer to the job repository?

You may have noticed that we say a job needs the jobrepository to run but we don’t make any reference to the job repository bean inthe job configuration. The XML step element can have its job-repositoryattribute refer to a job repository bean. This attribute isn’t mandatory,because by default the job uses a jobRepository bean. As long as you declare ajobRepository bean of type JobRepository, you don’t need to explicitly refer toit in your job configuration.

Spring Batch Framework– introduction chapter(下)的更多相关文章

  1. Spring Batch 使用场景

    一个标准的批处理程序通常会从数据库,文件或者队列中读取大量的数据和记录,然后对获取的数据进行处理,然后将修改后的格式写回到数据库中. 通常 Spring Batch 在离线模式下进行工作,不需要用户干 ...

  2. Spring Batch Concepts Chapter

    Spring Batch Concepts Chapter The below figure shows two kinds of Spring Batch components:infrastruc ...

  3. Spring Boot下Spring Batch入门实例

    一.About Spring Batch是什么能干什么,网上一搜就有,但是就是没有入门实例,能找到的例子也都是2.0的,看文档都是英文无从下手~~~,使用当前最新的版本整合网络上找到的例子. 关于基础 ...

  4. 初探Spring Batch

    此系列博客皆为学习Spring Batch时的一些笔记: 为什么我们需要批处理? 我们不会总是想要立即得到需要的信息,批处理允许我们在请求处理之前就一个既定的流程开始搜集信息:比如说一个银行对账单,我 ...

  5. Spring Batch的事务-Part 1:基础

    原文 https://blog.codecentric.de/en/2012/03/transactions-in-spring-batch-part-1-the-basics/ This is th ...

  6. Spring Batch 批处理框架介绍

    前言 在大型的企业应用中,或多或少都会存在大量的任务需要处理,如邮件批量通知所有将要过期的会员,日终更新订单信息等.而在批量处理任务的过程中,又需要注意很多细节,如任务异常.性能瓶颈等等.那么,使用一 ...

  7. [Spring Batch 系列] 第一节 初识 Spring Batch

    距离开始使用 Spring Batch 有一段时间了,一直没有时间整理,现在项目即将完结,整理下这段时间学习和使用经历. 官网地址:http://projects.spring.io/spring-b ...

  8. Spring Batch(0)——控制Step执行流程

    Conditional Flow in Spring Batch I just announced the new Learn Spring course, focused on the fundam ...

  9. Spring Batch在大型企业中的最佳实践

    在大型企业中,由于业务复杂.数据量大.数据格式不同.数据交互格式繁杂,并非所有的操作都能通过交互界面进行处理.而有一些操作需要定期读取大批量的数据,然后进行一系列的后续处理.这样的过程就是" ...

随机推荐

  1. RadioGroup 的 RadioButton 选择改变字体颜色和背景颜色

    RadioGroup <RadioGroup android:id="@+id/client_charge_radiogroup" android:layout_width= ...

  2. 中文输入法在vs2010中失效解决方案

    这样你就可以用切换输入法的方式,输入中文咯.     后来用了2次发现还是有问题,后来我就直接把输入法的切换改成ctrl+1,后来使用就一直没有问题.总之,解决方案视具体情况解决.

  3. pmtest1.asm pmtest2.asm pmtest5.asm 这几个比较重要.

    读代码时注意Label后面的文字:desc表示是描述符,seg表示是段 pmtest1.asm 主要讲进入保护模式 http://www.cnblogs.com/wanghj-dz/archive/2 ...

  4. 第一章 USB Type C的基本原理

    图 1: USB Type C接头外形 USB Type C(简称USB-C)的基本特性: 1. 接口插座的尺寸与原来的Micro USB规格一样小,约为8.3mm X 2.5mm 2. 可承受1万次 ...

  5. Java JSON序列化杂谈

    在C#中序列化是比较容易的,如果不用第三方的类库,那么C#提供的两个对象也够我们使用,一般的操作是定义一个不含有方法的类,这个类里面定义了要序列化的对象的属性,因为我C#用的比较多,这里直接给出泛型, ...

  6. restful理解

    越来越多的人开始意识到,网站即软件,而且是一种新型的软件. 这种"互联网软件"采用客户端/服务器模式,建立在分布式体系上,通过互联网通信,具有高延时(high latency).高 ...

  7. Layout Resource官方教程(1)简介

    Layout Resource SEE ALSO Layouts A layout resource defines the architecture for the UI in an Activit ...

  8. wildfly9 配置SSL单向认证/https

    D:\>keytool -genkey -keystore cdi-init.keystore -alias cdi-init -keyalg RSA -keysize 2048 -validi ...

  9. Journal.Today 1.0.0

    我喜欢把一天的日记都放在一个文件中,而不是每次都新建一个文件.   写了一个脚本,检测当天是否已经新建日记,已经新建则打开,未新建则新建并打开.   其中我不太喜欢Wiz日记本来的标题命名方式,所以都 ...

  10. Linux下归档与压缩工具笔记

    tar具体使用笔记 归档工具 tar 语法 功能 选项 常见搭配 压缩工具 bzip2 工具 使用方法 gzip 工具 zip 工具 归档工具 tar tar是一个开源的Linux/Unix中最广泛使 ...