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 May 2012
JProfiler
|
Get rid of your performance problems and memory leaks!
|
JProfiler
|
Get rid of your performance problems and memory leaks!
|
|
|
Back to newsletter 138 contents
http://www.fasterj.com/articles/gcnotifs.shtml
Garbage Collection JMX Notifications (Page last updated May 2012, Added 2012-05-29, Author Jack Shirazi, Publisher fasterj.com). Tips:
- From Java 7 update 4 (jdk1.7.0_04) notifications are available from the GarbageCollectorMXBean after each garbage collection.
- JMX GC monitoring can be done on a polling basis requesting the details of the last GC but this is prone to missing individual GCs; using notifications ensures all GC data is obtained.
- Most GC tuners obtain their GC data for GC analysis via a GC log, using -verbose:gc (to stdout) or -Xloggc:FILEPATH (to file FILEPATH), and the logged output has more detail than that held in the GarbageCollectionNotificationInfo received from GarbageCollectorMXBean.
http://www.infoq.com/articles/eaperfpuzzles
Book on Solving Enterprise Applications Performance Puzzles by Leonid Grinshpan (Page last updated February 2012, Added 2012-05-29, Author Michael Stal, Publisher infoq). Tips:
- Applications must generate data on their consumption of system resources, workload, transaction processing time, internal caches hit ratios, etc.
- Undersizing hardware is a top performance issue - you must size the system early on in the project, when the budget is available and flexible.
- Software that cannot take advantage of multi-CPU, multi-core, and hyper threading technologies is limited in scalability and cannot scale using the cheapest resource - additional hardware.
- You need to make your software and the algorithms it uses parallel.
- Monitoring tools often are confused in virtual environments and report misleading performance metrics - you need to do extensive user-oriented performance testing before transferring to a virtual environment.
- To be a complete performance professional, you need to be involved in application deployment, support and maintenance so that you are exposed to the full set of performance issues across it's lifecycle - many performance problems are exposed after deployment.
http://java.dzone.com/articles/3-basic-tenants-monitoring
The 3 Basic Tenets of Monitoring (Page last updated March 2012, Added 2012-05-29, Author Geoffrey Papilion, Publisher DZone). Tips:
- Monitor request latency from the point of view of the request originator - if the latency is high enough your service is effectively down.
- A simple regular timed request against your database tells you when it is in trouble. ideally set an alert for too high a service time.
- Monitoring your monitoring framework and services, they can themselves consume too much resource and cause a performance issue.
- Your alerts should go off before your services are broken, with sufficient warning to let you do something to avoid the break.
http://highlyscalable.wordpress.com/2012/01/01/ultimate-sets-and-maps-for-java-p2/
Ultimate Sets and Maps for Java, Part II (Page last updated January 2012, Added 2012-05-29, Author Ilya Katsov, Publisher highly scalable blog). Tips:
- The Bloom filter generates a signature for a set of items such that you can determine quickly whether a different set of items are not a subset of the full set by using bitwise AND. This allows for potentially very rapid query resolution for some types of queries.
- A Bloom filter containsAll operation could be order(s) of magnitude faster than a HashSet containsAll call, but this is very dependent on the actual datasets and problems being addressed.
- A Reflector allows efficient queries of a set of elements where the query is a combination of ANDs and ORs, i.e. equivalent to multiple ORed containsAll calls.
- Open address hash tables can be very efficient at avoiding object allocation overheads.
- The elimination of duplicate elements in a set can be achieved more efficiently than the standard way of adding to a hash structure, e.g. sorting and avoiding duplicates is an alternative that can be more efficient in some cases.
- Data structures optimised for a particular problem can be much faster for solving that problem than using generic datastructures.
http://blog.incubaid.com/2012/03/28/the-game-of-distributed-systems-programming-which-level-are-you/
The Game of Distributed Systems Programming. Which Level Are You? (Page last updated March 2012, Added 2012-05-29, Author rslootma, Publisher incubaid). Tips:
- Local calls are very different in characteristic from remote calls, and to program assuming they are equivalent is a recipe for inevitably incorrect results.
- There are many many different ways a remote call can fail. In particular, it can partially succeed, i.e. get processed on the remote side but fail to return to the local side, so the local has no way of knowing if it succeeded or failed. This is a defining property of remote calls, and your system has to build in strategies to handle this or it will fail in unexpected ways.
- Idempotent actions can workaround the failures of knowing whether a particular remote call worked or not.
- Distributed algorithms and asynchronous messaging helps workaround network failure limitations, but concurrency complexity limits the robustness of these systems.
- Distributed algorithms with message passing using the Actor model works well to help make a robust distributed system, but it has overheads and lack of scheduling control.
- Mixing state and concurrency is a recipe for disaster, since it introduces nondeterminism.
- Distributed applications need to consider partial failure of remote calls, security, upgrade paths, maintenance, administration, and job control of code that has already been distributed.
http://codingjunkie.net/java-7-watchservice/
What's New in Java 7: WatchService (Page last updated February 2012, Added 2012-05-29, Author Bill Bejeck, Publisher codingjunkie). Tips:
- Java 7 WatchService allows you to find all file creation, deletion and modification events that occur in a directory.
- Use a WatckKey to look for file event changes in a directory (note, doesn't monitor subdirectories)
WatchService watchService = FileSystems.getDefault().newWatchService(); WatchKey watchKey = Paths.get("/home").register(watchService,ENTRY_CREATE,ENTRY_DELETE,ENTRY_MODIFY);
. Repeatedly call WatchService.poll() or WatchService.take() to get the events.
- The StandardWatchEventKinds.OVERFLOW event indicates that file events may been lost or discarded.
- Using the Java 7 WatchService to detect changes to files is more efficient than polling the directories themselves, but is not fully asynchronous as it requires polling or blocking on the WatchService itself.
Jack Shirazi
Back to newsletter 138 contents
Last Updated: 2024-09-29
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/newtips138.shtml
RSS Feed: http://www.JavaPerformanceTuning.com/newsletters.rss
Trouble with this page? Please contact us