[TFY] Comparing Java JRE performance

Status
Not open for further replies.

riskin

Ars Praefectus
3,125
Subscriptor++
I've been jabbering about this for a while, but I still haven't gotten anywhere beyond "try it yourself and see how it turns out."

Some of you may know that there are different versions of Java Runtime Environments, both available from Sun and from IBM. Being the efficiency, optimization, and statistics nut that I am, I can't stop wondering about a free boost in D2OL performance simply by using a different JRE. I hope some of you are interested in that as well because I'll need some help to investigate it. Additionally I'll need some people with technical expertise to help answer some questions. I already bugged Larry Loen at work (sorry Larry, I didn't realize that email address was for work) as well as emailed Ken over at Sengent asking him about this as well.

I've read about some improvements in performance in Ubero by some Java tinkering and I can't help but think that we can't benefit from the same thing. I'm not sure where the performance boost comes from, so maybe the Java gurus out there can tell me. IIRC Ubero is interger-intensive while D2OL stresses floating point performance. It is possible that the Java performance boost occurrs only with interger ops, but there's only one way to find out.

Xyzzy created a page for Ubero folks to help them optimize their Java performance. I'm not sure if the process described on the page seems complicated because it includes instructions for the Ubero client or if all this JRE stuff is really that complicated.

You can find the IBM JRE on this Free-DC page for Ubero along with some instructions.

You can find the latest Sun Java stuff here. Also check out this page for some important info. And don't forget here.

There appears to be three different Sun Java tools we can work with. First there's the standard JRE which is version 1.3.1_02. It is the version I'm currently using on all of my machines. Then there's the Java SDK which is somewhat different than just the JRE, not just in what the package includes but specifically in terms of the capabilities of the Virtual Machine. I think I read somewhere either on Xyzzy's page or on the Free-DC Ubero forum that the 1.3.1 Java SDK (NOT the JRE) had a "server version" of the VM that allows for command line tweaks for specifying memory footprint. Most importantly, I think it has Sun's HotSpot technology to improve performance. I'm not exactly sure how it works, so maybe someone can help out here.

Those appear to be our choices for software. What we need now is to do some controlled testing. Obviously I would offer up my box, but it's just not consistent enough for a controlled experiment. Would anyone like to volunteer to run any or all of this software and report on the performance of the D2OL client?

I'm just opening this up, so of anyone wants to contribute here please feel free to do so. And if you can enlighten the non-programmers about any of this stuff it might be helpful too.

One more link.
 

Xyzzy

Ars Tribunus Angusticlavius
9,827
Moderator
Just use all of those links as a guideline... There are easier ways to install a different JRE but there are so many different systems and layouts that it is difficult to make a set of instructions that fits them all...

If TFY's client uses Java then you can expect a dramatic improvement in your speed by changing to a JRE that has "jitc"... Read through those links above for a description of what jitc is and how it works...

Don't forget the memory options too:

http://episteme.arstechnica.com/6/ubb.x?a=tpc&s=50009562&f=122097561&m=8740959153&r=4610970253#4610970253

And the thread that started it all:

http://episteme.arstechnica.com/6/ubb.x?q=Y&a=tpc&s=50009562&f=122097561&m=5250974043&p=3
 
JITs are nowadays pretty commonplace -- but not universal.

The documentation should usually say so one way or another.

The keys to Java performance are:

1. An excellent JIT.

2. Excellent garbage collection.

3. Setting the garbage collection parameters (-ms and -mx for Sun and IBM both, IIRC) correctly. The default values are likely to be unoptimal for this.

Generally speaking, the main benefit a higher "level" of Java will give (e.g. 1.3.1 over 1.3.0 or 1.4 over any 1.3) will be improvements in the JIT. Presumably Ubero doesn't require any function beyond level 1.1.8 or so (a lot of Java code is still written to this minimum, most of the rest is to the 1.2.2 or 1.3 level). But, again, you get the improvements in codegen and garbage collection that accrue over time. This is sort of like buying a new C/C++ compiler, except it happens a couple of times per year.

As far as garbage collection goes, -mx maximizes the heap size and -ms sets what is usually called an "initial" garbage collection value. That is true, but it also tends to drive other internal trade-offs.

When I'm really serious about this, I usually do a kind of binary search. I start at 32 MB and double it. If it improves, double again until it stops improving. When it stops, I take the halfway point between the 2nd to last and last improvement and work in binary style. I usually set -ms to half of -mx while doing this or (whim plays a part). Often, -ms and -mx are the same value at the optimal point.

You can also, if you wish, play some footprint games here. You can't make the thing smaller than it is, but you can sometimes get a profit by letting some deadwood sit around for a while. That enables you to run with "extra" memory for some amount of garbage collection reduction. Or, it enables you to fit it on a smaller machine, your choice.

Keep in mind that tuning the memory consumption, if done in full seriousness, is a highly empirical process.
 

riskin

Ars Praefectus
3,125
Subscriptor++
Xyzzy- yes, I am thoroughly confused.

Larry- You're talking about command line switches, and I have no idea how to implement them. Your "get serious" approach to measuring performance with the memory footprint sounds good. I'm not sure how to do it quickly, though, as it takes time to really measure performance on a DC client as opposed to a quick benchmark. Would the optimizations you're talking about be specific to one particular Java app (the DC client) or would this optimized performance carry over across all apps?

Hat- One of the links in my original posts is to a Free-DC "Ubero Tips" page. If you scroll down a bit you will see two links for the IBM JRE and some instructions. Check it out. Also, how did you set Sun's JVM as the default for IE?

I'm looking at my JRE control panel with tabs marked Basic, Advanced, Proxies, Cache, Certificates, and About. Under the "advanced" tab there is a checkbox for "Enable Just In Time Compiler" which I have checked. Xyzzy, you say that the Sun Java SDK ver 1.3 only has JITC with the "-server" option. Did you really mean "SDK" or did you mean to say "JRE?" I just have the regular old JRE, so help me understand the difference between this JITC option on my control panel and this -server switch you're talking about.

And if anyone can help me figure out how to configure Java with the control panel I would really appreciate it. :confused:
 

Xyzzy

Ars Tribunus Angusticlavius
9,827
Moderator
I cannot help you with the control panel... All I know are the command line options...

When I said "SDK" I meant just that... The 1.3 JRE (Sun) does not have jitc, only the 1.3 SDK has it and only if you invoke it with the -server option...

If you look at my Ubero tweak page, it shows how to verify that you have it working properly...

The IBM page does too... Look at the output...

If you read *all* of the stuff I have linked, and all of the stuff those pages link to, then you will understand...

I found that for Ubero there was a sweet spot between 128 and 256MB of memory... Allocate too much and it slows down...

You can monitor the page faults in the task manager to get a quick idea if a memory tweak is working... Just bump the memory up until the page fault delta drops near 0...
 

Aphex1

Seniorius Lurkius
15
How would I go about installing this so it will work with D2OL? I just installed it to my system but it appears that D2OL is not using what it installed and still using the exes under its own JRE directory. I tried like the hack I am to copy the new JRE directory in there and rename the old to back it up and when I run D2OL it comes up with an error that you must use Java 1.30_2 or higher.

Is there a more logical way to go about doing this that any of you know?

Aphex
 

riskin

Ars Praefectus
3,125
Subscriptor++
Hat- oh ok, I thought your post implied that you still hadn't found IBM's JRE. never mind.

Xyzzy- Sorry, I haven't had a chance to thoroughly read all of the links and information you've collected. Some if it is just too confusing for me to catch on a quick read. I'll have to dive into it more, but any help is appreciated.

How do you monitor page faults from Win2k's task manager?
 

badsac

Ars Tribunus Militum
2,421
In task manager, Under View/Select Columns, select the Page Fault option. Then it will come up in the Processes window.

All this Java stuff isn't as straight forward to newbies as one would like. I'm slogging through it though.

So Aphex is saying that even if we get Java all optimised and running faster than some sweet assembler code, we'll still be stuck with some internal implementation of Java from the client? :(
 

Aphex1

Seniorius Lurkius
15
wait wait what is this page faults read out mean here? These are not page faults as in the type of blue screen errors but page faults in another sense? I am looking at this readout now and explorer.exe is adding a page fault every second something tells me this is bad. I feel like such a newbie.

Badsac, I didnt try running D2OL from a command line with the java 1.40. I think that is what I have to do in order to take advantage of the enhancements provided by the JIT compiler. The nice D2OL link they provide us points to an exe which probably calls the JRE in their directory to run the client. If I can just figure out what to run I may be able to get D2OL to work with the newer Java since its in the path after the install.

Anyone can correct me if I am being completely stupid about these things. I am a bigtime java newbie. :p
 

Aphex1

Seniorius Lurkius
15
hmmm I think I found what I am looking for
program files\sengentD2OL\D2OL\Launch.xen
open it with a text file and check out these lines:
# Defines the path to the java executable to run if we are using a cosole.
# For Windows, this is java.exe, for other OSs, we need to determine this.
# Relative paths are relative to the path of the Xen native launcher

jvm.executable.console=..\jre\bin\java.exe


# Defines the path to the java executable to run if we are NOT using a cosole.
# For Windows, this is javaw.exe, for other OSs, we need to determine this.
# Relative paths are relative to the path of the Xen native launcher

jvm.executable.noconsole=..\jre\bin\javaw.exe


Also note:

# Defines other parameters to pass to the JVM

jvm.params=

Which we may be able to set the mem enviroment with.
 

Aphex1

Seniorius Lurkius
15
ok when I set the above settings to the launch.xen file to point to the new 1.4 exes path, it gives me this error upon running D2OL from the D2OL.exe shortcut method:
"You must install Java 1.3.1 or higher to run this application.
Please visit Http://java.sun.com or http://www.sengent.com for more information"
The very fact that sengent.com shows up there tells me its looking for something special in the old JRE directory. So I copy the new JRE into the old after making a backup of the old of course... same thing happens. Try replacing the old with the new JRE. Same thing. It appears a configuration file or classes or something is the matter here but I am not sure where else to look next. Any Java guru's have a clue?

I will keep hacking away at it and hopefully Ken and Sengent will not get mad at me.
 

Aphex1

Seniorius Lurkius
15
I finally found a winning combo. I can get the 1.3.1_02 server .dll to work with Sengent. It appears that the 1.4 version is not compatible because no matter what I did the jvm.cfg file set it off. I think the launcher D2OL.exe doesnt pass the right commandline information for 1.4 or something to that affect.

According to the previous posts here and what I found out at Sun, it seems that the Server based jvm.dll I am using has the JIT capability and it was boosting Ubero output about 39% if I remember correctly. The 1.4 boosted it around 50% :rolleyes: I wish that D2OL worked with it. For now I am going to test for a whole day my system which is usually a 55-50 performer and see if it will go above that and exactly how much. I know for sure its running the right server dll because I removed the others. I will explain what I am doing when I am sure its working.

Wish me luck.

Aphex
 
Status
Not open for further replies.