Java Performance Tuning
Java(TM) - see bottom of page
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 ...
Tips July 2004
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 044 contents
http://www.JavaPerformanceTuning.com/articles/apm1a.shtml
Application Performance Management (Page last updated July 2004, Added 2004-07-26, Author Jack Shirazi, Publisher JavaPerformanceTuning.cm). Tips:
- Application Performance Management (APM) is about measuring the performance of an application at any stage of the application lifecycle and in any part of the application, identifying performance related problems that the application may have, resolving those problems, and controlling the application and measurement tools so that the available resources are configured to reach target service levels.
- JVM profiling breaks int four areas: method profiling to find inefficient methods; object allocation/deallocation profiling to find which objects are allocated too often, or are uninentionally retained causing object leaks; thread contention profiling to determine where in the application race conditions, deadlocks, and wait conditions can exist; and heap profiling to determine the JVM heap usage of the application.
- [Article lists many of the APM tools available both for J2SE and J2EE].
- If you are doing Java development, or have a Java system in production, you need to identify if you have a performance issue
- You should have a set of performance targets against which to judge your system.
- [Article covers the basics of Java Application Performance Management ].
http://kirk.blog-city.com/read/675658.htm
Code Smell, X = null (Page last updated June 2004, Added 2004-07-26, Author Kirk Pepperdine, Publisher Blog-City). Tips:
- It is much cheaper to GC an object that is in young space, i.e. shorter lived objects are cheaper to GC.
- Scoping variables correctly, i.e. as narrowly as possible, are the optimal way to null variables and keep object lifetime to a minimum.
- In certain special cases it may be reasonable to explicitly null a variable ('x = null'), but more typically this indicates that the program flow is wrong.
http://www.javahispano.org/text.viewer.action?file=jack_en
Interview with Jack Shirazi (Page last updated June 2004, Added 2004-07-26, Author Martin Perez, Publisher JavaHispano). Tips:
- [Entrevista en espa?ol, interview also in spanish].
- At the design stage, focus on performance planning, and looking for shared resources.
- In the implementation phase, you need a good performance testing environment and tools that produce good performance measurements.
- In production, you need low overhead collection of performance profiles.
- Make sure that you have performance targets
- Make sure that you have a realistic performance test environment to identify performance problems
- An inefficient design is expensive to correct, often requiring extensive changes, so you need to focus on getting the design efficient before implementation.
- Focus the implementation on being correct, not fast. Then performance test the application realistically to eliminate bottlenecks.
- Use interfaces rather than concrete implementations. Declare your variables as interface types, for example as a List, not as a ArrayList.
- Beware of using String. Do you really need a String object, or are using it because it is convenient? String is a concrete class, and you cannot re-implement it. Changes to using Strings are often not localized and can be a big tuning problem.
- Try to keep the code modular. Could you replace an implementation of a class with another implementation without having to extensively change other classes?
- Resource locking is the major theoretical limitation to most J2EE applications, limiting the system from scaling. You have to identify and minimize exclusive access to shared resources.
- Garbage collection may not impact the system for any one transaction, but scaling up the load can make the garbage collection become the system bottleneck. You need to profile a loaded application and reduce object thrashing, and then tune the heap and garbage collection.
- Tune the SQL, not just the connection pool. Analyze JDBC usage and eliminate the inefficiencies.
- Use an abstraction layer like a Data Access Object pattern, or equivalent product, so that you can localize JDBC tuning.
- Make sure that you produce a realistic performance test of how the database is used.
- Capture the JDBC communications using database-side performance tools or Java side tools like a J2EE monitor or JDBC monitor [See our resources for a list of such tools].
- You need to tune the SQL, minimize how much data is returned from the database and make sure you are using indexes appropriately.
http://www.javaspecialists.co.za/archive/Issue090.html
Autoboxing performance (Page last updated June 2004, Added 2004-07-26, Author Heinz Kabutz , Publisher javaspecialists). Tips:
- The new 1.5+ for construct 'for (type varname : object) ...' has no performance penalty.
- The new 1.5+ autoboxing feature is likely to lead to bad performance, as under the covers it needs to wrap and unwrap primitives with objects, and that is a large overhead if used extensively (like in loops).
http://www.informit.com/articles/article.asp?p=174533
Aspect-Oriented Programming in Java (Page last updated June 2004, Added 2004-07-26, Author Tim Stevens , Publisher informIT). Tips:
- [Article describes using AOP with JBoss].
- AOP provides an easy way to monitor code without changing code, recompiling, or relying on any debugging or profiling tools.
http://www.devx.com/Java/Article/21453
Intro to SWT (Page last updated July 2004, Added 2004-07-26, Author Raghu Donepudi, Publisher devX). Tips:
- UIs built on SWT are very similar to that of native applications and resources are used more efficiently
- Compared to AWT, SWT memory management is safer; program logic is clearer; performance is better.
http://java.sun.com/developer/community/chat/JavaLive/2004/jl0520.html
1.5 Monitoring and Management (part 1) (Page last updated May 2004, Added 2004-07-26, Author Edward Ort , Publisher Sun). Tips:
- This release includes built-in instrumentation to observe the internals of the Java virtual machine1 (JVM), a JMX framework, and remote access JMX/SNMP protocols. There is also a new simple management tool called jconsole.
- Management parts provided in J2SE 1.5 include performing garbage collection (GC), setting logger level, turning on/off verbose gc or verbose class.
- The JVM is instrumented to export counter information such as live threads and loaded classes. You can get the uptime, configuration info such as system properties, JVM input arguments, memory usage, perform on-demand deadlock detection, various statistics such as thread contention statistics, GC statistics.
- The monitoring interface can connect to systems that support both JMX and SNMP.
http://java.sun.com/developer/community/chat/JavaLive/2004/jl0520.html
1.5 Monitoring and Management (part 2) (Page last updated June 2004, Added 2004-07-26, Author Edward Ort , Publisher Sun). Tips:
- The monitoring and management MBean overhead is low; Things that have a performance impact (like amount of time spent blocked on a monitor) are optional; remote monitoring of the JVM also adds a little extra overhead.
- MBean server overhead depends on how frequently the monitoring requests come in and the amount of information that is being accessed.
- The API allows you to set a threshold for monitoring the memory usage or after GC usage. The VM will send you notification when the usage exceeds the threshold.
Back to newsletter 044 contents
Last Updated: 2024-12-27
Copyright © 2000-2024 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/news/newtips044.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us