开发者

High CPU usage when running several "java -version" in parallel

开发者 https://www.devze.com 2023-01-03 21:36 出处:网络
This is just out of curiosity to understand i have a small shell script for ((i = 0; i < 50; i++)) do

This is just out of curiosity to understand

i have a small shell script

for ((i = 0; i < 50; i++))

do

java -version &

done

when i run this my CPU usage report by sar is as below

07:51:25 PM CPU %user %nice %system %iowait %steal %idle

07:51:30 PM all 6.98 0.00 1开发者_Go百科.75 1.00 0.00 90.27

07:51:31 PM all 43.00 0.00 12.00 0.00 0.00 45.00

07:51:32 PM all 86.28 0.00 13.72 0.00 0.00 0.00

07:51:33 PM all 5.25 0.00 1.75 0.50 0.00 92.50

As you can see, on the third line the CPU is at 100%

My java version is 1.5.0_22-b03.


It's pretty much what you would expect. 50 Java Virtual Machine instances loading at the same time, each one, performing all it's basic initialization code (reserving heap memory, loading core class libraries and initializing them, starting the garbage collector, etc). It's pretty good performance too considering, 2 seconds.

type this command in your shell :

java -verbose -version

The output is quite interesting....

0

精彩评论

暂无评论...
验证码 换一张
取 消