Tuesday, December 18, 2007

OSGi and the Small Guy

After seeing a few presentations on OSGi at the Spring Experience conference. I've become inspired about how this can be useful for the small guy, not just for big enterprises.

Many of us use hosted web services to run small and personal sites. Generally, with a small site, there are a few major pieces of software that they all have in common (the parenthesis show what I currently use).
  • Web Server (Tomcat)
  • Mail Server (James)
  • Database (PostgreSQL)

If you are on a shared host, memory tends to be at a premium. For example, I use JVDS, for willCode4Beer, and only have 128MB of ram. I'm a java dev so I like running Tomcat. Running all of the services can really limit how much I can do.

Looking at OSGi, I'm considering moving to a model where everything can run off of the same virtual machine. This will also allow me to strip down the Linux install to a bare minimum.
My idea it a model like the following:



My latest searching indicates that Apache Derby can run as an OSGi module. I'm not sure if Tomcat can but, I know Jetty can (I could also write a bundle using the embedded version of Tomcat). I know that there is not an OSGi bundle for Apache James, but, I can always write it.

Anyway, there's my idea. I'm going to dedicate a little time to get it up and running. The best part is, where the various projects share libraries, I should be saving quite a bit of RAM, let alone the amount saved by running in the same VM.

Being able to deploy mailets to the James server without restarting will be nice too. Just imagine, deploying web apps and mail apps dynamically.

Scalability? Basically, its a feature of OSGi but, imagine running on top of Terracotta (the mind explodes).

Guess I have a little work ahead.

Update: I just realized, of course there is an OSGi bundle for Tomcat, it's used in Eclipse. Doh! :-)

Resources:
Tomcat Bundles
Derby Bundles
Jetty Bundles
.
.
.

Labels: , , ,

permalink
Links to this post

6 Comments:

At 18 December, 2007 16:02, Blogger doyle said...

I'm in.

 
At 21 December, 2007 01:36, Blogger Daniel Spiewak said...

One thing you might want to consider is that Jetty is far less bulky than Tomcat. That and (in my experience) it scales far more efficiently. Tomcat was great as a first-reference implementation of Servlets and JSPs, but it seems to have outlived its usefulness as an application server.

 
At 21 December, 2007 02:47, Blogger willCode4Beer said...

Daniel, your post made me think of something.
By being able to swap out web containers, it should be pretty easy to put together useful statistics about how one performs compared to another.

Of course, some vendors amy not want to release OSGi bundles of their servers for the very same reason.

 
At 21 December, 2007 04:06, Blogger Daniel Spiewak said...

That's an interesting thought, and I'd love to see an article looking into the idea. The problem I see is that to use OSGi as the "supercontroller" for the app-server in such a way, you're technically compromising the intended architecture of the app server. This isn't as much the case with Jetty, which is designed to be embedded, but Tomcat, Glassfish, JBoss, etc. While it may be *possible* to embed all of these, I doubt you could claim that the result is true to the performance of the "real thing".

 
At 21 December, 2007 15:05, Blogger willCode4Beer said...

I guess it just depends.
I once used the so called embedded version of tomcat inside an SWT app when building a tomcat live cd to demo a project once.

It actually performed the same as the regular one. It can be stripped down more so possibly capable of a smaller footprint.

Alas, the last version of Tomcat to support that is 5.5. It's not in version 6 (yet?).

Having thought about it more, I tend to agree that Jetty is probably the way to go. Besides being officially sanctioned, not having to write (and maintain) an OSGi bundle for Tomcat is probably a good thing. Besides, if features are needed that Jetty doesn't support, those features could be implemented as bundles separately :-)

Having done a little homework since writing the original post, I think most of my time is going to be eaten up writing the OSGi bundle around the James server :-P

Maybe in the process, I should make James run on the Spring Framework instead of Avalon. That should gain both friends and enemies.

 
At 23 July, 2009 03:09, Blogger Sunny Kapoor said...

Nice post and nice thing you are planning to do.. After reading your post I got something my head so I tried myself to use the derby bundle mentioned above in your post as a service in eclipse but "Oh my days" couldn't use derby bundle in eclipse environment to create dependent bundles
Well found an alternate way to use it and also written a post about it.
Could you please care to have a look on it.
Is there any other way we can use third party bundles to create our own dependent bundles other then the way I have mentioned in post ?

Thanks Link to the post is mentioned below

Link: http://thegeekhead.blogspot.com/2009/07/how-to-runuse-derby-on-equiox-and.html

Much Appreciated

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Links to this post on:

Create link here by posting on Blogger