Spring Batch Scaling - stellaxxx/batch GitHub Wiki
- Multi-threaded Step
- Parallel Steps
- Remote Chunking of Step
- Partitioning a Step
<step id="loading">
<tasklet task-executor="taskExecutor" throttle-limit="20">...</tasklet>
</step>- Step executes by reading, processing and writing each chunk of items (each commit interval) in a separate thread of execution. commit interval ๋จ์๋ก item์ ์ชผ๊ฐ์ ์ฌ๋ฌ ์ค๋ ๋์์ step์ด ์ํ๋จ.
- there is no fixed order for the items to be processed, and a chunk might contain items that are non-consecutive compared to the single-threaded case. ์์ ๋ณด์ฅ๋์ง ์์. ์คํ๋๋ chunk ๋ด์ item ์ญ์ sequencialํ์ง ์์ ์ ์์.
- default throttle limit : 4
<step id="step1.master">
<partition step="step1" handler="handler"/></step>
<bean class="org.spr...TaskExecutorPartitionHandler">
<property name="taskExecutor" ref="taskExecutor"/>
<property name="step" ref="step1" />
<property name="gridSize" value="10" /></bean>- The Job is executing on the left hand side as a sequence of Steps, and one of the Steps is labelled as a Master. The Slaves in this picture are all identical instances of a Step, which could in fact take the place of the Master resulting in the same outcome for the Job. ํน์ ํ Step์ ๋ํด M/S ๊ตฌ์กฐ๋ก ๊ตฌ๋ํ๊ฒ ํจ. Master๊ฐ ๋ step์ slave๋ค์ ๋ํด ๊ตฌ๋ ์๊ทธ๋์ ๋ณด๋ด๊ณ ์๋ต๋ง ๋ฐ์.
- The Slaves are typically going to be remote services, but could also be local threads of execution. Slave์ ๊ฒฝ์ฐ remote/local ๋ชจ๋ ๊ฐ๋ฅํจ.
- PartitionHandler : simple RMI remoting, EJB remoting, custom web service, JMS, Java Spaces, shared memory grids (like Terracotta or Coherence), grid execution fabrics (like GridGain) <-- Remote์ ๋ํด ์ง์๋๋ ๋ฐฉ์
- gridSize : determines the number of separate step executions to create. default value is 10. ์์ฑ๋๋ slave์ max count.
- spring batch ensure that one execution of slave step per one job. ํ JOB์ step์ ๋ํด slave๊ฐ ํ๋ฒ๋ง ์คํ๋๋ ๊ฑธ ํ๋ ์์ ๋ ๋ฒจ์์ ๋ณด์ฅํจ.
- Many articles recommand this solution for solving issues of batch scaling.
- Spring Integration์ ํตํ remote management. (batch integration)
- Using MessageChannelPartitionHandler
- remote slave๋ค์ ๊ฐ๊ฐ ItemReader, ItemWriter, ItemProcessor๋ฅผ ๊ฐ์ง (๋์ผํ step์ copy)
- remote worker (remote partitionor)๋ฅผ ๊ตฌ์ฑํ๊ณ step์ ๋ํ ์๋ต์ ๋ฐ์.
- JMS, AMQP ๋ก abstraction ์ ๊ณตํจ. (๋ฐ๋ก ๋ฏธ๋ค์จ์ด ์ค์น ์์ด ์ค์ ๋ง์ผ๋ก ๊ฐ๋ฅ...)
