multithreading - How to make a Java Application faster? -
i have billing daemon must process hundred thousands of data in fast manner. implemented executorserivce
parallel processing. did increase speed not much. takes approx 2.5-3 hours process 1,00,000 records. how can make more faster processing data within half hour?
i have written following execution setting:
-xms2048m -xmx2048m -xx:maxpermsize=256m
i tried implement producer consumer model 1 producer , 4 consumers. each list can contain 10,000 records.
arrayblockingqueue<billablelist> list =new arrayblockingqueue<billablelist>(10); executorservice threadpool = executors.newfixedthreadpool(5); threadpool.execute(new consumer("pool1", list)); threadpool.execute(new consumer("pool2", list)); threadpool.execute(new consumer("pool3", list)); threadpool.execute(new consumer("pool4", list)); future producerstatus = threadpool.submit(new producer("producer", list)); producerstatus.get(); threadpool.shutdown();
i lot of "database lock wait timeout exceeded" exceptions while updating records database. due different consumers trying same user @ same time? how can make different consumers take different data arrayblockingqueue
's list?
the possible answer "use profiler , find out why it's slow". can't problem when don't know problem is. going to, pick random function , micro-optimize it? profiler data or nothing ever, ever happen.
Comments
Post a Comment