PDA

View Full Version : Using all the cores


kjkoster
25-07-2008, 12:30
Dear all,

Most if not all servers today have multiple processors and/or multiple processor cores. With the relatively easy support for multithreaded programming, Java comes well-equipped to make use of all that computing power.

However, the default Java virtual machine runs in the so-called client mode. In client mode, the JVM maps all of the Java threads onto a single native thread. This has the effect of making the JVM run on only one processor core at any given tiem.

In order to make the JVM use more than one native thread, you have to supply the -server (http://blogs.sun.com/watt/resource/jvm-options-list.html) command line option.

Running an application on more than one processor core only helps if your application is compute-bound (http://en.wikipedia.org/wiki/CPU_bound). If our application is IO-bound (http://en.wikipedia.org/wiki/IO_bound), you are not likely to see any improvement. I think that most distributed applications are IO-bound, especially SOA (http://en.wikipedia.org/wiki/Service-oriented_architecture) based applications. Does anyone have an figures on that?

Switching to the server JVM is quite a big deal, actually. On top of a completely different way of mapping Java threads onto native threads, you get a different HotSpot compiler, different garbage collectors and different memory pools. From what I heard, the server and the client VM are actually developed and maintained by different teams within Sun.

So ... own up. Who knew this and is running all his applications in server mode and who had to go in and check? :-)

Kees Jan

kjkoster
21-08-2008, 04:19
Dear All,

Just a quick follow-up: here (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=141052) is a discussion on the JBoss forum about this subject. Peter Johnson (again) posts a link to a JBoss tuning talk (http://www.linuxworld.com/events/2007/slideshows/A2-johnson.pdf) he gave. In that talk, on the last few slides, he talks about processor usage tuning.

I think that when the time comes to buy new hardware for java-monitor.com, for the same money I'm likely to buy faster cpu's with fewer cores than slower cpu's with lots of cores.

Kees Jan

Barry
23-08-2008, 11:57
Dear All,

Just a quick follow-up: here (http://www.jboss.com/index.html?module=bb&op=viewtopic&t=141052) is a discussion on the JBoss forum about this subject. Peter Johnson (again) posts a link to a JBoss tuning talk (http://www.linuxworld.com/events/2007/slideshows/A2-johnson.pdf) he gave. In that talk, on the last few slides, he talks about processor usage tuning.

I think that when the time comes to buy new hardware for java-monitor.com, for the same money I'm likely to buy faster cpu's with fewer cores than slower cpu's with lots of cores.

Kees Jan

Btw, this explains the Java Threading model in detail
http://openjdk.java.net/groups/hotspot/docs/RuntimeOverview.html

Also, please don't read too much into the JBoss stuff, just because JBoss doesn't scale well, doesn't mean you should not get a good multithreading system.
It depends on what you are doing really; "Simple" webserving can be done best with many threads and slow core speed.
Databases may see more problems as they will have to keep locks (and you will contend a lot more for resources)

For this forum I don't think you can go wrong with either choice as forums tend to be mostly read than write (less locking)
Move to a Java based forum though.

Oh and as for the screenshots of me utilizing 4 cores on a client VM, I use a mandelbrot explorer in client vm, but it only stresses all the cores for a few seconds ;)

kjkoster
24-08-2008, 21:34
Dear Barry,

Well, a few seconds should be enough to take a shot. Talk is cheap. While I'm dissing you for not providing proof, could you back up your claim that JBoss does not scale? I'm curious.

As for the Java-based forum: please point one that has as big a marketplace for skins (http://www.google.com/search?q=vbulletin+skins) and add-ons (http://www.google.com/search?q=vbulletin+add-ons) like vbulletin has. Oh, and it should be as easy to run as vbulletin. Unless you are volunteering? :-)

Kees Jan

Barry
25-08-2008, 08:47
Dear Barry,

Well, a few seconds should be enough to take a shot. Talk is cheap. While I'm dissing you for not providing proof, could you back up your claim that JBoss does not scale? I'm curious.


I'm merely referring to the discussion and the experiences that people posted in that thread. The linked PDF basically tells the reader to use a 2-4 CPU machine and scale out to several instances on one machine.
It would be interesting if this test (http://blogs.sun.com/theaquarium/entry/883_66_jops) was run using JBoss as a comparison


As for the Java-based forum: please point one that has as big a marketplace for skins (http://www.google.com/search?q=vbulletin+skins) and add-ons (http://www.google.com/search?q=vbulletin+add-ons) like vbulletin has. Oh, and it should be as easy to run as vbulletin. Unless you are volunteering? :-)

Kees Jan

Actually there are some in various forms of quality.
Personally I'm a great fan of the Liferay Portal, but their forum application seems a bit lacking. As for the themes and add-ons, what good are they if you are using the default settings anyways? ;-)
I'd definitely volunteer to help out on the technical side, I used to run a forum for a few years (But my strengths seemed to be more in the technical side and not the people side)
I think you ought to pull in a few dedicated people to help you out here