Merge branch 'advc' of http://subsub8729@vcs.iten.co.kr:9999/hylee/mjon_git into advc
This commit is contained in:
commit
782b2abc0a
@ -4166,8 +4166,6 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
|
||||
|
||||
|
||||
// 시작 시간 측정
|
||||
long startTime = System.currentTimeMillis();
|
||||
System.out.println("==================== insert 시작 ====================");
|
||||
|
||||
|
||||
@ -4178,32 +4176,61 @@ public class MjonMsgDataServiceImpl extends EgovAbstractServiceImpl implements M
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_advc(mjonMsgSendVOList);
|
||||
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_jdbc_advc(mjonMsgSendVOList);
|
||||
|
||||
//
|
||||
// 시작 시간 측정
|
||||
long totalStartTime = System.currentTimeMillis();
|
||||
|
||||
int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수
|
||||
int batchSize = 50000; // Batch 크기 설정 (고정값)
|
||||
|
||||
System.out.println("총 데이터 개수 :: " + totalSize);
|
||||
System.out.println("설정된 Batch 크기 :: " + batchSize);
|
||||
|
||||
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 크기만큼 리스트를 잘라냄
|
||||
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, mjonMsgSendVOList.size())
|
||||
i, Math.min(i + batchSize, totalSize)
|
||||
);
|
||||
|
||||
// DAO 메서드 호출
|
||||
System.out.println("Batch 시작 인덱스: " + i);
|
||||
|
||||
// DAO 호출
|
||||
int insertedCount = mjonMsgDataDAO.insertMsgDataInfo_advc(batchList);
|
||||
instCnt += insertedCount; // 총 삽입된 건수 누적
|
||||
instCnt += insertedCount;
|
||||
|
||||
// Batch 종료 시간 측정 및 실행 시간 계산
|
||||
long batchEndTime = System.currentTimeMillis();
|
||||
double batchExecutionTimeInSeconds = (batchEndTime - batchStartTime) / 1000.0;
|
||||
|
||||
// 실행 시간 기록
|
||||
batchExecutionTimes.add(batchExecutionTimeInSeconds);
|
||||
batchCount++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 종료 시간 측정
|
||||
long endTime = System.currentTimeMillis();
|
||||
// 실행 시간 계산 (밀리초 -> 초로 변환)
|
||||
double executionTimeInSeconds = (endTime - startTime) / 1000.0;
|
||||
long totalEndTime = System.currentTimeMillis();
|
||||
|
||||
// 총 실행 시간 계산 (밀리초 -> 초로 변환)
|
||||
double totalExecutionTimeInSeconds = (totalEndTime - totalStartTime) / 1000.0;
|
||||
|
||||
// 실행 시간 출력
|
||||
System.out.println("총 배치 실행 횟수 :: " + batchCount);
|
||||
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") );
|
||||
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