Java Performance Tuning

Java(TM) - see bottom of page

|home |services |training |newsletter |tuning tips |tool reports |articles |resources |about us |site map |contact us |
Tools: | GC log analysers| Multi-tenancy tools| Books| SizeOf| Thread analysers| Heap dump analysers|

Our valued sponsors who help make this site possible
JProfiler: Get rid of your performance problems and memory leaks! 

Training online: Concurrency, Threading, GC, Advanced Java and more ... 

Newsletter no. 5, April 20th, 2001

JProfiler
Get rid of your performance problems and memory leaks!

Modern Garbage Collection Tuning
Shows tuning flow chart for GC tuning


Java Performance Training Courses
COURSES AVAILABLE NOW. We can provide training courses to handle all your Java performance needs

Java Performance Tuning, 2nd ed
The classic and most comprehensive book on tuning Java

Java Performance Tuning Newsletter
Your source of Java performance news. Subscribe now!
Enter email:


Training online
Threading Essentials course


JProfiler
Get rid of your performance problems and memory leaks!


This month we have the usual eclectic mix of Java performance related articles. Many of these are increasingly aimed at server-side performance aspects, as are the performance monitoring tools. And we also have the odd micro-Java performance articles just beginning to show up.

Kirk continues his indispensible roundup of Java performance discussion groups, and I've started adding Java performance book reviews to the books section (mainly because John Zukowski's comparative review of the available books gave mine the best marks).

Please note that further requests for the training course cannot currently be accepted due to lack of resources (i.e. my time).

Finally, a reminder to our Japanese readers that Yukio Andoh's translation will be available at http://www.hatena.org/JavaPerformanceTuning/ in a week or so.

Recent Articles

All the following page references have their tips extracted below.

Older Pages

All the following page references have their tips extracted below.

Other additions to the website

Discussion groups

Tools

Jack Shirazi


Kirk's roundup

This month?s installment of my roundup includes comments from performance lists found on www.javaranch.com and www.theserverside.com. As a special added bonus, I have included a brief review of a two part JMS benchmarking article appearing in the March and April editions of the Java Developers Journal.

The folks down on the ranch were up to their usual business of providing great answers to every day performance issues. The first question was about the differences in performance when using a for or while loop. The bartender quickly pulled his Java de-compiler of the shelf and showed us that the byte code for the method

public void foo() {
  Vector v = new Vector();
  Iterator iter = v.iterator();
  for(;iter.hasNext(); ){}
  while (iter.hasNext()) {}
}

decompiles to

0 new #4 < Class java.util.Vector >
3 dup
4 invokespecial #7 < Method java.util.Vector() >
7 astore_1
8 aload_1
9 invokevirtual #9 < Method java.util.Iterator iterator() >
12 astore_2
13 goto 16
16 aload_2
17 invokeinterface (args 1) #8 < InterfaceMethod boolean hasNext() >
22 ifne 16
25 goto 28
28 aload_2
29 invokeinterface (args 1) #8 < InterfaceMethod boolean hasNext() >
34 ifne 28
37 return

So, the byte code is the same. More importantly, we see that decompiling is a useful way for determining what effect your coding style has on a particular compiler. In this instance, the answer is none.

A greenhorn came in and stated that his animation program was running much faster on his PII350 with 64 MB of RAM running NT than on his PIII 500 with 128 MB of RAM running Win ME. Though there wasn't an explanation for this phenomenon (though a guess was hazarded about NT having superior multi-threading), it does point out that although Java is WORA (write once run anywhere), it is still wise to test your application on the platforms you intend to deploy to.

Another respondent was asking questions about how to best represent data to accommodate a searching algorithm that needed to perform calculations. This was to be a "flagship" algorithm that was to be at the heart of performance. Having had previous experience working with "flagship" algorithms, I found the advice given validated the position I have taken in the past. The advice given:

The Middleware Company (www.theserverside.com) is writing a book on the J2EE. What is interesting is that they are following procedure from Sun Microsystems and JCP. The Middleware company is releasing the book a chapter at a time so that everyone can review it and make comments. The feedback will be rolled back into the book. So, in a sense, the community is writing the book. This will certainly be a fun exercise to watch.

And now, from their performance-tuning list, we had a participant asking a question regarding the execution speed of the JDK1.3 running on NT. This produced one useful reminder that HotSpot Server VM for Windows NT is a separate download for the JDK1.3, so don't forget that when trying out JVMs.

There was a question on the performance factors of using the J2EE. Though responses to this question were light, they were effective. It is certain that system architecture is an important component to how an application will perform. Sun Microsystems has done much to help development teams architect scalable distributed applications. The J2EE blueprint is a start. This has been followed by documents that describe best practices and design patterns. You can find the documents on their web site at http://java.sun.com/j2ee/blueprints.

On the question of JDBC performance, it was pointed out that executing a statement with a large number of ORs may be broken down by the query optimizer resulting in a response time that might be longer than if the query was broken down into several calls. So, what looked like a Java performance-tuning issue quickly turned into a RDB performance tuning issue. As is the case when tuning any system, you need to consider the impact that every component in a system may have on performance.

Again on the subject of J2EE/EJB, a developer is trying to determine the best way to bulkload data into a RDB. His initial choice was to use an Entity Bean. Several people responded with the advice to provide the bulk loading service via a Stateless Session Bean. The Stateless Session Bean would wrap the Entity Bean. One person replied that they had better performance using Container Managed Persistence (CMP). Though the responses started in the right direction, in my experience there is no need to use an Entity Bean when performing a bulk load. Doing all of the work within the Stateless Session Bean will offer the same functionality with much better performance.

As a final note, the March and April editions of the Java Developers Journal offers an excellent two-part article written by Dave Chappell and Bill Wood (of Sonic MQ) titled "Benchmarking JMS Based E-Business Messaging Providers". The article provides a very in depth description of how to analyze the performance of a JMS implementation. In doing so, it addresses just about every point that one needs to consider when carrying out any benchmarking activity. The article is well structured and is supported with well thought out scenarios and code. They also provide you with a strong sense of the effort required to complete a benchmarking exercise. I highly recommend anyone considering a benchmarking exercise read this article.

Kirk Pepperdine.


Tips

http://www.javareport.com/html/from_pages/article.asp?id=799&mon=4&yr=2001
Various strategies for connecting to databases (Page last updated March 2001, Added 2001-04-20, Author Prakash Malani). Tips:

http://www.javaworld.com/javaworld/jw-03-2001/jw-0323-performance.html
Designing remote interfaces (Page last updated March 2001, Added 2001-04-20, Author Brian Goetz). Tips:

http://www.microjava.com/articles/techtalk/object_lists?content_id=1152
Basic article on a minimal ArrayList implementation, from a micro-Java slant (Page last updated March 2001, Added 2001-04-20, Author Lee Miles). Tips:

http://developer.java.sun.com/developer/JDCTechTips/2001/tt0327.html
How to use java.rmi.MarshalledObject (Page last updated March 2001, Added 2001-04-20, Author Stuart Halloway). Tips:

http://developer.java.sun.com/developer/community/chat/JavaLive/2001/jl0327.html
Sun community chat session: Tuning the Java Runtime for "Big Iron" (Page last updated March 2001, Added 2001-04-20, Author Edward Ort). Tips:

http://www.sys-con.com/java/article.cfm?id=673
J2EE Application servers (Page last updated April 2001, Added 2001-04-20, Authors Christopher G. Chelliah and Sudhakar Ramakrishnan). Tips:

http://www.sys-con.com/java/article.cfm?id=671
J2EE Application server performance (Page last updated April 2001, Added 2001-04-20, Author Misha Davidson). Tips:

http://www.javaworld.com/javaworld/jw-04-2001/jw-0406-syslog.html
Using the Syslog class for logging (Page last updated April 2001, Added 2001-04-20, Author Nate Sammons). Tips:

http://developer.java.sun.com/developer/Books/performance/performance2/appendixa.pdf
Appendix A (Garbage Collection) of "Java Platform Performance: Strategies and Tactics." (Page last updated 2001, Added 2001-04-20, Authors Steve Wilson, Jeff Kesselman). Tips:

http://www.AmbySoft.com/javaCodingStandards.pdf
Coding standards with a small but interesting section (section 7.3) on optimizations (Page last updated January 2000, Added 2001-04-20, Author Scott Ambler). Tips:

http://developer.java.sun.com/developer/J2METechTips/2001/tt0416.html
Using Timers (java.util.Timer) (Page last updated April 2001, Added 2001-04-20, Author Eric Giguere). Tips:

http://www-106.ibm.com/developerworks/java/library/j-super.html
Parallel clustering of machines using Java (Page last updated April 2001, Added 2001-04-20, Author Aashish N. Patil). Tips:

http://developer.java.sun.com/developer/TechTips/2000/tt0829.html
The Javap disassembler (Page last updated August 2000, Added 2001-04-20, Author Stuart Halloway). Tips:

Jack Shirazi


Last Updated: 2025-03-25
Copyright © 2000-2025 Fasterj.com. All Rights Reserved.
All trademarks and registered trademarks appearing on JavaPerformanceTuning.com are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. JavaPerformanceTuning.com is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
URL: http://www.JavaPerformanceTuning.com/newsletter005.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us