-1

I have certain requirement where I need to process large data with some mysql operation, there are multiple run of the similar kind. A single run takes around 2 hrs.

If I run each run in separate java thread there was no major time saving. As per my understanding java threads are not multi process ie its only a way to obtain parallelism not to improve CPU utilization.

If there is any way I can make use of multiple processor on the same machine through java, I guess that could save some time for all run operations.

Please let me know if the problem is clear here and have any idea on the solution.

Thanks, Ashish

Paul Podgorsek
  • 2,416
  • 3
  • 19
  • 22
Ashish
  • 402
  • 2
  • 6
  • 15
  • 1
    http://stackoverflow.com/questions/1223072/how-do-i-optimize-for-multi-core-and-multi-cpu-computers-in-java http://stackoverflow.com/questions/3330430/does-java-have-support-for-multicore-processors-parallel-processing – user2953680 Nov 22 '13 at 07:31
  • I'm fairly sure this is actually an SQL question. – Dariusz Jan 02 '14 at 13:35
  • 1
    How do you know your computation is not constrained by access to the database? – Ira Baxter Feb 22 '16 at 23:54

1 Answers1

0

I think that your problem is in your application or in mysql. Java does support multi-threading and your application should benefit automatically from multiple cores. Probably there is a common resource that needs to be synchronized.

From what you say, "process large data", i bet the common resource is the database file and memory.

If a single run takes a minute or more (in your case: 120 minutes), than you're better off with multiple processes anyway, as the overhead of the JVM startup is neglectible.

Henning
  • 806
  • 7
  • 7