I developed a multi-threaded Java application that uses a thread to process a batch of work. I have a main thread that sends work on different topics. Everything works great.
Now I have changed the application so that it runs in several java processes, each of which still performs multi-threaded processing. For example, I use 8 threads to process 8 jobs in one java process, now I have 2 Java processes, each of which has 4 threads that still process 8 jobs.
The application is modeled as follows: the dispatcher will do the work that needs to be done, and then send it to the thread pool. There is no synchronization or communication between threads.
I noticed a pretty big performance boost in a later approach, and I wonder why. Can anyone shed some light on this? Is an OS process more efficient than Java threads? Should I use this as a general rule when I really need this performance? thanks.
source share