osgi performance bloopers - martinlippert · 2009-11-11 · osgi performance bloopers author:...
TRANSCRIPT
![Page 1: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/1.jpg)
OSGi Performance Bloopers | © 2009 Martin Lippert; made available under the EPL v1.0
OSGi Performance Bloopers
Martin Lippert
![Page 2: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/2.jpg)
![Page 3: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/3.jpg)
![Page 4: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/4.jpg)
![Page 5: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/5.jpg)
What is this all about?
![Page 6: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/6.jpg)
„Take the fat man off your app and it will run faster“
![Page 7: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/7.jpg)
Find out where the problem is...
failblog.com
![Page 8: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/8.jpg)
It‘s never where you expect it
failblog.com
![Page 9: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/9.jpg)
Measure !!!
![Page 10: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/10.jpg)
In most cases your performance problems are not related to OSGi at all...
Insteadpoor database access
scalability of algorithmswrong usage of HashMaps
Strings...
![Page 11: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/11.jpg)
But now, lets focus on
OSGi
![Page 12: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/12.jpg)
Startup
![Page 13: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/13.jpg)
Proposal mock-up – not an actual program
A solution...?!?
from Chris Laffras talk on Eclipse performance
![Page 14: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/14.jpg)
Don‘t turn on everything...!!!
Bundle activation can be expensive
![Page 15: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/15.jpg)
Avoid bundle activationif possible
Use insteadextension registry
lazy activationno activation
![Page 16: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/16.jpg)
Do work asynchronously
How?Lazy initializations
Threading (but complex)Extender pattern
![Page 17: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/17.jpg)
Take care what others add
failblog.com
Extenders can cause „interesting“
behavior at startup
![Page 18: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/18.jpg)
Example:Spring Dynamic Modules
![Page 19: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/19.jpg)
Spring DM
creates application context (on bundle activation)sync or async
sounds good, eh?
![Page 20: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/20.jpg)
But...
XML parsing is expensiveproxy bean creation is expensivebean creation can be expensive
if you do this for hundreds on bundles, you will wait for a long time
![Page 21: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/21.jpg)
Avoid bean + proxy creation
„lazy-init=true“
![Page 22: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/22.jpg)
Lazy activation can also be dangerous
bundle is activatedspring context is created
class is loaded from another bundle
the provider bundle is now activated (lazy)runs itself activator
creates spring context
![Page 23: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/23.jpg)
Don‘t clean too often
![Page 24: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/24.jpg)
Equinox has the „-clean“ optionDon‘t use it!!!
It cleans all the OSGi framework caches at startup
![Page 25: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/25.jpg)
modules, abstractions, APIs
![Page 26: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/26.jpg)
sometimes results in calling the same method over and
over again
![Page 27: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/27.jpg)
Conclusions
![Page 28: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/28.jpg)
1. Measure2. Optimize
3. Goto 1.
![Page 29: OSGi Performance Bloopers - martinlippert · 2009-11-11 · OSGi Performance Bloopers Author: Martin Lippert Created Date: 20091111160917Z](https://reader034.vdocuments.net/reader034/viewer/2022043003/5f81e138f06a490f273a7bf7/html5/thumbnails/29.jpg)
OSGi Performance Bloopers | © 2009 Martin Lippert; made available under the EPL v1.0
Thank you for your attention
Martin Lippert:[email protected]