Merge branch 'advc' of http://hylee@vcs.iten.co.kr:9999/hylee/mjon_git
into advc
This commit is contained in:
commit
07877fd70a
@ -4175,40 +4175,63 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
// 분할 최대건수가 되면 디비에 입력하기
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_advc(mjonMsgSendVOList);
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_jdbc_advc(mjonMsgSendVOList);
|
||||
|
||||
|
||||
|
||||
// 시작 시간 측정
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수
|
||||
int batchSize = (int) Math.ceil((double) totalSize / 3); // 기본 3등분 크기 계산
|
||||
long totalStartTime = System.currentTimeMillis();
|
||||
|
||||
// Batch 크기가 50000을 초과하면 50000으로 제한
|
||||
batchSize = Math.min(batchSize, 50000);
|
||||
int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수
|
||||
int batchSize = 30000; // Batch 크기 설정 (고정값)
|
||||
|
||||
int instCnt = 0;
|
||||
System.out.println("총 데이터 개수 :: " + totalSize);
|
||||
System.out.println("설정된 Batch 크기 :: " + batchSize);
|
||||
|
||||
int instCnt = 0;
|
||||
int batchCount = 0;
|
||||
|
||||
// 각 배치별 실행 시간 기록
|
||||
List<Double> batchExecutionTimes = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < totalSize; i += batchSize) {
|
||||
// Batch 시작 시간 측정
|
||||
long batchStartTime = System.currentTimeMillis();
|
||||
|
||||
// Batch 리스트 생성
|
||||
List<MjonMsgSendVO> batchList = mjonMsgSendVOList.subList(
|
||||
i, Math.min(i + batchSize, totalSize)
|
||||
);
|
||||
System.out.println("Batch 시작 인덱스: " + i);
|
||||
|
||||
// DAO 호출
|
||||
int insertedCount = mjonMsgDataDAO.insertMsgDataInfo_advc(batchList);
|
||||
instCnt += insertedCount;
|
||||
|
||||
// Batch 종료 시간 측정 및 실행 시간 계산
|
||||
long batchEndTime = System.currentTimeMillis();
|
||||
double batchExecutionTimeInSeconds = (batchEndTime - batchStartTime) / 1000.0;
|
||||
|
||||
// 실행 시간 기록
|
||||
batchExecutionTimes.add(batchExecutionTimeInSeconds);
|
||||
batchCount++;
|
||||
}
|
||||
|
||||
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++;
|
||||
}
|
||||
|
||||
|
||||
// 종료 시간 측정
|
||||
long endTime = System.currentTimeMillis();
|
||||
// 실행 시간 계산 (밀리초 -> 초로 변환)
|
||||
double executionTimeInSeconds = (endTime - startTime) / 1000.0;
|
||||
long totalEndTime = System.currentTimeMillis();
|
||||
|
||||
// 총 실행 시간 계산 (밀리초 -> 초로 변환)
|
||||
double totalExecutionTimeInSeconds = (totalEndTime - totalStartTime) / 1000.0;
|
||||
|
||||
// 실행 시간 출력
|
||||
System.out.println("j :: " + j);
|
||||
System.out.println("총 배치 실행 횟수 :: " + batchCount);
|
||||
System.out.println("batchSize :: " + batchSize);
|
||||
System.out.println("Execution time :: " + executionTimeInSeconds + "초 " + "// insert Cnt :: "+instCnt);
|
||||
System.out.println("총 실행 시간 :: " + totalExecutionTimeInSeconds + "초");
|
||||
System.out.println("총 삽입 건수 :: " + instCnt);
|
||||
|
||||
// 각 배치별 실행 시간 출력
|
||||
for (int k = 0; k < batchExecutionTimes.size(); k++) {
|
||||
System.out.println("배치 " + (k + 1) + " 실행 시간 :: " + batchExecutionTimes.get(k) + "초");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 강제로 IllegalArgumentException 발생시키기
|
||||
|
||||
Loading…
Reference in New Issue
Block a user