Monday, July 27, 2009

Why is server side OSGi AWOL?

Last few years there has been plenty of buzz around OSGi. There are many high profile projects using it http://en.wikipedia.org/wiki/OSGi as can be seen here. It was even rubberstamped into JSR-291.

As a basis for developing platforms, OSGi has garnered a lot of success. But what does does that mean to me? I don't work on platform development, perhaps >95% of IT community does not. My bills are paid by developing applications. Server side is what interests most people in Java, although, OSGi got its start on devices and desktop arguably Eclipse has answered it.

Yet, with all this much buzz, I felt I should check things out a bit. I did have a motivation to do so, because I was trying to look at ways by which I could componentize Portlets so that I do not get bitten by things I mentioned in my previous post.

After kicking some tires, I am still left with the feeling that all is not well in the OSGi land today. I will readily admit to my noobie status, still, following are some of the concerns I still have.

1. The benefits of OSGi are not obvious.
Modularity and componentizing has been such a big problem, for so long, there have been too many solutions which in many ways overlap or compete: EJB, POJO, Maven, (Web)services, DI, etc. the list is so long, you are already using many diluting the pay back. Much has been written about the benefits of OSGi, yet, nothing brought it home to me succinctly.

2. OSGi has a learning curve.
It needs an initial investment of time and effort. Words like Module, Component, Service, Bundle (well, maybe not bundle), etc. are already is wide use with conflicting / overlapping meaning and OSGi yet again over loads these words causing more confusion to the average developer. OSGi Alliance needs to invest a bit on developing well documented examples, patterns, best practices, something like what Sun did through J2EE Blueprints.

3. Tooling and IDE support is not ready for prime time.
I think in just rubber stamping an existing spec through JSR-291, we lost a huge opportunity to improve. Adding OSGi based Annotations could have helped a lot, by making this platform less Run-time focused and could have added Compile time/Deployment time support. I don't know all the politics of this, but Sun's No vote was very illuminating. The run-time focus of OSGi right now, is too dependant on being able to use a console. Not something I would be willing to deal with on a day-to-day. How about a platform independent Ant Tasks. I know of the ant wrapper on BND, I am talking about something more. Perhaps something that can augment/replace the runtime console. Does that need Distributed OSGi? That would be one way to do it. Alternatively, the spec already has a HTTP Service, which arguably can be used to incorporate this added functionality. Eating ones own dog food is good.

Squandering of JSR-291 opportunity has left relationship between OSGi bundles and WAR/EAR packaging and management fuzzy. Yes, I know, a bundle is just another jar, which can be dumped into a war like all the other jars one dumps into a war, but then you don't start or stop a jar at runtime.

4. Tomcat/OSGi integration today is non-existent.
This to me a huge gap. After all Tomcat is the most dominant webapp server today. There was some discussion among Tomcat developers regarding this for Tomcat 7, but nothing exists today. Unless there are easy ways of creating Bundles, packaging, deploying, debugging, it will fail to catch market share among application developers.

5. Distributed OSGi a necessity.
There is an RFC (the link goes to the entire set of specs of which RFC 119 is a part of), some talk about it, some development too, but it is not here yet with the exception of the reference implementation Apache CXF. I think when I can use a few Annotations and/or simple configuration, and get a nice Web Services based service, which can be started and stopped easily OSGi will always be one of those curiosities.

6. Framework Support a necessity.
OSGi does not define higher level services, but one needs Transaction Management, Dependancy Injection, QoS, Availability / failover / clustering, ability to locate and use services across applications, system, network, OS boundaries on and on. You can debate the choice of words here "Framework support", but I was kind of alluding to the type of added value Spring framework brings to a POJO. Till such functionality becomes available in a seamless manner, a developer will always be wondering how does OSGi fit into my application.

After a huge burst of interest when Eclipse 3 moved to OSGi 3 years back, somehow I get the feeling OSGi momentum is stalling. However, some powerful market forces are at work here. With Oracle acquiring Sun (Glassfish [when will v3 loose its Prelude moniker signalling production readiness? that's a whole different story]), BEA (Weblogic), what impact does that have? Will it further boost OSGi? It can, if Oracle Application Server also adopts it in a big way delivering a large pool of interoperable bundles across the 3 platforms. This can lead to an explosion of the repository of bundles, enabling one to grab ready-to-use-bundles and use it. That of course will finally bring home the benefits succinctly while answering the main question this blog poses.


My crystal ball sure is cloudy, how's yours?

No comments: