The sample real-time hash map

The sample application uses a series of examples to demonstrate the features of WebSphere® Real Time for AIX® on 64-bit POWER® that can be used to improve the real-time characteristics of Java™ programs.

The standard java.util.HashMap that IBM® provides works well for high throughput applications. It also helps with applications that know the maximum size their hash map needs to grow to. For applications that need a hash map that could grow to variable sizes, depending on usage, there is a potential performance problem with the standard hash map. The standard hash map provides good response times for adding new entries into the hash map using the put method. However, when the hash map fills up, a larger backing store must be allocated. This means that the entries in the current backing store must be migrated. If the hash map is large, the time to perform a put could also be large. For example, the operation could take several milliseconds.

WebSphere Real Time for AIX on 64-bit POWER includes a sample real-time hash map. It provides the same functional interface as the standard java.util.HashMap, but enables much more consistent performance for the put method. Instead of creating a backing store and migrating all the entries when the hash map fills up, the sample hash map creates an additional backing store. The new backing store is chained to the other backing stores in the hash map. The chaining initially causes a slight performance reduction while the empty backing store is allocated and chained to the other backing stores. Once the backing hash map is updated, it is faster than having to migrate all the entries. A disadvantage of the real-time hash map is that the get, put and remove operations are slightly slower. The operations are slower because each look-up must to proceed through a set of backing hash maps instead of just one.

To try out the real-time hash map, add the RTHashMap.jar file to the start of your boot class path. If you installed WebSphere Real Time for AIX on 64-bit POWER into the directory $WRT_ROOT, then add the following option to use the real-time hash map with your application, instead of the standard hash map:
-Xbootclasspath/p:$WRT_ROOT/demo/realtime/RTHashMap.jar
The source and class files for the real-time hash map implementation are included in the demo/realtime/RTHashMap.jar file. In addition, a real time java.util.LinkedHashMap and java.util.HashSet implementation are also provided.


© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)