|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.
WebRTC is about the data channel as much as about video and audio conferencing. However, basically all commercial WebRTC applications have been built with a focus on audio and video. The handling of “data” has been limited to text chat and file download – all other data sharing seems to end with screensharing. What is holding back a more intensive use of peer-to-peer data? In her session at @ThingsExpo, Dr Silvia Pfeiffer, WebRTC Applications Team Lead at National ICT Australia, will look at different existing uses of peer-to-peer data sharing and how it can become useful in a live session to...
Oct. 7, 2015 06:00 AM EDT Reads: 511
Developing software for the Internet of Things (IoT) comes with its own set of challenges. Security, privacy, and unified standards are a few key issues. In addition, each IoT product is comprised of at least three separate application components: the software embedded in the device, the backend big-data service, and the mobile application for the end user's controls. Each component is developed by a different team, using different technologies and practices, and deployed to a different stack/target - this makes the integration of these separate pipelines and the coordination of software upd...
Oct. 7, 2015 06:00 AM EDT Reads: 133
NHK, Japan Broadcasting will feature upcoming @ThingsExpo Silicon Valley in a special IoT documentary which will be filmed on the expo floor November 3 to 5, 2015 in Santa Clara. NHK is the sole public TV network in Japan equivalent to BBC in UK and the largest in Asia with many award winning science and technology programs. Japanese TV is producing a documentary about IoT and Smart technology covering @ThingsExpo Silicon Valley. The program will be aired during the highest viewership season of the year that it will have a high impact in the industry through this documentary in Japan. The film...
Oct. 7, 2015 05:45 AM EDT
SYS-CON Events announced today that Luxoft Holding, Inc., a leading provider of software development services and innovative IT solutions, has been named “Bronze Sponsor” of SYS-CON's @ThingsExpo, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. Luxoft’s software development services consist of core and mission-critical custom software development and support, product engineering and testing, and technology consulting.
Oct. 7, 2015 05:15 AM EDT Reads: 545
The broad selection of hardware, the rapid evolution of operating systems and the time-to-market for mobile apps has been so rapid that new challenges for developers and engineers arise every day. Security, testing, hosting, and other metrics have to be considered through the process. In his session at Big Data Expo, Walter Maguire, Chief Field Technologist, HP Big Data Group, at Hewlett-Packard, will discuss the challenges faced by developers and a composite Big Data applications builder, focusing on how to help solve the problems that developers are continuously battling.
Oct. 7, 2015 04:00 AM EDT Reads: 454
Nowadays, a large number of sensors and devices are connected to the network. Leading-edge IoT technologies integrate various types of sensor data to create a new value for several business decision scenarios. The transparent cloud is a model of a new IoT emergence service platform. Many service providers store and access various types of sensor data in order to create and find out new business values by integrating such data.
Oct. 7, 2015 03:30 AM EDT Reads: 459
SYS-CON Events announced today that IBM Cloud Data Services has been named “Bronze Sponsor” of SYS-CON's 17th Cloud Expo, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. IBM Cloud Data Services offers a portfolio of integrated, best-of-breed cloud data services for developers focused on mobile computing and analytics use cases.
Oct. 6, 2015 10:00 PM EDT Reads: 664
In his session at @ThingsExpo, Tony Shan, Chief Architect at CTS, will explore the synergy of Big Data and IoT. First he will take a closer look at the Internet of Things and Big Data individually, in terms of what, which, why, where, when, who, how and how much. Then he will explore the relationship between IoT and Big Data. Specifically, he will drill down to how the 4Vs aspects intersect with IoT: Volume, Variety, Velocity and Value. In turn, Tony will analyze how the key components of IoT influence Big Data: Device, Connectivity, Context, and Intelligence. He will dive deep to the matrix...
Oct. 6, 2015 08:00 PM EDT Reads: 318
When it comes to IoT in the enterprise, namely the commercial building and hospitality markets, a benefit not getting the attention it deserves is energy efficiency, and IoT’s direct impact on a cleaner, greener environment when installed in smart buildings. Until now clean technology was offered piecemeal and led with point solutions that require significant systems integration to orchestrate and deploy. There didn't exist a 'top down' approach that can manage and monitor the way a Smart Building actually breathes - immediately flagging overheating in a closet or over cooling in unoccupied ho...
Oct. 6, 2015 05:00 PM EDT Reads: 262
SYS-CON Events announced today that Cloud Raxak has been named “Media & Session Sponsor” of SYS-CON's 17th Cloud Expo, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. Raxak Protect automates security compliance across private and public clouds. Using the SaaS tool or managed service, developers can deploy cloud apps quickly, cost-effectively, and without error.
Oct. 6, 2015 04:40 PM EDT Reads: 118
Scott Guthrie's keynote presentation "Journey to the intelligent cloud" is a must view video. This is from AzureCon 2015, September 29, 2015 I have reproduced some screen shots in case you are unable to view this long video for one reason or another. One of the highlights is 3 datacenters coming on line in India.
Oct. 6, 2015 02:00 PM EDT Reads: 237
“The Internet of Things transforms the way organizations leverage machine data and gain insights from it,” noted Splunk’s CTO Snehal Antani, as Splunk announced accelerated momentum in Industrial Data and the IoT. The trend is driven by Splunk’s continued investment in its products and partner ecosystem as well as the creativity of customers and the flexibility to deploy Splunk IoT solutions as software, cloud services or in a hybrid environment. Customers are using Splunk® solutions to collect and correlate data from control systems, sensors, mobile devices and IT systems for a variety of Ind...
Oct. 6, 2015 01:00 PM EDT Reads: 586
SYS-CON Events announced today that ProfitBricks, the provider of painless cloud infrastructure, will exhibit at SYS-CON's 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. ProfitBricks is the IaaS provider that offers a painless cloud experience for all IT users, with no learning curve. ProfitBricks boasts flexible cloud servers and networking, an integrated Data Center Designer tool for visual control over the cloud and the best price/performance value available. ProfitBricks was named one of the coolest Clo...
Oct. 6, 2015 01:00 PM EDT Reads: 744
You have your devices and your data, but what about the rest of your Internet of Things story? Two popular classes of technologies that nicely handle the Big Data analytics for Internet of Things are Apache Hadoop and NoSQL. Hadoop is designed for parallelizing analytical work across many servers and is ideal for the massive data volumes you create with IoT devices. NoSQL databases such as Apache HBase are ideal for storing and retrieving IoT data as “time series data.”
Oct. 6, 2015 12:45 PM EDT Reads: 463
Clearly the way forward is to move to cloud be it bare metal, VMs or containers. One aspect of the current public clouds that is slowing this cloud migration is cloud lock-in. Every cloud vendor is trying to make it very difficult to move out once a customer has chosen their cloud. In his session at 17th Cloud Expo, Naveen Nimmu, CEO of Clouber, Inc., will advocate that making the inter-cloud migration as simple as changing airlines would help the entire industry to quickly adopt the cloud without worrying about any lock-in fears. In fact by having standard APIs for IaaS would help PaaS expl...
Oct. 6, 2015 12:30 PM EDT Reads: 590
Organizations already struggle with the simple collection of data resulting from the proliferation of IoT, lacking the right infrastructure to manage it. They can't only rely on the cloud to collect and utilize this data because many applications still require dedicated infrastructure for security, redundancy, performance, etc. In his session at 17th Cloud Expo, Emil Sayegh, CEO of Codero Hosting, will discuss how in order to resolve the inherent issues, companies need to combine dedicated and cloud solutions through hybrid hosting – a sustainable solution for the data required to manage I...
Oct. 6, 2015 12:00 PM EDT Reads: 446
Apps and devices shouldn't stop working when there's limited or no network connectivity. Learn how to bring data stored in a cloud database to the edge of the network (and back again) whenever an Internet connection is available. In his session at 17th Cloud Expo, Bradley Holt, Developer Advocate at IBM Cloud Data Services, will demonstrate techniques for replicating cloud databases with devices in order to build offline-first mobile or Internet of Things (IoT) apps that can provide a better, faster user experience, both offline and online. The focus of this talk will be on IBM Cloudant, Apa...
Oct. 6, 2015 10:45 AM EDT Reads: 457
Mobile messaging has been a popular communication channel for more than 20 years. Finnish engineer Matti Makkonen invented the idea for SMS (Short Message Service) in 1984, making his vision a reality on December 3, 1992 by sending the first message ("Happy Christmas") from a PC to a cell phone. Since then, the technology has evolved immensely, from both a technology standpoint, and in our everyday uses for it. Originally used for person-to-person (P2P) communication, i.e., Sally sends a text message to Betty – mobile messaging now offers tremendous value to businesses for customer and empl...
Oct. 6, 2015 10:45 AM EDT Reads: 188
As more and more data is generated from a variety of connected devices, the need to get insights from this data and predict future behavior and trends is increasingly essential for businesses. Real-time stream processing is needed in a variety of different industries such as Manufacturing, Oil and Gas, Automobile, Finance, Online Retail, Smart Grids, and Healthcare. Azure Stream Analytics is a fully managed distributed stream computation service that provides low latency, scalable processing of streaming data in the cloud with an enterprise grade SLA. It features built-in integration with Azur...
Oct. 6, 2015 10:00 AM EDT Reads: 738
SYS-CON Events announced today that HPM Networks will exhibit at the 17th International Cloud Expo®, which will take place on November 3–5, 2015, at the Santa Clara Convention Center in Santa Clara, CA. For 20 years, HPM Networks has been integrating technology solutions that solve complex business challenges. HPM Networks has designed solutions for both SMB and enterprise customers throughout the San Francisco Bay Area.
Oct. 6, 2015 09:00 AM EDT Reads: 577