Java SE 6 Performance white Paper

Source: Internet
Author: User
Tags new features thread java se

1 Introduction

One of the main design principles of the Java SE 6 (Java Platform Standard Edition 6) is to target performance flaws, with some of the most popular Java benchmark tests and close collaboration with the Java community to determine the most critical areas of performance impact. To improve performance and scalability.

This guide outlines the new features and scalability improvements in Java Standard Edition 6, along with industry standards and in-house development benchmarking results to demonstrate the impact of these performance improvements.

2 new features and performance enhancements

Java SE 6 introduces a number of new features and performance enhancements that provide performance improvements for many areas of the platform. These improvements include: Synchronization performance optimization, compiler performance optimization, new parallel scaling and garbage collectors (Parallel compaction Collector), higher-efficiency concurrent low pause garbage collectors (Concurrent Lower Pause Collector), and the startup performance of the application.

2.1 Run-time Performance Improvements

2.1.1 Bias Lock

The bias lock (biased locking) is an optimized class that improves the performance of no competitive synchronization by eliminating atomic operations associated with the Java language synchronization primitives. These optimizations depend on properties that are not only the majority of the non competitive monitors, but are locked up by one thread during their lifetimes.

The object is "biased" to the first thread to get the monitor through a monitor input bytecode or a synchronous method call, and subsequent actions related to the monitor can be performed without atomic manipulation for better performance, particularly on multiprocessor machines.

Locking attempts on "biased" objects by multithreading, rather than single-threaded, will result in relatively large operational overhead, with the bias being undone. The benefits of eliminating atomic operations must outweigh the locking undo penalty to make the optimization profitable.

Using a large number of competing synchronizations will achieve significant speed increases, while other applications that use certain locking modes may run slowly.

The bias lock is enabled by default in Java SE 6 and in future versions. To disable biased locks, add-xx:-usebiasedlocking to the command line.

To learn more about bias locks, see the ACM OOPSLA 2006 article, written by Kenneth Russell and David detlefs, "eliminate synchronization-related atomic operations with biased locks and bulk (Bulk rebiasing)."

2.1.2 Lock coarsening

Java SE 6 has some locking modes. In these modes the lock is freed and then obtained in a piece of code, and there is no observable operation between them. In that case, the lock coarsening optimization technique implemented in the hotspot eliminates the lock and unlock operation (when a lock is released, there is no meaningful thing to do between unlocking and the next lock, and then the lock can be obtained again). By expanding the existing synchronization area, the total amount of synchronization work has been reduced basically. Performing this operation around a loop may result in a lock being held for a long time, so the lock coarsening technique is only used on a loop-only control flow.

This feature is used by default. To disable this feature, add the following options to the command line:-xx:-eliminatelocks

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.