문자전송 배치 테스트
This commit is contained in:
parent
26d9cadc81
commit
70f5d21b25
@ -4166,8 +4166,6 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
|
||||
|
||||
|
||||
// 시작 시간 측정
|
||||
long startTime = System.currentTimeMillis();
|
||||
System.out.println("==================== insert 시작 ====================");
|
||||
|
||||
|
||||
@ -4178,21 +4176,29 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_advc(mjonMsgSendVOList);
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_jdbc_advc(mjonMsgSendVOList);
|
||||
|
||||
//
|
||||
int instCnt = 0;
|
||||
int batchSize = (int) Math.ceil((double) mjonMsgSendVOList.size() / 3); // Batch 크기 계산
|
||||
// Batch 처리
|
||||
for (int i = 0; i < mjonMsgSendVOList.size(); i += batchSize) {
|
||||
System.out.println(" i :: "+ i);
|
||||
// Batch 크기만큼 리스트를 잘라냄
|
||||
List<MjonMsgSendVO> batchList = mjonMsgSendVOList.subList(
|
||||
i, Math.min(i + batchSize, mjonMsgSendVOList.size())
|
||||
);
|
||||
// 시작 시간 측정
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
// DAO 메서드 호출
|
||||
int insertedCount = mjonMsgDataDAO.insertMsgDataInfo_advc(batchList);
|
||||
instCnt += insertedCount; // 총 삽입된 건수 누적
|
||||
}
|
||||
int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수
|
||||
int batchSize = (int) Math.ceil((double) totalSize / 3); // 기본 3등분 크기 계산
|
||||
|
||||
// Batch 크기가 50000을 초과하면 50000으로 제한
|
||||
batchSize = Math.min(batchSize, 50000);
|
||||
|
||||
int instCnt = 0;
|
||||
|
||||
int j = 0;
|
||||
for (int i = 0; i < totalSize; i += batchSize) {
|
||||
// Batch 리스트 생성
|
||||
List<MjonMsgSendVO> batchList = mjonMsgSendVOList.subList(
|
||||
i, Math.min(i + batchSize, totalSize)
|
||||
);
|
||||
System.out.println("i : "+ i);
|
||||
// DAO 호출
|
||||
int insertedCount = mjonMsgDataDAO.insertMsgDataInfo_advc(batchList);
|
||||
instCnt += insertedCount;
|
||||
j++;
|
||||
}
|
||||
|
||||
|
||||
// 종료 시간 측정
|
||||
@ -4200,10 +4206,9 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
// 실행 시간 계산 (밀리초 -> 초로 변환)
|
||||
double executionTimeInSeconds = (endTime - startTime) / 1000.0;
|
||||
// 실행 시간 출력
|
||||
System.out.println("j :: " + j);
|
||||
System.out.println("batchSize :: " + batchSize);
|
||||
System.out.println("Execution time :: " + executionTimeInSeconds + "초 " + "// insert Cnt :: "+instCnt);
|
||||
// mjonMsgSendVOList.stream().forEach(t-> System.out.print(t.toString()+"\n") );
|
||||
// mjonMsgSendVOList.stream().forEach(t-> System.out.print(t.toString()+"\n") );
|
||||
|
||||
|
||||
// 강제로 IllegalArgumentException 발생시키기
|
||||
|
||||
Loading…
Reference in New Issue
Block a user