Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Java - A Slow Language?It Depends on What You're Talking About

Java - A Slow Language?It Depends on What You're Talking About

In the past six years or so the claim that Java is a slow language has regularly appeared in articles and news discussions. Most of the time I follow the debate, but after a while I get bored because the discussions remain at the micro-benchmark level. It continues to amaze me that there isn't more focus on system-level performance in discussions of language performance.

Having spent seven years actively interested in the field of runtime system optimization and the past four years designing a server-side JVM, JRockit, I am pretty convinced that micro-benchmark results cannot be extended to the system level, where performance really matters. Thus, I thought it would be interesting to give you a view of the performance issue from a JVM developer perspective. I'm arguing that Java is anything but a slow and inefficient language, and that the JVM is the key component ensuring that the system is as fast and easy to deploy and run as it was fast and easy to develop.

Performance Is Not a Micro-Benchmark
This is 2002 and people are still arguing that Java is a slow language. The most common argument comes from developers who have written small benchmarks in Java and then rewritten them in C and are touting how much faster the C programs are. I'm not writing this article to claim that they are wrong.

Of course they can write micro-benchmarks in a couple lines of Java code and redo the same benchmarks in C/C++ and the C programs will probably run faster than the Java programs. That's not where I disagree with them. I disagree with their conclusion; the results of a small micro-benchmark test cannot be extended to say anything about a large-scale application. I believe most systems will be built faster by fewer developers and they will even run faster if they are written in Java instead of C. Java is a language of scale; C is a language of micro-level performance. The development of Java is a natural result of the evolution of system development.

The System Development Evolution: From Punch Cards to Web Services
What has happened during the past 30 years or so is an explosion - the explosion of large-scale system development. There are so many developers in the world now, and they're building systems that are larger than what anyone imagined possible 30 years ago. In addition, application development today is no longer an I-build-every-part-of-the-application-myself process. People use standard libraries, frameworks, application servers, and most recently, Web services, to build their applications.

The components are getting bigger and bigger and more and more general. These building blocks, which were once looked upon with disbelief and mistrust, are now taken for granted. However, using these general building blocks has a price: performance. We have traded performance for significantly reduced development time and system complexity. At least that's what we think and what our early measurements indicate. What if we're wrong?

Enter Java and JVMs
The beauty of Java from a large-scale application performance perspective is in two features that are very crucial to performance for large-scale systems: type information and a runtime system (the JVM). The type information is needed by the code generator to discern who calls who, and who points to who. As a result more information can be extracted from a Java program than from a C program, if the compiler is smart. The end result is, of course, higher performance. The JVM is the vehicle for dynamic optimization. The JVM can analyze the behavior of the application and adapt itself and the generated code to the application.

The beauty of this runtime optimization approach is that for the first time ever, the whole system can be optimized specifically for how it is used without having the source code. This is the opportunity. The framework developer can build a general framework that gets used by application developers and that gets optimized specifically for each application that uses the framework. The general building blocks are broken down and melt into each other at runtime. It is the responsibility of the JVM to do this melting. The JVMs, including JRockit, have not reached that goal...yet.

When Dynamic Optimization Really Pays Off
Let me give you another example of the benefits of dynamic optimization. Look at Intel's new 64-bit platform, the Itanium Processor. Its characteristics are novel and enticing. Nevertheless, its EPIC architecture puts very high pressure on the compiler. EPIC means that the compiler has to choose which instructions should be executed in parallel. Most normal processors today do that selection automatically in their out-of-order execution engine. Because the EPIC-based CPUs need to make fewer decisions, they increase the computational efficiency. The caveat is that the compiler has to make intelligent decisions for the performance to increase.

Given all this pressure on the compiler, you might think that EPIC architecture is well-suited for static compilation and that it virtually eliminates the need for a dynamic runtime system. I believe we'll be able to show you in the coming years how totally opposite the reality is. The reason is that the devil is in the details: for the compiler to be able to parallelize code in a good way requires more than knowing the instructions of the program. The compiler has to know two more things: the flow of the program, and the values that are passed around and used in different contexts.

A static compiler doesn't have this runtime information; it cannot tell what parts of the program are executed frequently or what values are commonly passed to a function from a specific call site. A dynamic runtime system, e.g., a JVM, is the easiest kind of system to collect and take advantage of such information. Consequently, I expect to see exciting gains during the next two years for the Itanium-based JVMs. There is a possibility that they'll catch up with and supercede the profile-guided C compilers on EPIC platforms. Because it lacks type information and a runtime system, C is inferior to Java for EPIC architecture.

The JVM - The Glue for the Building Blocks
BEA acquired JRockit in February of this year, and we are now working to integrate JRockit into the BEA product line, making sure that it works well with all of the different BEA products. Bringing the building blocks and glue under the same roof makes your system more manageable and scalable and makes it run faster. The JRockit JVM is becoming an important piece of the BEA WebLogic Platform.

In conclusion, I still expect to see a lot of micro-benchmarks out there comparing Java and C programs, but I hope I've convinced you that using runtime systems like Sun Microsystems' HotSpot or BEA WebLogic JRockit Java is not slow or inefficient, and that the performance of a large-scale system built with Java may be superior to that of the same system built using C.

More Stories By Joakim Dahlstedt

Joakim Dahlstedt is the CTO of the Java Runtime Products Group at BEA Systems Inc, where he is responsible for the future development directions
for the JVM. He was the founder and one of the chief architects of JRockit, the JVM BEA acquired in early 2002. He has been working with Java and dynamic runtime optimizations since 1996.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

IoT & Smart Cities Stories
The challenges of aggregating data from consumer-oriented devices, such as wearable technologies and smart thermostats, are fairly well-understood. However, there are a new set of challenges for IoT devices that generate megabytes or gigabytes of data per second. Certainly, the infrastructure will have to change, as those volumes of data will likely overwhelm the available bandwidth for aggregating the data into a central repository. Ochandarena discusses a whole new way to think about your next...
DXWorldEXPO LLC announced today that Big Data Federation to Exhibit at the 22nd International CloudEXPO, colocated with DevOpsSUMMIT and DXWorldEXPO, November 12-13, 2018 in New York City. Big Data Federation, Inc. develops and applies artificial intelligence to predict financial and economic events that matter. The company uncovers patterns and precise drivers of performance and outcomes with the aid of machine-learning algorithms, big data, and fundamental analysis. Their products are deployed...
Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
All in Mobile is a place where we continually maximize their impact by fostering understanding, empathy, insights, creativity and joy. They believe that a truly useful and desirable mobile app doesn't need the brightest idea or the most advanced technology. A great product begins with understanding people. It's easy to think that customers will love your app, but can you justify it? They make sure your final app is something that users truly want and need. The only way to do this is by ...
CloudEXPO | DevOpsSUMMIT | DXWorldEXPO are the world's most influential, independent events where Cloud Computing was coined and where technology buyers and vendors meet to experience and discuss the big picture of Digital Transformation and all of the strategies, tactics, and tools they need to realize their goals. Sponsors of DXWorldEXPO | CloudEXPO benefit from unmatched branding, profile building and lead generation opportunities.
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
Cell networks have the advantage of long-range communications, reaching an estimated 90% of the world. But cell networks such as 2G, 3G and LTE consume lots of power and were designed for connecting people. They are not optimized for low- or battery-powered devices or for IoT applications with infrequently transmitted data. Cell IoT modules that support narrow-band IoT and 4G cell networks will enable cell connectivity, device management, and app enablement for low-power wide-area network IoT. B...
The hierarchical architecture that distributes "compute" within the network specially at the edge can enable new services by harnessing emerging technologies. But Edge-Compute comes at increased cost that needs to be managed and potentially augmented by creative architecture solutions as there will always a catching-up with the capacity demands. Processing power in smartphones has enhanced YoY and there is increasingly spare compute capacity that can be potentially pooled. Uber has successfully ...
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...