Post on 05-Apr-2017
#DevoxxUS
Lean and Easy IoT Applications with OSGi and Eclipse Concierge
Jan S. Rellermeyer, IBM Research
#eclipseIoT @rellermeyer
#DevoxxUS
THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY.
WHILST EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
ALL PERFORMANCE DATA INCLUDED IN THIS PRESENTATION HAVE BEEN GATHERED IN A CONTROLLED ENVIRONMENT. YOUR OWN TEST RESULTS MAY VARY BASED ON HARDWARE, SOFTWARE OR INFRASTRUCTURE DIFFERENCES.
ALL DATA INCLUDED IN THIS PRESENTATION ARE MEANT TO BE USED ONLY AS A GUIDE.
IN ADDITION, THE INFORMATION CONTAINED IN THIS PRESENTATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM, WITHOUT NOTICE.
IBM AND ITS AFFILIATED COMPANIES SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION.
NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, OR SHALL HAVE THE EFFECT OF:
- CREATING ANY WARRANT OR REPRESENTATION FROM IBM, ITS AFFILIATED COMPANIES OR ITS OR THEIR SUPPLIERS AND/OR LICENSORS
Important Disclaimers
#eclipseIoT @rellermeyer
#DevoxxUS
Software Lifecycle Management
#eclipseIoT @rellermeyer
Module A
Module B
Module C
Module D
#DevoxxUS
OSGi Module LayerModules are called Bundles• JAR files with additional metadata
Runtime system: The Framework• Lifecycle management
Bundles implement isolation and locality• Interaction between bundles is limited
• Shared code through package imports
• Every bundle is loaded through a separate classloader
Monitoring system state through events
#eclipseIoT @rellermeyer
Module
Module Module
#DevoxxUS
OSGi Framework
OSGi Framework
Bundle A
Package 1Package 2Package 3
Bundle B
Package IPackage II
Exported Package Exported Package
Private Package
Import
Export-Package: Package 1 Export-Package: Package I, Package II
Import-Package: Package 1
#eclipseIoT @rellermeyer
#DevoxxUS
OSGi Service LayerModules allow for a compositional approach to building applications
But: Package dependencies are explicit.
Limits the modularity!
Solution: Services
Idea: Separate the interface from the implementation
Module
Module Module
Interface
Implementation
Service Service
#eclipseIoT @rellermeyer
#DevoxxUS
OSGi for IoTIoT systems are often dynamic
•Sensors and actuators might not always be available
•N:M relationship between producers and consumers
Event Source
Event Listener
Servicegets registers
receives service life-cycle events
Service Registry
#eclipseIoT @rellermeyer
#DevoxxUS
Eclipse ConciergeFull OSGi core R5 compatibility• Goal achieved
Keep a small footprint to work well on embedded devices • 250kiB without debug symbols
• 330kiB with debug symbols
Remain “readable”
• Currently 9 classes
Remain backwards-compatible• Java 5
#eclipseIoT @rellermeyer
#DevoxxUS
Building IoT Applications• Concierge supports Knopflerfish-style xargs file for startup• Enhanced property (variable replacement) and install notation (wildcard support)• Supports start level in scripts (-level <n>)
#eclipseIoT @rellermeyer
$ java -jar framework/org.eclipse.concierge-5.0.0.*.jar samples/demo.xargs
# demo.xargs-Dorg.osgi.framework.system.packages.extra+=javax.xml.parsers# -Drepo=http://www.us.apache.org/dist/felix-Drepo=localRepo
# load bundles, use wildcard notation for local files, not for URLs-istart bundles/org.eclipse.concierge.shell-5.0.0.*.jar-istart bundles/org.eclipse.concierge.service.startlevel-5.0.0.*.jar-istart bundles/org.eclipse.concierge.service.packageadmin-5.0.0.*.jar-istart ${repo}/org.apache.felix.httplite.complete-0.1.4.jar-istart ${repo}/org.apache.felix.webconsole-4.2.14-all.jar
#DevoxxUS
Remote Management• RESTful interface
• Exposing the framework and its internal state as resources
• Bundles
• Services
• Easy management of OSGi deployments through REST
• Command line tools
• Web interfaces
• Application-level
#eclipseIoT @rellermeyer
#DevoxxUS
Use Case: Eclipse SmartHome
#eclipseIoT @rellermeyer
+openHAB2 smarthome-concierge
Distribution 160 MB 19 MB
OSGi (no Karaf) 3.1 MB 1.6 MB
EMF/xText 7 MB 0 MB
Java Runtime 32 MB 16 MB (compact3)12 MB (compact2)
Memory footprint ~32 MB ~15 MB
Startup time ~40 sec ~30 sec
#DevoxxUS
Use Case: OSGi enRoute
OSGi enRoute uses OSGi R6 and bndtools
• R6 implementation of Concierge available as a snapshot
• OSGi repository hosted at the Concierge website
#eclipseIoT @rellermeyer
#DevoxxUS
ExperimentsBeaglebone Rev A5•AM335x 720MHz ARM Cortex-A8•256 MiB DDR2 RAM•4 GiB microSD card •Angstrom Linux•Java SE Embedded 1.7.0_21-b11 and•Java SE Embedded build 1.8.0_06-b23 compact1
Image: http://beaglebone.org
Raspberry Pi B
•ARM1176JZF-S 700 MHz ARM 11•512 MiB SDRAM (shared with GPU)•8 GiB SDHD card•Raspbian Linux•Java SE build 1.8.0-b132
#eclipseIoT @rellermeyer
#DevoxxUS
Experiments
Eclipse Equinox
• version 3.11.2.v20161107-1947
• 1.3 MiB
• (R6 framework)
Apache Felix
• version 5.6.2
• 697 kiB
Knopflerfish
• version 7.2.0
• 609kiB / 320kiB compact
Concierge
• version 5.1.0 SNAPSHOT
• 248kiB
#DevoxxUS
Performance – Startup Time
#eclipseIoT @rellermeyer
0
2
4
6
8
10
12
14
16
18
20
Beagleboneejre7 Beagleboneejre8 RaspberryPi
time(s)
VM
Concierge
Equinox
Felix
Knopflerfish
#DevoxxUS
Performance – Service RegistryStress test
Register 10000 services
• Each one has a random value for the same key
• Range: byte => collisions
Perform 1000 lookups (getServiceReferences) for a random value
• Range: byte
Unregister the 10000 services
Registry
#eclipseIoT @rellermeyer
#DevoxxUS
Performance – Service Registry
0
2000
4000
6000
8000
10000
12000
14000
16000
Beagleboneejre7 Beagleboneejre8 RaspberryPi
time(m
s)
ServiceRegistration
Concierge
Equinox
Felix
Knopflerfish
#eclipseIoT @rellermeyer
#DevoxxUS
Performance – Service Registry
0
100000
200000
300000
400000
500000
600000
700000
Beagleboneejre7 Beagleboneejre8 RaspberryPi
time(m
s)
ServiceLookup
Concierge
Equinox
Felix
Knopflerfish
#eclipseIoT @rellermeyer
#DevoxxUS
Performance – Service Registry
0
1000
2000
3000
4000
5000
6000
Beagleboneejre7 Beagleboneejre8 RaspberryPi
time(m
s)
ServiceUnregistration
Concierge
Equinox
Felix
Knopflerfish
#eclipseIoT @rellermeyer
#DevoxxUS
Performance – ResolverGenerate 1000 “random bundles”
• Can either import or export up to 5 packages
• Choice of 50 packages in total
• For exports: generate a random package version from [1.0.0-21.0.0)
• For import: generate a random import range from the interval.
Install all 1000 bundles
Resolve the bundles
Benchmark turned out to be rather volatile…
#eclipseIoT @rellermeyer
#DevoxxUS
Performance - Resolver
#eclipseIoT @rellermeyer
0
20000
40000
60000
80000
100000
120000
Beagleboneejre7 Beagleboneejre8 RaspberryPi
time(ms)
Installation
Concierge
Equinox
Felix
Knopflerfish
#DevoxxUS
Performance - Resolver
0
10000
20000
30000
40000
50000
60000
Beagleboneejre7 Beagleboneejre8 RaspberryPi
time(ms)
Resolving
Concierge
Equinox
Felix
Knopflerfish
#eclipseIoT @rellermeyer
#DevoxxUS
Eclipse Concierge
Concierge is an OSGi frameworkoptimized for embedded devicesand the Internet of Things
#eclipseIoT @rellermeyer
http://eclipse.org/concierge
Project Homepage
https://github.com/eclipse/concierge
Clone it from here It’s simplicity and usability can help
you with developing complex IoTapplications with ease.
© 2017 IBM Corporation
Mission Badge #6:SMS Text
Your mission should you choose to accept it….
Join us at the IBM Booth for hands-on labs, demos, games and talk to our developers.
Text Mission2017 to 41411to get the booth giveaway and learn more about all the IBM sessions & speakers.
Enter the raffle by completing missions for a chance to win• a Drone• TJBot Kit • VR glasses
#DevoxxUS
Copyright and Trademarks© IBM Corporation 2017. All Rights Reserved.
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines Corp., and registered in many jurisdictions worldwide.
Other product and service names might be trademarks of IBM or other companies.
A current list of IBM trademarks is available on the Web – see the IBM “Copyright and trademark information” page at URL: www.ibm.com/legal/copytrade.shtml
#eclipseIoT @rellermeyer