How many threads can a Java VM support?

前端 未结 12 1144
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 06:32

How many threads can a Java VM support? Does this vary by vendor? by operating system? other factors?

12条回答
  •  花落未央
    2020-11-22 07:04

    I know this question is pretty old but just want to share my findings.

    My laptop is able to handle program which spawns 25,000 threads and all those threads write some data in MySql database at regular interval of 2 seconds.

    I ran this program with 10,000 threads for 30 minutes continuously then also my system was stable and I was able to do other normal operations like browsing, opening, closing other programs, etc.

    With 25,000 threads system slows down but it remains responsive.

    With 50,000 threads system stopped responding instantly and I had to restart my system manually.

    My system details are as follows :

    Processor : Intel core 2 duo 2.13 GHz
    RAM : 4GB
    OS : Windows 7 Home Premium
    JDK Version : 1.6
    

    Before running I set jvm argument -Xmx2048m.

    Hope it helps.

提交回复
热议问题