Merge branch 'advc' of http://hylee@vcs.iten.co.kr:9999/hylee/mjon_git into advc
into advc
@07877fd70aa74a545abcc2df66a45c8a6ce0c2de
--- src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
+++ src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
... | ... | @@ -4175,40 +4175,63 @@ |
| 4175 | 4175 |
// 분할 최대건수가 되면 디비에 입력하기 |
| 4176 | 4176 |
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_advc(mjonMsgSendVOList); |
| 4177 | 4177 |
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_jdbc_advc(mjonMsgSendVOList); |
| 4178 |
- |
|
| 4178 |
+ |
|
| 4179 |
+ |
|
| 4179 | 4180 |
// 시작 시간 측정 |
| 4180 |
- long startTime = System.currentTimeMillis(); |
|
| 4181 |
- |
|
| 4182 |
- int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수 |
|
| 4183 |
- int batchSize = (int) Math.ceil((double) totalSize / 3); // 기본 3등분 크기 계산 |
|
| 4181 |
+ long totalStartTime = System.currentTimeMillis(); |
|
| 4184 | 4182 |
|
| 4185 |
- // Batch 크기가 50000을 초과하면 50000으로 제한 |
|
| 4186 |
- batchSize = Math.min(batchSize, 50000); |
|
| 4183 |
+ int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수 |
|
| 4184 |
+ int batchSize = 30000; // Batch 크기 설정 (고정값) |
|
| 4187 | 4185 |
|
| 4188 |
- int instCnt = 0; |
|
| 4186 |
+ System.out.println("총 데이터 개수 :: " + totalSize);
|
|
| 4187 |
+ System.out.println("설정된 Batch 크기 :: " + batchSize);
|
|
| 4189 | 4188 |
|
| 4190 |
- int j = 0; |
|
| 4191 |
- for (int i = 0; i < totalSize; i += batchSize) {
|
|
| 4192 |
- // Batch 리스트 생성 |
|
| 4193 |
- List<MjonMsgSendVO> batchList = mjonMsgSendVOList.subList( |
|
| 4194 |
- i, Math.min(i + batchSize, totalSize) |
|
| 4195 |
- ); |
|
| 4196 |
- System.out.println("i : "+ i);
|
|
| 4197 |
- // DAO 호출 |
|
| 4198 |
- int insertedCount = mjonMsgDataDAO.insertMsgDataInfo_advc(batchList); |
|
| 4199 |
- instCnt += insertedCount; |
|
| 4200 |
- j++; |
|
| 4201 |
- } |
|
| 4202 |
- |
|
| 4203 |
- |
|
| 4189 |
+ int instCnt = 0; |
|
| 4190 |
+ int batchCount = 0; |
|
| 4191 |
+ |
|
| 4192 |
+ // 각 배치별 실행 시간 기록 |
|
| 4193 |
+ List<Double> batchExecutionTimes = new ArrayList<>(); |
|
| 4194 |
+ |
|
| 4195 |
+ for (int i = 0; i < totalSize; i += batchSize) {
|
|
| 4196 |
+ // Batch 시작 시간 측정 |
|
| 4197 |
+ long batchStartTime = System.currentTimeMillis(); |
|
| 4198 |
+ |
|
| 4199 |
+ // Batch 리스트 생성 |
|
| 4200 |
+ List<MjonMsgSendVO> batchList = mjonMsgSendVOList.subList( |
|
| 4201 |
+ i, Math.min(i + batchSize, totalSize) |
|
| 4202 |
+ ); |
|
| 4203 |
+ System.out.println("Batch 시작 인덱스: " + i);
|
|
| 4204 |
+ |
|
| 4205 |
+ // DAO 호출 |
|
| 4206 |
+ int insertedCount = mjonMsgDataDAO.insertMsgDataInfo_advc(batchList); |
|
| 4207 |
+ instCnt += insertedCount; |
|
| 4208 |
+ |
|
| 4209 |
+ // Batch 종료 시간 측정 및 실행 시간 계산 |
|
| 4210 |
+ long batchEndTime = System.currentTimeMillis(); |
|
| 4211 |
+ double batchExecutionTimeInSeconds = (batchEndTime - batchStartTime) / 1000.0; |
|
| 4212 |
+ |
|
| 4213 |
+ // 실행 시간 기록 |
|
| 4214 |
+ batchExecutionTimes.add(batchExecutionTimeInSeconds); |
|
| 4215 |
+ batchCount++; |
|
| 4216 |
+ } |
|
| 4217 |
+ |
|
| 4204 | 4218 |
// 종료 시간 측정 |
| 4205 |
- long endTime = System.currentTimeMillis(); |
|
| 4206 |
- // 실행 시간 계산 (밀리초 -> 초로 변환) |
|
| 4207 |
- double executionTimeInSeconds = (endTime - startTime) / 1000.0; |
|
| 4219 |
+ long totalEndTime = System.currentTimeMillis(); |
|
| 4220 |
+ |
|
| 4221 |
+ // 총 실행 시간 계산 (밀리초 -> 초로 변환) |
|
| 4222 |
+ double totalExecutionTimeInSeconds = (totalEndTime - totalStartTime) / 1000.0; |
|
| 4223 |
+ |
|
| 4208 | 4224 |
// 실행 시간 출력 |
| 4209 |
- System.out.println("j :: " + j);
|
|
| 4225 |
+ System.out.println("총 배치 실행 횟수 :: " + batchCount);
|
|
| 4210 | 4226 |
System.out.println("batchSize :: " + batchSize);
|
| 4211 |
- System.out.println("Execution time :: " + executionTimeInSeconds + "초 " + "// insert Cnt :: "+instCnt);
|
|
| 4227 |
+ System.out.println("총 실행 시간 :: " + totalExecutionTimeInSeconds + "초");
|
|
| 4228 |
+ System.out.println("총 삽입 건수 :: " + instCnt);
|
|
| 4229 |
+ |
|
| 4230 |
+ // 각 배치별 실행 시간 출력 |
|
| 4231 |
+ for (int k = 0; k < batchExecutionTimes.size(); k++) {
|
|
| 4232 |
+ System.out.println("배치 " + (k + 1) + " 실행 시간 :: " + batchExecutionTimes.get(k) + "초");
|
|
| 4233 |
+ } |
|
| 4234 |
+ |
|
| 4212 | 4235 |
|
| 4213 | 4236 |
|
| 4214 | 4237 |
// 강제로 IllegalArgumentException 발생시키기 |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?