--- src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
+++ src/main/java/itn/let/mjo/msgdata/service/impl/MjonMsgDataServiceImpl.java
... | ... | @@ -4166,8 +4166,6 @@ |
| 4166 | 4166 |
|
| 4167 | 4167 |
|
| 4168 | 4168 |
|
| 4169 |
- // 시작 시간 측정 |
|
| 4170 |
- long startTime = System.currentTimeMillis(); |
|
| 4171 | 4169 |
System.out.println("==================== insert 시작 ====================");
|
| 4172 | 4170 |
|
| 4173 | 4171 |
|
... | ... | @@ -4178,21 +4176,29 @@ |
| 4178 | 4176 |
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_advc(mjonMsgSendVOList); |
| 4179 | 4177 |
// int instCnt = mjonMsgDataDAO.insertMsgDataInfo_jdbc_advc(mjonMsgSendVOList); |
| 4180 | 4178 |
|
| 4181 |
- // |
|
| 4182 |
- int instCnt = 0; |
|
| 4183 |
- int batchSize = (int) Math.ceil((double) mjonMsgSendVOList.size() / 3); // Batch 크기 계산 |
|
| 4184 |
- // Batch 처리 |
|
| 4185 |
- for (int i = 0; i < mjonMsgSendVOList.size(); i += batchSize) {
|
|
| 4186 |
- System.out.println(" i :: "+ i);
|
|
| 4187 |
- // Batch 크기만큼 리스트를 잘라냄 |
|
| 4188 |
- List<MjonMsgSendVO> batchList = mjonMsgSendVOList.subList( |
|
| 4189 |
- i, Math.min(i + batchSize, mjonMsgSendVOList.size()) |
|
| 4190 |
- ); |
|
| 4179 |
+ // 시작 시간 측정 |
|
| 4180 |
+ long startTime = System.currentTimeMillis(); |
|
| 4191 | 4181 |
|
| 4192 |
- // DAO 메서드 호출 |
|
| 4193 |
- int insertedCount = mjonMsgDataDAO.insertMsgDataInfo_advc(batchList); |
|
| 4194 |
- instCnt += insertedCount; // 총 삽입된 건수 누적 |
|
| 4195 |
- } |
|
| 4182 |
+ int totalSize = mjonMsgSendVOList.size(); // 총 데이터 개수 |
|
| 4183 |
+ int batchSize = (int) Math.ceil((double) totalSize / 3); // 기본 3등분 크기 계산 |
|
| 4184 |
+ |
|
| 4185 |
+ // Batch 크기가 50000을 초과하면 50000으로 제한 |
|
| 4186 |
+ batchSize = Math.min(batchSize, 50000); |
|
| 4187 |
+ |
|
| 4188 |
+ int instCnt = 0; |
|
| 4189 |
+ |
|
| 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 |
+ } |
|
| 4196 | 4202 |
|
| 4197 | 4203 |
|
| 4198 | 4204 |
// 종료 시간 측정 |
... | ... | @@ -4200,10 +4206,9 @@ |
| 4200 | 4206 |
// 실행 시간 계산 (밀리초 -> 초로 변환) |
| 4201 | 4207 |
double executionTimeInSeconds = (endTime - startTime) / 1000.0; |
| 4202 | 4208 |
// 실행 시간 출력 |
| 4209 |
+ System.out.println("j :: " + j);
|
|
| 4203 | 4210 |
System.out.println("batchSize :: " + batchSize);
|
| 4204 | 4211 |
System.out.println("Execution time :: " + executionTimeInSeconds + "초 " + "// insert Cnt :: "+instCnt);
|
| 4205 |
-// mjonMsgSendVOList.stream().forEach(t-> System.out.print(t.toString()+"\n") ); |
|
| 4206 |
-// mjonMsgSendVOList.stream().forEach(t-> System.out.print(t.toString()+"\n") ); |
|
| 4207 | 4212 |
|
| 4208 | 4213 |
|
| 4209 | 4214 |
// 강제로 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?