• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

OSGI for microservices-based application?

 
Bartender
Posts: 1368
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Reading here and there on internet about microservices architectures, I sometimes read some articles (or blog posts) where this or that guy suggest to start your path towards microservices based architectures using OSGI.
I have to admit that there aren't so many IT architects suggesting OSGI nowadays. You know, usually when you heard about microservices and Java platform, you have to expect to hear about Spring boot.
Honestly, Spring Boot is definetly a very important, if not the most , player in microservices world; so I was initially a bit puzzled reading about OSGI as a viable approach, but the more I think about it , the less I think it's a bad idea.
With OSGI, one could develop a single microservice as a bundle; the OSGI platform (when well used) forces you to keep your code as more modular as possible.
Moreover, withing an OSGI container you have dinamic modules, you got hot redeploy feature for free, you can let the single bundles exposes services communicating each other easily and in a clean way (without going with REST even for "internal" communication) and so on.
Of course a similar approach would not be considerated koshir: for example all of your services would run in a single JVM, they may be more strongly coupled than they should be, but nevertheless OSGI may be a way to go.
Main drawbacks I can see is that OSGI isn't so much popular nowadays and, with respect to Spring, seems to be less "modern" and up-to-date. Moreover, the learning curve is steeper (at least in my opinion).
What do you think, guys ?

 
Saloon Keeper
Posts: 28138
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, Eclipse is built on OSGi. In fact, I think a lot of what OSGi is today was developed as a result of working on Eclipse. Some of the service bus systems (possibly MULE) are also OSGi-based.

While OSGi doesn't have full app isolation, it does have about the same (possibly a little more) isolation that webapps do, thanks to Java's multiple-classpath features. There have been projects with JVMs that do have a higher level of isolation although I don't know if any are commercially available.

I run Apache ServiceMix and it has an app that filters and re-formats selected incoming emails for me. I also had an app that would digest bulletins from the National Hurricane Center, although that one's offline at the moment.

Back around 2005, there was an Apache project family called Avalon. It was one of the earliest Inversion of Control containers and we used it for many daily and on-demand batch processes. We were rather put out when it all went away. These days, I'd probably use OSGi and ServiceMix. I haven't been keeping close track on Spring Boot, but initially at least, it appeared to be a way to make a drop-in "instant webapp server" with minimal effort which is great for stuff where you want a single app and don't want to set up a complete manually-controlled Tomcat server, for example. ServiceMix (actually, I think it's Karaf, but I have trouble remembering what's built on who) also supports HTTP-capable OSGi services and in addition isn't limited to a single webbapp. So it has some potential to fill the space between Spring Boot and Tomcat with the bonus that it also has more flexibility for non-web applications than Tomcat does.
 
Claude Moore
Bartender
Posts: 1368
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A little weakness I see in Spring Boot is that it's too much cloud oriented. Ok, this may seem a total nonsense, but I personally miss something similar to old fashioned "application containers" like appserver are:a place where you can deploy, start, stop, update your applications - in this case, your spring Boot applications. I tried to use an external Tomcat as container, an approach that worked but gave me the feeling I forced the hand a bit. Spring tools suite (STS) offers an excellent Dashboard to collect, run, restart spring Boot apps, but unlikely it is provided only as eclipse feature, it's not something you can run in production. And with docker containers, development is all but straightforward...This is why using an osgi runtime like Apache Felix seems appealing to me.
 
Tim Holloway
Saloon Keeper
Posts: 28138
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A while back, VMWare was using a self-contained Tomcat server for its desktop management GUI. The first thing I thought (perhaps wrongly) when I heard about Spring Boot was that was an easy way to do that.

If STS is an Eclipse plugin, then there's likely an OSGi bundle involved.

I haven't had that much problem with Docker myself.  Using the "docker exec" command I can get into most containers and diagnose problems. The worst cases are the really minimalistic ones where you need netstat or curl and they're not installed and neither is the package manager. The cure for that is to use the offending container as a base for a self-designed container that has the necessary tools installed.

Incidentally, I have a set of baseline JDK Docker containers and a set of Tomcat containers that build off them. By judicious use of mountable volumes, I can make containerized Tomcat services really easily. And they share the non-unique resources, so it's as efficient as running a split CATALINA_HOME/CATALINA_BASE while also possessing the virtues of containerization.

My copy of ServiceMix is also in a Docker container, incidentally.
 
Claude Moore
Bartender
Posts: 1368
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

If STS is an Eclipse plugin, then there's likely an OSGi bundle involved.



Yes, it's possible; anyway for what I have read, OSGi and Spring don't play well together.Some times ago, Spring offered Dynamic Modules (or a similar name, sorry I don't remember well), but for some reason that package was deprecated.

Tim Holloway wrote:
I haven't had that much problem with Docker myself.  Using the "docker exec" command I can get into most containers and diagnose problems. The worst cases are the really minimalistic ones where you need netstat or curl and they're not installed and neither is the package manager. The cure for that is to use the offending container as a base for a self-designed container that has the necessary tools installed.


I agree that docker it's an excellent way to deploy applications in a 'controlled' environment. I think it's a bit overwhelming -at least for me, but at the very end it's all matter to get in the habit of using it - during development stage, especially when compared do sping dashboard - really, really fast.
 
Tim Holloway
Saloon Keeper
Posts: 28138
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, if you want to develop applications in a controlled environment, I recommend Vagrant. Vagrant can spin up a blank VM for you to run test deployments on, then once you are happy that you have it all manageably packaged up, nuke the Vagrant VM, spin up a new one and re-deploy with the "final" version of the package to confirm it's all clean. Vagrant can also automatically run Ansible, Puppet or Chef deployments, depending on how you've set up the Vagrant config file and which base VM image you're using. It can even launch multiple VMs with a single command. The DevStack version of the OpenStack Cloud has been set up on Vagrant that way - it spawns a control node vm, compute node vm, and a storage vm, if I remember correctly. All connected together in a little bitty cloud.
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic