Skip to main content



      Home
Home » Archived » Eclipse SmartHome » Lightweight framework for eclipse smarthome
Lightweight framework for eclipse smarthome [message #1692889] Mon, 20 April 2015 09:06 Go to next message
Eclipse UserFriend
hi,

I've heard several times the opinion that ESH and OpenHAB are too "heavy" from a CPU en flash size perspective and I'm wondering what could be done, and what has already been tried, to get ESH as slim as possible. I've read some points on this topic in Kai's blog, but is there more details available ?

  • removing all "big" dependencies : I know it has been done with xtext (which means removing the DSL, and probably move the configuration and the rules in UI, java code or the new rule engine) but there are probably other libraries that could be removed : guava, guice, jersey, ... (these 3 only amounts to one third of the size of the minimal OH2 runtime)
  • run on a smaller OSGI Framework : I've read that concierge was a potential target, but is that already a reality ? I don't see a lot of activity on the project and I could not find any information on it's current status. Knopflerfish could also be an option, has anybody already tried it ?
  • run on a smaller JVM : either javaSE Embedded 8 (any luck on that ? ) or any of the other embedded jvm ?

thanks for your help.

Pierre
Re: Lightweight framework for eclipse smarthome [message #1692909 is a reply to message #1692889] Mon, 20 April 2015 10:09 Go to previous messageGo to next message
Eclipse UserFriend
Hi Pierre,

Pierre Rust wrote on Mon, 20 April 2015 09:06


  • removing all "big" dependencies : I know it has been done with xtext (which means removing the DSL, and probably move the configuration and the rules in UI, java code or the new rule engine) but there are probably other libraries that could be removed : guava, guice, jersey, ... (these 3 only amounts to one third of the size of the minimal OH2 runtime)
  • run on a smaller OSGI Framework : I've read that concierge was a potential target, but is that already a reality ? I don't see a lot of activity on the project and I could not find any information on it's current status. Knopflerfish could also be an option, has anybody already tried it ?
  • run on a smaller JVM : either javaSE Embedded 8 (any luck on that ? ) or any of the other embedded jvm ?



About your questions:


  • removing all "big" dependencies :
    Guava, Guice: these are dependencies which are essential part of the runtime and will be used by some bundles internal. It will simplify development and avoid redundancy using same core functionality. There might be optimizations possible to downsize these libraries to required parts only.
    Jersey: Jersey is required as any UI connecting to ESH does need REST APIs. In theory Jersey could be replaced by another JAX-RS container if required. We did some investigation for more lightweight REST frameworks, but there was no solution easily replacing Jersey (like Apache Wink, does support JAX-RX 1.x only, no SSE).
    FYI: there are PullRequests to OSGi-JAX-RS-Connector to downsize and optimize Jersey for using in embedded environments. See project OSGi-JAX-RS-Connector from Holger Staudacher, pull requests 91, 93

    It may depend on your requirements whether you need REST APIs at all: then you can get rid of some bundles related to Jersey and REST in general.

  • run on a smaller OSGI Framework
    I am doing the port of Eclipse SmartHome to Concierge. If you are interested in progress read the file "JochenHiller/concierge-tests/blob/master/docs/Concierge-EclipseSmartHome.md" at GitHub about the current state. I am running minimal OH2 runtime with Concierge. But to be honest: the OSGi framework is the smallest part regarding the footprint.
    I am actually waiting for release builds of Concierge, Eclipse Mars and Jetty 9.3 to provide a PR to Eclipse SmartHome for supporting Concierge, as most problems have been in conjunction of Concierge and 3rd party libraries.

    I personally did not try Knopflerfish. I heard that some developers are using ESH with Apache Felix/Karaf.

  • run on a smaller JVM :
    We are running ESH on JavaSE Embedded 7. Future plans should target JavaSE Embedded 8 too, we think that Compact profile 2 should be sufficient. I did not made a full testing against full JavaSE Embedded 8, but expecting no problems. For compact profile 2 there might be small changes which I do not oversee until now.
    I did some testing with other JVMs too, which did work for the core framework. But to be honest: there are not so much embedded JVMs available on the market which supports Java 7 language/libraries and later.



Best regards, Jochen
Re: Lightweight framework for eclipse smarthome [message #1692931 is a reply to message #1692909] Mon, 20 April 2015 12:17 Go to previous messageGo to next message
Eclipse UserFriend
Thank you very much for this detailed answer !

very good news for concierge and Java embedded edition Smile I'll have a look at the page on github

Concerning the dependencies, I'm quite surprised to see Guice used in a OSGi project where Declarative service is already used everywhere : they both provide dependency injection, and DS is the "natural way" in an OSGi environment. I had a quick look and it seems that @Inject annotation are only used in org.eclipse.smarthome.model.* packages : would that not go away when removing DSL support ? ( it's just a will guess, I don't precisely know what these packages provides and I've never managed to compile and access them without error in eclipse, only with maven).

I admit guava and jersey are nice libs that makes life really easier for developers, but the other projects I've seen who where targeting embedded platforms with Java tend to favour footprint over developer friendliness... I'll have a look at the PR, but I'm not convinced a full JAX-RS implementation is needed on a smarthome box. JAX-RS was designed for server environment and it looks like a giant hammer hitting on a small nail here Wink

Anyway, this looks very encouraging, the way the ESH platform is built should make easy to replace parts if / when they are too heavy and it's nice to see they are other people concerned by the footprint of the solution !


Re: Lightweight framework for eclipse smarthome [message #1692945 is a reply to message #1692931] Mon, 20 April 2015 14:36 Go to previous message
Eclipse UserFriend
Just a few remarks:

Guice is used inside Xtext for dependency injection. I don´t think that it is used somewhere else. So if you skip the whole DSL part Guice should not be needed. Xtext is a framework that typically runs inside an IDE on Mac or PCs. openHAB and Eclipse SmartHome are one of a few projects, which use Xtext on embedded systems.

Guava is a library, which brings 2.2 MB footprint, but it should not cause any performance issue, as it mainly has utility methods and classes with good performance.

Maybe we should clearly define which kind of embedded system we target. Indeed everybody has a different understanding of "embedded". When I think of embedded I have something in mind which is around 500 MHZ, 512 MB RAM, so comparable to Rasperry PI 1. But a lot of the smart home gateways today have even more power. In such systems 2.2 MB footprint should not be the problem.

But with Jersey I fully agree, that it is not targeted for embedded systems and we have a lot of problems with it. But I think it is not a problem with Jersey, but with the whole JAX-RS approach. I´m not sure if other JAX-RS implementations do better, as they all were developed for server environments. So the only possibility would be to manually implement REST.

Regards

Dennis
Previous Topic:ImageItem and Rawtype
Next Topic:Defining and handling alarms
Goto Forum:
  


Current Time: Mon Jul 21 08:05:38 EDT 2025

Powered by FUDForum. Page generated in 0.09364 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top