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. [转载]C#读写配置文件(XML文件)

    .xml文件格式如下 [xhtml] view plaincopy <?xml version="1.0" encoding="utf-8"?> & ...

  2. Computer Vision的尴尬---by林达华

    Computer Vision的尴尬---by林达华 Computer Vision是AI的一个非常活跃的领域,每年大会小会不断,发表的文章数以千计(单是CVPR每年就录取300多,各种二流会议每年的 ...

  3. codeforces 395B2 iwiwi

    #include<cstdio> #include<cstring> using namespace std; ]="iiiiiiiiiiiiiiiiiiiiii&q ...

  4. Windows下虚拟Linux

    andlinux cygwin virtualbox VMware XenServer

  5. Ajax.BeginForm返回方法OnSuccess

    在MVC3里面——程序集 System.Web.Mvc.dll, v4.0.30319有这么一个Ajax.BeginForm异步登录验证的类型,我们在下面给出一个例子:在登录页面Logion.csht ...

  6. easyui源码翻译1.32--Form(表单)

    前言 使用$.fn.form.defaults重写默认值对象下载该插件翻译源码 form提供了各种方法来操作执行表单字段,比如:ajax提交, load, clear等等.当提交表单的时候可以调用va ...

  7. 很受欢迎的Linux笔记(短小精悍)

    http://blog.csdn.net/xsl1990/article/details/8274028 如何知道所使用的LINUX是哪个发行版? lsb_release -a 查找某个文件的另类方法 ...

  8. HANA内存数据库与oracle数据库的性能比较

    链接: http://wenku.it168.com/redian/hana/ 1.传统磁盘数据库的基本访问模式.为了提高性能在产品和应用之间会加入缓存的内存区域.传统数据库性能瓶颈主要出现在一个是内 ...

  9. hdu 2089 不要62(初学数位DP)

    http://acm.hdu.edu.cn/showproblem.php?pid=2089 题意: 给定 m,.n; 求车牌号 m~n之间 有多少数字 不含 4或62     ,8652是可以的 . ...

  10. POJ_1269_Intersecting_Lines_(计算几何基础)

    描述 http://poj.org/problem?id=1269 给出两条直线,判断它们是平行,重合,还是相交,如果相交,求出交点. 分析 比较裸的一道题.学习了直线的写法(参数方程) #inclu ...