10만건 한번에 insert - 개발서버에서 테스트

This commit is contained in:
hylee 2024-07-30 11:02:45 +09:00
parent 0d2e8d14a5
commit 1b1af3034f

View File

@ -65,8 +65,8 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
// private static final int MAX_ADDR_CNT = 500000; // private static final int MAX_ADDR_CNT = 500000;
//임시 500만개 //임시 500만개
private static final int MAX_ADDR_CNT = 5000000; private static final int MAX_ADDR_CNT = 5000000;
private static final int BATCH_SIZE = 10000; // private static final int BATCH_SIZE = 10000;
private static final int THREAD_COUNT = 3; // private static final int THREAD_COUNT = 3;
public List<AddrVO> selectAddrList(AddrVO addrVO) throws Exception { public List<AddrVO> selectAddrList(AddrVO addrVO) throws Exception {
@ -479,7 +479,9 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
// 등록 // 등록
// Batch insert // Batch insert
// batchInsertAddrList(addrListVO); // batchInsertAddrList(addrListVO);
batchInsertAddrListAsync(addrListVO); // batchInsertAddrListAsync(addrListVO);
addrDAO.insertAddrList(addrListVO);
// addrDAO.insertAddrList(addrListVO); // addrDAO.insertAddrList(addrListVO);
@ -517,7 +519,7 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
} }
private void batchInsertAddrListAsync(List<AddrVO> addrListVO) throws InterruptedException { /*private void batchInsertAddrListAsync(List<AddrVO> addrListVO) throws InterruptedException {
int totalSize = addrListVO.size(); int totalSize = addrListVO.size();
int batchCount = (totalSize + BATCH_SIZE - 1) / BATCH_SIZE; int batchCount = (totalSize + BATCH_SIZE - 1) / BATCH_SIZE;
ExecutorService executor = Executors.newFixedThreadPool(THREAD_COUNT); ExecutorService executor = Executors.newFixedThreadPool(THREAD_COUNT);
@ -542,7 +544,7 @@ public class AddrServiceImpl extends EgovAbstractServiceImpl implements AddrSer
executor.shutdown(); executor.shutdown();
executor.awaitTermination(1, TimeUnit.HOURS); executor.awaitTermination(1, TimeUnit.HOURS);
} }*/
public static boolean isValidPhoneNumber(String phoneNo) { public static boolean isValidPhoneNumber(String phoneNo) {
if (phoneNo == null || phoneNo.isEmpty()) { if (phoneNo == null || phoneNo.isEmpty()) {