Are objects being created for each record? Is some work done locally before hitting the DB?
Hardly any objects are being created. Most of it is math calculations inside the functions.
This is what happens:
If method execute is called and all the threads in the ExecutorService are being used, the Runnable will be placed in a queue and assigned to the first thread that completes its previous task.
How is the code even dealing with 80000 records if there are only 30 threads?
I dont know. Maybe thats why it takes so long.
But when i did the
test with 10,000 records also my performance was bad:
Time elapsed = 1019.74 sec, CDR=10000, no of threads= 30 maxActive= 35
Even with 4000 records it wasnt a remarkable performance:
Time elapsed = 179.25sec, CDR=4000, no of threads= 30
And i did understand the point that you were trying to make about threads. I just wanted to check what would be optimal.
Increasing the thread size would only worsen the performance, what else could be the bottle neck?