Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Thread number and Java application performance

Hi: I have a multi thread Java application. The current thread size is already 100. We are currently using 4 core CPU. But as one see in the near future, CPU core would be doubled, or even to 32 cores. In order to fully utilize cores, we need to increase our thread pool size. But as you may know (Maybe I am wrong), Java is good when there is 100 hundred threads, but there could be performance problem when thread is 200, 500, 1000 threads. Then shall we use other programming language, for example scala. Is my worry reasonable?

like image 738
user84592 Avatar asked Jul 18 '11 11:07

user84592


1 Answers

With modern JVMs, a Java process can create as many threads as the operating system will permit. Whether or not your application will be able to make good use of those threads depends on the design of your application.

If scalability is a concern, I would recommend that in the first instance you focus on your application's architecture (data structures, synchronization, etc). These issues need to be considered irrespective of the programming language, and there's nothing about Java that makes it inherently unsuitable for heavily multithreaded apps.

like image 179
NPE Avatar answered Oct 13 '22 01:10

NPE