aspose file tools*
The moose likes Performance and the fly likes memory allocation performance problem on multy-CPU computer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "memory allocation performance problem on multy-CPU computer" Watch "memory allocation performance problem on multy-CPU computer" New topic

memory allocation performance problem on multy-CPU computer

Valeri Kireitchik

Joined: Feb 24, 2004
Posts: 3
I met the following problem: when application intensively creates and drops objects it run faster on 1 CPU than on 4. I encountered this when wrote benchmark that has to compare server performance for our application. Benchmark is quite simple: it runs 200 threads simultaneously. Each thread creates several thousand objects. After thread finishes it is replaced by new thread. Benchmark runs 5000 threads. The result is mean number of objects that was created during 1 ms
For server with 2 CPU Intel Xeon 2,4 the results was:
1 cpu - 410
2 cpu - 355
4 cpu - 272
It means that additional CPU reduces overal system performance.
I can send benchmark source code to anybody interested.

The depth of understanding is defined with personal experience -- Miamoto Musasi
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12769
Well, that is an interesting result. Which Java release was this and what GC settings are you using? Is this the -server or -client Hotspot JVM?
Corneil du Plessis

Joined: Feb 12, 2004
Posts: 13
The articles Tuning Hotspot 1.4.2 and GC Portal should provide guidance on tuning the garbage collector for Multi-processor systems. The concurrent garbage collector is an example of improvements to the VM to allow greater scalability.
Valeri Kireitchik

Joined: Feb 24, 2004
Posts: 3
Additional details: please see test report
P:\PSB>java -server -Xms700M -Xmx700M -jar PSB-A.jar
Computer performance report. Test PSB-A (c)ITC-M:
Test timestamp = Thu Feb 26 09:06:51 EET 2004
JVM = 1.4.2_02
Count of test threads = 2000
Count of simultaneously active test threads = 200
Count of levels in ObjectA tree: 7
Arity of ObjectA tree = 4
Size of array in ObjectA (in 4 byte words) = 64
Explicit activation of garbage collector = false
Explicit nulling of ref to ObjectA just before test thread finishes = true
Test has executed normally = true
Sleep time between thread updates = 5
Count of created object = 43690000
Count of started threads = 2000
Count of finished threads = 2000
Test duration (msec) = 97999
Mean number of objects handled (created, accessed, destroyed) during 1 msec (PSB-A) = 445
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

In share memory multiprocessor setup, memory allocation should require some level of CPU synchronization. All you seem to be doing is allocating memory, but not performing any calculations. I think your results are to be expected.
When the memory is not shared (single CPU), there is no contention.
I agree. Here's the link:
subject: memory allocation performance problem on multy-CPU computer