|By Vitaly Mikheev||
|December 11, 2009 06:00 PM EST||
Java Development on Ulitzer
Steve Jobs once said that Java is a big heavyweight ball and chain. Good news: the ball is now optional! In this article, I share results we achieved after implementing a component deployment model, also known as JRE modularity, for the core of J2SE 5.0 and Java SE 6. The technology’s been in production use for more than two years and proved effective.
This is not a mere “Java gets smaller” message. Given that Project Jigsaw is emerging in JDK 7, I also offer some insights on the challenges that any implementation of modularity for the Java SE core may face, all derived from our practical experience.
“Divide and Conquer” Has Worked Out
We did not pioneer the idea that the monolithic Java SE platform needs to be split into components, it was in the air. We merely found a way of how to do that without breaking Java compatibility and implemented it in a compliant Java SE VM, Excelsior JET, back in 2007.
The goal was to let Java programmers bundle a light version of the Java Runtime with their applications leaving the unused components out so as to reduce the size of the installation package. Easier said than done, but we’ve got it made in a Java spec-compliant manner and called the technology Java Runtime Slim-Down (after Project Jigsaw appeared, it’s finally got to me that we should have to call it “Project Rock breaker” or the like).
It has been proved effective for many Java applications. For GUI applications, in particular, the size of a complete installation package with bundled Java Runtime starts from 5MB. In support of this assertion, I refer you to SWTPaint, a sample program taken from the latest Eclipse SDK.
The use of Java Runtime Slim-Down yields results you won’t get with any other Java deployment tool:
- The size of the SWTPaint installer is 5.5MB (here is a direct download link).
- The installed application need not the JRE to run and does not download any components from the Internet (so it won’t disturb your firewall).
Note that the GUI application in question is written in Java and uses Java SE 6. Oh, sorry! I had to mention that download size for Swing applications start from 8MB. Stirring the flame of Swing vs. SWT was by no means my intention. We prepared installation packages for a few sample applications, both Swing- and SWT-based, and you may download them from this page. If you are still in doubt, try the deployment technique yourself. This flash demo will help you get started.
There are good reasons for end users to love “all-inclusive” installation packages at reduced footprint rates, and it’s where a lightweight Java Runtime is of much help. At a larger scale, however, the lack of the JRE modularity impeded the evolution and adoption of the Java SE platform.
In Between a Rock and a Hard Place
A bit of history. Remember JSR-83, a proposal on the “multiarray” package originated by IBM. Its implementation could have had a great impact on the number crunching performance in Java. Nevertheless, it was approved only as a Java Standard Extension, never appeared among the core packages and eventually was withdrawn. In the final ballot, Sun made a noticeable comment: “...The proposal requires at least 82 new classes, and this seems inappropriate for the J2SE core...”. Though I personally was disappointed with the outcome, the need to damp the Java core inflation down sounded reasonable
Other JSRs were more lucky and the Java Community Process kept Java SE moving forward over the years. In 2006, I attended the Java Licensee Day event. During the Q&A part of the session devoted to then new Java SE 6, one of the licensees sharply asked: “With each release the JRE gets bigger and bigger. Our customers do not need all those new APIs. When will it stop bloating?” I then found myself thinking I agreed with him but I would rather say “Not all our customers need all those new APIs...”.
The question is how many “useful” APIs have not been approved just not to make the JRE bigger? One may ask also how many “useless” APIs have been approved and did make the JRE bigger? It’s clear that requirements of different projects vary and there is no single answer to these questions, but splitting the JRE into components could resolve these issues gracefully.
Here’s a practical example from our support records. We have customers who previously got stuck with J2SE 1.4.2 simply because the footprint of later Java versions was unacceptable for their deployment requirements. Now, after switching to the component model, they are happy users of Java SE 6.
However, I would not like to discuss the Sun’s policy on modularizing Java SE here. There were many pros and cons to consider, both technical an legal, and I fully realized some of them only when working on the Java Runtime Slim-Down technology. No shooting (in the foot)
As often happens, once we had started the design, the scope of work suddenly increased. For the truth to be told, we would not reach the goal by simply splitting the Java SE API into components and enabling the user to drop some of them. The big question was how to make the technology usable and reliable? After all, we did not want to create a thing that does not work just because the programmer removed some components too aggressively. We decided to explore the limits of this approach by interviewing those enthusiasts who pursued us for this matter. The results confirmed our suspicion – programmers are not always aware of what parts of the Java SE API are actually used in their applications. A good illustration would be the following transcript written then:
Client: I do not use that “Baggage-To-Trim” API and no longer want to carry it with my app. As you are a JVM vendor, make me happy, please.
Support Engineer: We understand you concern. Are you sure you don’t use the “Baggage-To-Trim” API?
Support Engineer:. We kindly ask you to double check it. Please run your app with java –verbose:class and inspect the log.
Client: Oops.. You surprised me! It’s proved to be used. Frankly speaking, I did not write that code where it’s used. Let me think of it.
Needless to say that we also had to think of it. In addition, Java SE components may depend on each other implicitly, via the implementing classes, and most programmers not familiar with the internals could not play safe when removing the components.
We conducted some R&D and figured out that such a technology should come with tools that help the user not shoot himself in the foot and rules which, just in case, provide the fastest recovery.
Tools and Rules
The final solution included a dependency analyzer and “safety net”. The analyzer takes the application’s classes, infers what Java SE components are likely in use and advises to the user.
Under the covers, it’s not simply checking import dependencies as that would work poorly in terms of precision. For instance, such a simplistic analysis would not have revealed that the SWT-AWT bridge, which is part of the SWT package, is not used by the SWTPaint application mentioned above. As a result, the AWT component would be sucked in and the installation size would increase. That said, analyzer design and testing had engaged us for some time.
Does it guarantee that any deployed application will never miss the removed components? I would not bet money on it. After all, a programmer could detach some components by mistake or an application may load a plug-in that uses the Java SE API more extensively than the application itself. Here the following rule comes into play. All removed components are put into a detached package and the developer has to place it on a Web server at the URL s/he assigned when creating the installation. The Web server is considered a "safety net": should the deployed application attempt to use any of the removed components, the Java Runtime will pull the package down from the server and load the requested Java classes.
On the formal side of things, we run the Java Compatibility Kit (JCK) deployed in this mode with some and all Java SE components detached. Noteworthy is that all the tests pass.
However, it is unlikely that a download of a detached package will occur in practice, provided the developer listened to the word of wisdom from the analyzer. For example, these sample applications have been downloaded over a thousand of times since we published them in May 2007, but there was not a single download of a detached package so far.
The last note is about the splitting. We have managed to carve a kernel part of Java SE, about 4MB, that have to be bundled with any application. We could not get it smaller. We wanted to break down the whole thing into more components, each of a smaller size, but were unable to do that. In general, we could obtain better download size figures if the Java SE API implementation classes would not be so tightly coupled, full of cross-references, strongly connected, melted and fused together.
The Truth About Sun Java Kernel
Initially, Sun Java Kernel was supposed include a deployment technology for reducing the download size. But what appeared in Java 6 Update 10 under the name Java Kernel is still far from the solution. The Java Kernel contains the VM and some core classes like java.lang.*, java.io.* and meets the needs of HelloWorld of sorts only. Upon application launch, the Java Kernel inevitably starts downloading the remaining packages from a Sun web site and no means are provided to package the required bundles with the application. In essence, the end users "download a downloader" and all you can do with it is specify which missing bundles must be downloaded first. This short table highlights the key differences between Java Runtime Slim-Down and Java Kernel:
You may find more details in the Java Kernel FAQ. Probably, the Java Kernel is just a preliminary step toward a solution that may appear in the future.
The first mention of the JRE modularity being found in the Annals relates to the times of JDK 1.2(!) The discussions lasted for years, the first implementation in the Sun JRE was planned for Java 1.5, then moved to Java 6. The Java Kernel appeared in Java 6 Update 10 proved to be far from the solution.
In parallel with the Java Kernel, Java Module System (JSR-277) was in the works, which, in particular, could address the JRE modularity problem but the deadlock between Sun and an OSGi lobby had it buried.
Finally, in the end of 2008, Project Jigsaw was announced and “Episode IV. The New Hope” commenced.
Four Challenges for Jigsaw
I’m not with the Java SE core group at Sun but I’ve been working with the Java SE core for more than ten years. Below I share my opinion on the main challenges to the adoption of Jigsaw in the future.
The corporate battle around OSGi needs a break. None has won and the Java Community has lost because, time after time, JRE modularity solutions appear to disappear. To use or not to use OSGi now is less of an issue as compared with the next challenge.
In modular approach, each component should be sufficiently isolated and import relations should be declared statically. Besides that, import graph should be (close to) acyclic to minimize the number of indirectly used components.
The problem is that the reference implementation of the Java SE API was coded without having modularity in mind. Somewhat it was a side-effect of the Java’s lazy classloading which created an illusion that a use of any class in Java code costs nothing until it’s actually executed at run time. It’s proved to be a technical debt and now is the time to pay the interest.
In practice, it means that spaghetti-like dependencies between the implementing classes are omnipresent and breaking the ties without breaking backward compatibility with previous Java versions is double tough. The danger is to create something like Apache Harmony: everything is implemented with an elegant internal architecture, samples work, but existing Java apps have issues.
Profiles All Over Again?
Some outlines of Jigsaw mention so called Java SE Profiles, e.g. Profile for headless apps, for basic RIA, for rich desktop apps, etc. A potential threat here is the repetition of the same old story of the monolithic JRE unless user-defined profiles will be allowed. One size does not fit all even if the presets are defined carefully.
Need for Total Modularization
There is a risk to getting no benefits from the JRE modularity alone. Most real-world applications use third-party components (Java APIs), which are yet to be modularized. Typically, applications tend to use only a part of the functionality provided by an API. Without total modularization, chances are good that unnecessary parts of (modularized) JRE will be taken in due to use of a (monolithic) third-party component. And it’s no matter whether the import declarations will be written in OSGi bundle manifests or somewhere else.
In closing, I’d like to say that we implemented Java Runtime Slim-Down due to high demand from our clients. I strongly believe, however, that modularized JRE has to come with Java SE out-of-the-box, not just as a vendor solution. I wrote this article with a little hope that our past experience would be of some help for the future development of the Java platform.
P.S. One man said that Java is a big heavyweight ball and chain. Good news: the ball is now optional! You may detach it and use module Chain only.
SYS-CON Events announced today that Commvault, a global leader in enterprise data protection and information management, has been named “Bronze Sponsor” of SYS-CON's 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Commvault is a leading provider of data protection and information management solutions, helping companies worldwide activate their data to drive more value and business insight and to transform moder...
Sep. 25, 2016 09:30 PM EDT Reads: 2,461
The Transparent Cloud-computing Consortium (abbreviation: T-Cloud Consortium) will conduct research activities into changes in the computing model as a result of collaboration between "device" and "cloud" and the creation of new value and markets through organic data processing High speed and high quality networks, and dramatic improvements in computer processing capabilities, have greatly changed the nature of applications and made the storing and processing of data on the network commonplace.
Sep. 25, 2016 09:00 PM EDT Reads: 906
SYS-CON Events announced today that Bsquare has been named “Silver Sponsor” of SYS-CON's @ThingsExpo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. For more than two decades, Bsquare has helped its customers extract business value from a broad array of physical assets by making them intelligent, connecting them, and using the data they generate to optimize business processes.
Sep. 25, 2016 07:30 PM EDT Reads: 2,582
I'm a lonely sensor. I spend all day telling the world how I'm feeling, but none of the other sensors seem to care. I want to be connected. I want to build relationships with other sensors to be more useful for my human. I want my human to understand that when my friends next door are too hot for a while, I'll soon be flaming. And when all my friends go outside without me, I may be left behind. Don't just log my data; use the relationship graph. In his session at @ThingsExpo, Ryan Boyd, Engi...
Sep. 25, 2016 07:15 PM EDT Reads: 1,235
SYS-CON Events announced today that Pulzze Systems will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Pulzze Systems, Inc. provides infrastructure products for the Internet of Things to enable any connected device and system to carry out matched operations without programming. For more information, visit http://www.pulzzesystems.com.
Sep. 25, 2016 06:30 PM EDT Reads: 1,808
Fact is, enterprises have significant legacy voice infrastructure that’s costly to replace with pure IP solutions. How can we bring this analog infrastructure into our shiny new cloud applications? There are proven methods to bind both legacy voice applications and traditional PSTN audio into cloud-based applications and services at a carrier scale. Some of the most successful implementations leverage WebRTC, WebSockets, SIP and other open source technologies. In his session at @ThingsExpo, Da...
Sep. 25, 2016 05:30 PM EDT Reads: 1,550
Almost two-thirds of companies either have or soon will have IoT as the backbone of their business in 2016. However, IoT is far more complex than most firms expected. How can you not get trapped in the pitfalls? In his session at @ThingsExpo, Tony Shan, a renowned visionary and thought leader, will introduce a holistic method of IoTification, which is the process of IoTifying the existing technology and business models to adopt and leverage IoT. He will drill down to the components in this fra...
Sep. 25, 2016 03:00 PM EDT Reads: 1,582
The vision of a connected smart home is becoming reality with the application of integrated wireless technologies in devices and appliances. The use of standardized and TCP/IP networked wireless technologies in line-powered and battery operated sensors and controls has led to the adoption of radios in the 2.4GHz band, including Wi-Fi, BT/BLE and 802.15.4 applied ZigBee and Thread. This is driving the need for robust wireless coexistence for multiple radios to ensure throughput performance and th...
Sep. 25, 2016 02:30 PM EDT Reads: 1,524
Enterprise IT has been in the era of Hybrid Cloud for some time now. But it seems most conversations about Hybrid are focused on integrating AWS, Microsoft Azure, or Google ECM into existing on-premises systems. Where is all the Private Cloud? What do technology providers need to do to make their offerings more compelling? How should enterprise IT executives and buyers define their focus, needs, and roadmap, and communicate that clearly to the providers?
Sep. 25, 2016 02:00 PM EDT Reads: 1,521
SYS-CON Events announced today that SoftLayer, an IBM Company, has been named “Gold Sponsor” of SYS-CON's 18th Cloud Expo, which will take place on June 7-9, 2016, at the Javits Center in New York, New York. SoftLayer, an IBM Company, provides cloud infrastructure as a service from a growing number of data centers and network points of presence around the world. SoftLayer’s customers range from Web startups to global enterprises.
Sep. 25, 2016 01:00 PM EDT Reads: 837
There is little doubt that Big Data solutions will have an increasing role in the Enterprise IT mainstream over time. Big Data at Cloud Expo - to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA - has announced its Call for Papers is open. Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is...
Sep. 25, 2016 12:45 PM EDT Reads: 2,468
Digital innovation is the next big wave of business transformation based on digital technologies of which IoT and Big Data are key components, For example: Business boundary innovation is a challenge to excavate third-party business value using IoT and BigData, like Nest Business structure innovation may propose re-building business structure from scratch, as Uber does in the taxicab industry The social model innovation is also a big challenge to the new social architecture with the design fr...
Sep. 25, 2016 12:15 PM EDT Reads: 1,124
DevOps at Cloud Expo, taking place Nov 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 19th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time to wait for long dev...
Sep. 25, 2016 12:15 PM EDT Reads: 3,385
Data is an unusual currency; it is not restricted by the same transactional limitations as money or people. In fact, the more that you leverage your data across multiple business use cases, the more valuable it becomes to the organization. And the same can be said about the organization’s analytics. In his session at 19th Cloud Expo, Bill Schmarzo, CTO for the Big Data Practice at EMC, will introduce a methodology for capturing, enriching and sharing data (and analytics) across the organizati...
Sep. 25, 2016 11:45 AM EDT Reads: 1,652
IoT is fundamentally transforming the auto industry, turning the vehicle into a hub for connected services, including safety, infotainment and usage-based insurance. Auto manufacturers – and businesses across all verticals – have built an entire ecosystem around the Connected Car, creating new customer touch points and revenue streams. In his session at @ThingsExpo, Macario Namie, Head of IoT Strategy at Cisco Jasper, will share real-world examples of how IoT transforms the car from a static p...
Sep. 25, 2016 11:30 AM EDT Reads: 1,520
The many IoT deployments around the world are busy integrating smart devices and sensors into their enterprise IT infrastructures. Yet all of this technology – and there are an amazing number of choices – is of no use without the software to gather, communicate, and analyze the new data flows. Without software, there is no IT. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, panelists will look at the protocols that communicate data and the emerging data analy...
Sep. 25, 2016 11:00 AM EDT Reads: 1,579
SYS-CON Events announced today that China Unicom will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. China United Network Communications Group Co. Ltd ("China Unicom") was officially established in 2009 on the basis of the merger of former China Netcom and former China Unicom. China Unicom mainly operates a full range of telecommunications services including mobile broadband (GSM, WCDMA, LTE F...
Sep. 25, 2016 10:30 AM EDT Reads: 1,704
Video experiences should be unique and exciting! But that doesn’t mean you need to patch all the pieces yourself. Users demand rich and engaging experiences and new ways to connect with you. But creating robust video applications at scale can be complicated, time-consuming and expensive. In his session at @ThingsExpo, Zohar Babin, Vice President of Platform, Ecosystem and Community at Kaltura, will discuss how VPaaS enables you to move fast, creating scalable video experiences that reach your...
Sep. 25, 2016 10:00 AM EDT Reads: 946
Big Data has been changing the world. IoT fuels the further transformation recently. How are Big Data and IoT related? In his session at @BigDataExpo, Tony Shan, a renowned visionary and thought leader, will explore the interplay of Big Data and IoT. He will anatomize Big Data and IoT separately in terms of what, which, why, where, when, who, how and how much. He will then analyze the relationship between IoT and Big Data, specifically the drilldown of how the 4Vs of Big Data (Volume, Variety,...
Sep. 25, 2016 10:00 AM EDT Reads: 984
If you’re responsible for an application that depends on the data or functionality of various IoT endpoints – either sensors or devices – your brand reputation depends on the security, reliability, and compliance of its many integrated parts. If your application fails to deliver the expected business results, your customers and partners won't care if that failure stems from the code you developed or from a component that you integrated. What can you do to ensure that the endpoints work as expect...
Sep. 25, 2016 09:00 AM EDT Reads: 1,574