문서의 선택한 두 판 사이의 차이를 보여줍니다.
양쪽 이전 판 이전 판 다음 판 | 이전 판 다음 판 양쪽 다음 판 | ||
springframework:batch [2019/12/03 14:10] kwon37xi |
springframework:batch [2022/11/09 10:42] kwon37xi [Chunk 사이즈가 크고 Transaction 이 긴데, 외부에 write 대상건을 알려주는 경우 DB Lock 발생할 수 있음] |
||
---|---|---|---|
줄 1: | 줄 1: | ||
====== Spring Framework Batch ====== | ====== Spring Framework Batch ====== | ||
* [[springframework: | * [[springframework: | ||
- | * [[http:// | ||
- | * [[https:// | ||
- | * [[http:// | ||
- | * [[https:// | ||
- | * Spring Batch 2.2 JavaConfig | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * Spring Batch Transaction | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[http:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[http:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[https:// | ||
- | * [[http:// | ||
- | |||
===== @EnableBatchProcessing ===== | ===== @EnableBatchProcessing ===== | ||
줄 77: | 줄 44: | ||
===== Transaction 설정 ===== | ===== Transaction 설정 ===== | ||
+ | ==== Connection Pool 설정 ==== | ||
+ | * batch job 이 job 단위로 단독 프로세스로 실행되는 경우 | ||
+ | * batch job 은 실제로 Parallel 로 실행되는게 아니면 DB 커넥션이 1~2개 정도 밖에 필요하지 않다. | ||
+ | * parallel, async 실행에 대비해서 maximum connection 갯수는 충분한 숫자로 하되, | ||
+ | * minimum 갯수를 5개 혹은 그 이하로 지정해야 Batch job 이 실행 될 때마다 커넥션을 과도하게 맺느라 들어가는 실행시간 지연 문제를 해소하고, | ||
+ | |||
==== 트랜잭션 매니저를 지정하지 않으면 ==== | ==== 트랜잭션 매니저를 지정하지 않으면 ==== | ||
TransactionManager를 지정하지 않으면 다음과 같은 오류가 발생한다. | TransactionManager를 지정하지 않으면 다음과 같은 오류가 발생한다. | ||
줄 115: | 줄 88: | ||
* 외부에서 그 데이터를 사용할 수 있게 하고자 했다면, | * 외부에서 그 데이터를 사용할 수 있게 하고자 했다면, | ||
* 절대로 Step 에 트랜잭션 매니저를 지정하지 말고, '' | * 절대로 Step 에 트랜잭션 매니저를 지정하지 말고, '' | ||
+ | * '' | ||
* 안그러면 CHUNK size 만큼의 처리가 모두 끝날때까지 DB lock 이 잡혀있어서 외부에서 이벤트를 받아서 처리하는 측에서 lock 획득에 실패해서 오류가 발생하게 된다. | * 안그러면 CHUNK size 만큼의 처리가 모두 끝날때까지 DB lock 이 잡혀있어서 외부에서 이벤트를 받아서 처리하는 측에서 lock 획득에 실패해서 오류가 발생하게 된다. | ||
줄 162: | 줄 136: | ||
> o.s.b.c.l.AbstractListenerFactoryBean | > o.s.b.c.l.AbstractListenerFactoryBean | ||
+ | > org.springframework.batch.item.ItemReader는 인터페이스입니다. 구현 클래스는 어노테이션 기반 listner 구성에 대해 실행되지 않습니다. @Bean 메소드에서 @StepScope를 사용하는 경우 listner 어노테이션을 사용할 수 있도록 구현 클래스를 리턴해야합니다. | ||
+ | |||
+ | |||
줄 178: | 줄 155: | ||
* [[https:// | * [[https:// | ||
* [[https:// | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * Spring Batch 2.2 JavaConfig | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * Spring Batch Transaction | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[http:// | ||
+ | * [[https:// |