How we use OSGi to build Open Liberty Alasdair Nottingham - IBM 1 - - PowerPoint PPT Presentation

how we use osgi to build open liberty
SMART_READER_LITE
LIVE PREVIEW

How we use OSGi to build Open Liberty Alasdair Nottingham - IBM 1 - - PowerPoint PPT Presentation

How we use OSGi to build Open Liberty Alasdair Nottingham - IBM 1 Background 2 Project goals Implement Jakarta EE Small Footprint Start fast Composible Dynamic Easy to use 3 Just Enough App Server You


slide-1
SLIDE 1

1

How we use OSGi to build Open Liberty

Alasdair Nottingham - IBM

slide-2
SLIDE 2

2

Background

slide-3
SLIDE 3

3

Project goals

  • Implement Jakarta EE
  • Small Footprint
  • Start fast
  • Composible
  • Dynamic
  • Easy to use
slide-4
SLIDE 4

4

Just Enough App Server

  • You control which features are loaded into each server instance

Kernel Servlet-4.0 http-2.0 appmgr

<feature>servlet-4.0</feature> <feature>jsf-2.3</feature>

jsp-2.3 jsf-2.3

slide-5
SLIDE 5

5

Server configuration

<server> <featureManager> <feature>javaee-8.0</feature> </featureManager> <httpEndpoint id=“defaultHttpEndpoint” httpPort=“8080”/> <webApplication location=“myWeb.war” contextRoot=“/”/> </server>

  • Metatype describes config
  • DS describes config
  • CA parses XML
  • Subsystem Feature

describes bundles for feature

  • DS component activated to

start http transport

  • DS component activated to

start application

slide-6
SLIDE 6

6

custom classloaders

Jakarta EE on OSGi

Bundle A Bundle B Bundle c ear jar jar war jar jar region Gateway

slide-7
SLIDE 7

9

Last 12 months

slide-8
SLIDE 8

10

Towards one second start-up

Amost halved startup time due to app server and JVM improvements through 2019 2 hyperthreaded cpus on 2 socket system, each socket containing 24 cores. cpu model: Intel Xeon Platinum 8168 CPU @ 2.70 GHz Application PingPerf - https://github.com/HotswapProjects/pingperf

0.5 1 1.5 2 2.5

December March April July August September

2019 Progression of OpenLiberty+OpenJ9 startup time (seconds)

Seconds

slide-9
SLIDE 9

11

Performance Improvements

  • Equinox
  • Regions (Equinox)
  • Metatype (Equinox)
  • Declarative Services (Felix SCR)
  • Config Admin (Liberty)
  • Subsystem Features (Liberty)
slide-10
SLIDE 10

12

Things that are expensive

  • findEntries
  • Searching jar files for sub-paths is expensive
  • XML Parsing
  • Text file parsing
  • Opening and reading many files vs one
  • Case insensitive matching in filters
  • Reflection to find methods on DS components

Enumeration e = b.findEntries("OSGI-INF", "*.xml", true);

slide-11
SLIDE 11

13

Parallel Bundle start

  • Equinox activates bundle one by one
  • Updated to support starting bundles within start level in parallel
  • Turns out a lot of code actually depends on bundle start order when

you have a predictable install order

slide-12
SLIDE 12

14

Things we learned

  • Shutdown is not as simple as stopping the framework
  • Statics and service do not mix & match
  • Use the build tools
  • Very powerful for large complex software
  • DS and ConfigAdmin together are brilliant
  • High learning curve
  • Java SE classloading assumptions don’t mix well in OSGi
  • Shuffle bundle install order to avoid start time dependencies
slide-13
SLIDE 13

15 15

Thoughts on future

slide-14
SLIDE 14

16

  • Can Liberty function without the OSGi Modularity layer?
  • Can we choose the modularity layer and swap between OSGi,

JPMS and none?

  • Stick with DS, CA, services, but not OSGi bundles