Source:
private static void perfTest(VerifiableProperties verifiableProperties) throws Exception { MySqlDataAccessor dataAccessor = new MySqlAccountStoreFactory(verifiableProperties, new MetricRegistry()).getMySqlAccountStore() .getMySqlDataAccessor(); AccountDao containerDao = new AccountDao(dataAccessor); short startAccountId = 30000; int numAccounts = 10; int numContainers = 1000; cleanup(dataAccessor.getDatabaseConnection(true), startAccountId); ContainerBuilder builder = new ContainerBuilder((short) 0, "", Container.ContainerStatus.ACTIVE, "Test", (short) 0); long t0 = System.currentTimeMillis(); int containersAdded = 0; List<AccountUtils.AccountUpdateInfo> accountUpdateInfos = new ArrayList<>(); for (short accountId = startAccountId; accountId < startAccountId + numAccounts; accountId++) { Account account = new AccountBuilder(accountId, "Account-" + accountId, Account.AccountStatus.ACTIVE).build(); List<Container> containers = new ArrayList<>(); for (short containerId = 1; containerId <= numContainers; containerId++) { containers.add(builder.setId(containerId) .setParentAccountId(accountId) .setName("Container-" + containerId) .setTtlRequired(true) .build()); containersAdded++; } accountUpdateInfos.add(new AccountUtils.AccountUpdateInfo(account, true, false, containers, new ArrayList<>())); } containerDao.updateAccounts(accountUpdateInfos, 100); long t1 = System.currentTimeMillis(); long insertTime = t1 - t0; logger.info("Added containers in ms", containersAdded, insertTime); List<Container> allContainers = containerDao.getNewContainers(t0); long t2 = System.currentTimeMillis(); logger.info("Queried containers in ms", allContainers.size(), t2 - t1); allContainers = containerDao.getNewContainers(t2); long t3 = System.currentTimeMillis(); logger.info("Queried containers in ms", allContainers.size(), t3 - t2); }

Target:
private static void perfTest(VerifiableProperties verifiableProperties) throws Exception { MySqlDataAccessor dataAccessor = new MySqlAccountStoreFactory(verifiableProperties, new MetricRegistry()).getMySqlAccountStore() .getMySqlDataAccessor(); AccountDao accountDao = new AccountDao(dataAccessor); short startAccountId = 30000; int numAccounts = 10; int numContainers = 1000; cleanup(dataAccessor.getDatabaseConnection(true), startAccountId); ContainerBuilder builder = new ContainerBuilder((short) 0, "", Container.ContainerStatus.ACTIVE, "Test", (short) 0); long t0 = System.currentTimeMillis(); int containersAdded = 0; List<AccountUpdateInfo> accountUpdateInfos = new ArrayList<>(); for (short accountId = startAccountId; accountId < startAccountId + numAccounts; accountId++) { Account account = new AccountBuilder(accountId, "Account-" + accountId, Account.AccountStatus.ACTIVE).build(); List<Container> containers = new ArrayList<>(); for (short containerId = 1; containerId <= numContainers; containerId++) { containers.add(builder.setId(containerId) .setParentAccountId(accountId) .setName("Container-" + containerId) .setTtlRequired(true) .build()); containersAdded++; } accountUpdateInfos.add(new AccountUpdateInfo(account, true, false, containers, new ArrayList<>())); } accountDao.updateAccounts(accountUpdateInfos, 100); long t1 = System.currentTimeMillis(); long insertTime = t1 - t0; logger.info("Added containers in ms", containersAdded, insertTime); List<Container> allContainers = accountDao.getNewContainers(t0); long t2 = System.currentTimeMillis(); logger.info("Queried containers in ms", allContainers.size(), t2 - t1); allContainers = accountDao.getNewContainers(t2); long t3 = System.currentTimeMillis(); logger.info("Queried containers in ms", allContainers.size(), t3 - t2); }