SlideShare a Scribd company logo
1 of 37
Download to read offline
OSGi
Building LinkedIn's Next Generation
       Architecture with OSGI


                                           Yan Pujante
                     Distinguished Software Engineer
             Member of the Founding Team @ LinkedIn
                                ypujante@linkedin.com
                        http://www.linkedin.com/in/yan
Background
■ LinkedIn created in 03/2003
  • close to 30M members
  • profitable with 5 revenue lines
  • HQ in Mountain View (400 employees)
■ Technologies
  • 2 datacenters (~ 600 machines)
  • SOA, java, tomcat, spring framework, http,
    Oracle, MySQL, servlets, jsp, graph, OSGi...
  • dev on MacOS X, prod on Solaris
Challenges
 ■ Growing engineering team on a monolithic
   code base (still modular)


 ■ Growing product team wanting more and
   more feature, faster


 ■ Growing operations team deploying more
   and more servers
Challenges (SOA in dev)
       Front-End                               Back-End

                           X
         1       3
                         webapp
                                           Z
             2
                           Y           webapp
         4                                                M
                     N   webapp
                               jetty (1)             webapp
             P                                                            N
                                                          R           webapp
         webapp
                                                     webapp
         tomcat
                                                              jetty (2)




■ Front-end: many BL services in one webapp (in tomcat)
■ Back-end: many wars in 5 containers (jetty) with 1 service
  per war
■ Note that prod and dev are different
Container Challenge

■ 1 war with N services
  • does not scale for dev (conflicts, monolithic...)


■ N wars with 1 service
  •    does not scale from a container point of view (no
      shared jars)
      ■   Can add containers but only 12Gb of RAM :(
Challenges (SOA in prod)
 ■ Upgrading back-end service to new version
   requires downtime
   • Hardware LB does not account for version
 ■ Upgrading front-end service to new version
   requires redeploy
   • N services in 1 war
 ■ Adding new back-end service painful
   • lots of manual configuration (LB, front-
     end...)
Solution: OSGi

■ Belief that OSGi is one of the tools that will help us
  address those challenges




       Why OSGi?
OSGi intro

 ■ OSGi means “Open Services Gateway
   initiative”
 ■ OSGi is a spec with several implementations
   • Equinox (eclipse!)
   • Knoplerfish
   • Felix (Apache)
OSGi intro (cont.)
 ■ OSGi has some very good properties
   • Smart class loading => multiple versions
     jars ok
   • Highly dynamic => deploy / undeploy built
     in
   • Services registry
   • Highly extensible / configurable
 ■ OSGi bundle = Jar File with OSGi manifests
OSGi bundle

Specification-Title: Colorado Software Summit 2008 Hello Wolrd Client
Bundle-Activator:
 com.linkedin.colorado.helloworld.client.HelloWorldClientActivator
Import-Package:
 com.linkedin.colorado.helloworld.api;version=quot;[1.0.0,1.0.1)quot;,
 com.linkedin.colorado.helloworld.client;version=quot;[1.0.0,1.0.1)quot;,
 org.osgi.framework;version=quot;[1.4.0,1.4.1)quot;
Export-Package:
 com.linkedin.colorado.helloworld.client;version=quot;1.0.0quot;
Bundle-Version: 1.0.0
Bundle-Name: colorado-helloworld-client
Bundle-ManifestVersion: 2
Bundle-SymbolicName: colorado-helloworld-client
Bnd-LastModified: 1224557973403
Generated-On: 20081020
Tool: Bnd-<unknown version>
Implementation-Version: DevBuild
BundleActivator
 ■ In a war: ServletContextListener
 public interface ServletContextListener extends EventListener {
   void contextInitialized(ServletContextEvent event);
   void contextDestroyed(ServletContextEvent event);
 }

  web.xml
    <listener>
      <listener-class>com.colorado.MyListener</listener-class>
    </listener>



■ In a Bundle: BundleActivator
 public interface BundleActivator {
   void start(BundleContext bundleContext) throws Exception;
   void stop(BundleContext bundleContext) throws Exception;
 }

           MANIFEST.MF
           Bundle-Activator: com.colorado.MyActivator
BundleContext

 ■ The bundle context is the entry point:
   • registerService / getServiceReference =>
     to register / get services from registry
   • addBundleListener / addServiceListener =>
     to listens / extends the framework
   • even installBundle !
   • ... and more
Demo




■ Equinox demo... stay tuned...
Web Container

                           JARs         WAR


■ Services exported       Services
  with Spring/RPC
■ Services in same war
  can see each other     SpringRPC

■ Share the jars                       WEB Container
                                                 VM
                                     HTTP
Web Container

                   JARs              JARs


                  Services          Services
■ Cannot share
  jars
                 SpringRPC          SpringRPC
■ Cannot talk
  directly                                      WEB Container
                                                           VM

                             HTTP
OSGi container
                            Bundles


■ Bundles (jars) shared         Service Registry

■ Services shared
■ Dynamic replacement of
  bundles
                                             OSGi Container
                                                        VM
  • OSGi solves the container
    challenge
Distributed OSGi

 ■ OSGi is currently container centric


 ■ Next version (4.2) will introduce distributed
   OSGi


   • What do we do in the meantime ?
LinkedIn distributed OSGi

                      Bundles

                              Service
                      Service Registry
                              Registry



                                         C1
                                         VM




■ Service ‘red’ talks to service ‘green’ (local)
  • What happens if we move ‘green’ to a different
    container ?
LinkedIn distributed OSGi
                                     Bundles


                          Service
                          Registry
  Bundles
                                          C2
  Service Registry                        VM

                                     Bundles
                     C1
                     VM
                          Service
                          Registry

                                          C3
                                          VM
LinkedIn distributed OSGi
                                         Bundles


                                  Service
                                  Registry
  Bundles
                              2
                                              C2
  Service Registry                            VM

                     2
                                         Bundles
                         C1
                         VM
                                  Service
                                  Registry

                                              C3
                                              VM
LinkedIn distributed OSGi

                                         Bundles


                                  Service
                                  Registry
  Bundles
                              2
                                              C2
  Service Registry                            VM
                     2

                     3                   Bundles
                         C1
                         VM
                                  Service
                                  Registry
                              3
                                              C3
                                              VM
LinkedIn distributed OSGi
                                         Bundles


                                  Service
                                  Registry
  Bundles
                              2
                                              C2
  Service Registry                            VM
                     2

                     3                   Bundles
                         C1
                         VM
                                  Service
                                  Registry
                              3
                                              C3
                                              VM
LinkedIn distributed OSGi
 ■ no more N-1 / 1-N problem
   • libraries and services can be shared in 1
     container (mem. footprint smaller)
   • services shared across containers
 ■ transparent location to clients
   • no more configurations to change when
     adding/removing/moving services
 ■ software load balancer
   • much more flexible (handle version)
LB and version
                                         Bundles

  Bundles
                                  Service
                                  Registry
  Service Registry
                              2
                     2
                                              C2
                                              VM

                     3
                                         Bundles
                         C1
                         VM
                                  Service
                                  Registry
                              3
                                              C3
                                              VM
Everything is perfect...



■ ...Not really
  • OSGi has some problems
OSGi problems

■ OSGi is great, but tooling is not quite there
  yet
■ Not every lib is a bundle
■ OSGi was designed for embedded devices =>
  using it for server side is recent (but very
  active)
OSGi problems
■ OSGi is quite low level => but there is some
  work to ‘hide’ the complexity
  • spring DM (spring dynamic module)
  • multiple vendors containers
    ■   Spring DM Server, Glassfish, Infiniflow


■ OSGi is container centric, but next version
  will add distributed OSGi (although no
  support for LB)
OSGi problems (cont.)


 ■ version management can be nightmarish
   • Import-Package:
     com.linkedin.util;version=1.0.0
 ■ version=1.0.0 means [1.0.0, ∞)
 ■ should use at least:
    version=[1.0.0,2.0.0)
 ■ runtime is dynamic and can result in untested
   code being executed!
Runtime version problem




 ■ client1 and client2 uses Service 3.0.0
 ■ Dependencies are ‘loose’: [3.0.0, 4.0.0)
Runtime version problem




■ We upgrade client1 and service
■ client2 starts using green bundles
■ => Most likely untested
Runtime version solutions ?
 ■ A solution is to lock version:
   •   [1.0.0,1.0.0] => no slack
   •   [1.0.0,1.0.1) => tiny bit of slack for
       emergency mode
 ■ Does it really work ? spring 2.5.5 imports
   hibernate version [3.1,∞)
 ■ Can OSGi even resolve with everything
   locked down ?
Runtime version problem




■ With maximal lock-down, client2 cannot use
  the new service
Runtime version solutions ?




 ■ Services cannot talk to each other directly
   => need serialization for backward
   compatible services (dynamic proxy)
Despite problems...




■ ...OSGi and community moving in the right direction
Where are we ?
■ Bundle repository (big amount of work... in progress)
■ Use ivy/bnd for generating bundles
■ Evaluating container
  • Infiniflow (from Paremus) most likely the one
  • LinkedIn spring / SCA to deploy composites
■ Work on the load balancer/distribution (in progress)
■ Work on tooling / build integration (Sigil from
  Paremus)
■ Much much more to do...
Conclusion



 ■ Using OSGi... definitely!
 ■ But we do not want application developers
   to have to deal with it.
More information



 ■ Check my posts on the LinkedIn blog (OSGi
   series). More to come...

More Related Content

Viewers also liked

Acute pancreatitis
Acute pancreatitisAcute pancreatitis
Acute pancreatitis
Atit Ghoda
 
Cell block and liquid based cytology
Cell block and liquid based cytologyCell block and liquid based cytology
Cell block and liquid based cytology
Dr Neha Mahajan
 
Test driven development in C
Test driven development in CTest driven development in C
Test driven development in C
Amritayan Nayak
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
SlideShare
 

Viewers also liked (20)

DHS ICS Security Presentation
DHS ICS Security PresentationDHS ICS Security Presentation
DHS ICS Security Presentation
 
Fintech and Transformation of the Financial Services Industry
Fintech and Transformation of the Financial Services IndustryFintech and Transformation of the Financial Services Industry
Fintech and Transformation of the Financial Services Industry
 
Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.Dear NSA, let me take care of your slides.
Dear NSA, let me take care of your slides.
 
What I Carry: 10 Tools for Success
What I Carry: 10 Tools for SuccessWhat I Carry: 10 Tools for Success
What I Carry: 10 Tools for Success
 
Anatomy of maxilla and mandible
Anatomy of maxilla and mandibleAnatomy of maxilla and mandible
Anatomy of maxilla and mandible
 
Acute pancreatitis
Acute pancreatitisAcute pancreatitis
Acute pancreatitis
 
Cell block and liquid based cytology
Cell block and liquid based cytologyCell block and liquid based cytology
Cell block and liquid based cytology
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
 
Test driven development in C
Test driven development in CTest driven development in C
Test driven development in C
 
isolation
isolationisolation
isolation
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
A Guide to SlideShare Analytics - Excerpts from Hubspot's Step by Step Guide ...
 
Operating Systems - File Management
Operating Systems -  File ManagementOperating Systems -  File Management
Operating Systems - File Management
 
2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare2015 Upload Campaigns Calendar - SlideShare
2015 Upload Campaigns Calendar - SlideShare
 
What to Upload to SlideShare
What to Upload to SlideShareWhat to Upload to SlideShare
What to Upload to SlideShare
 
The Ultimate Guide to Creating Visually Appealing Content
The Ultimate Guide to Creating Visually Appealing ContentThe Ultimate Guide to Creating Visually Appealing Content
The Ultimate Guide to Creating Visually Appealing Content
 

Similar to Building LinkedIn's Next Generation Architecture with OSGi

Am 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-finalAm 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-final
OpenCity Community
 
Microsoft Silverlight 2
Microsoft Silverlight 2Microsoft Silverlight 2
Microsoft Silverlight 2
David Chou
 

Similar to Building LinkedIn's Next Generation Architecture with OSGi (20)

Dualtec Open Stack Meeting: Agilidade + Cloud
Dualtec Open Stack Meeting:  Agilidade + CloudDualtec Open Stack Meeting:  Agilidade + Cloud
Dualtec Open Stack Meeting: Agilidade + Cloud
 
Learn OpenStack from trystack.cn ——Folsom in practice
Learn OpenStack from trystack.cn  ——Folsom in practiceLearn OpenStack from trystack.cn  ——Folsom in practice
Learn OpenStack from trystack.cn ——Folsom in practice
 
Hyper-V Networking
Hyper-V NetworkingHyper-V Networking
Hyper-V Networking
 
What can you do with lambda in 2020
What can you do with lambda in 2020What can you do with lambda in 2020
What can you do with lambda in 2020
 
Am 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-finalAm 04 track1--salvatore orlando--openstack-apac-2012-final
Am 04 track1--salvatore orlando--openstack-apac-2012-final
 
Windows Sql Azure Cloud Computing Platform
Windows Sql Azure Cloud Computing PlatformWindows Sql Azure Cloud Computing Platform
Windows Sql Azure Cloud Computing Platform
 
GlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium ParisGlassFish v3 Prelude Aquarium Paris
GlassFish v3 Prelude Aquarium Paris
 
2009 Q2 WSO2 Technical Update
2009 Q2 WSO2 Technical Update2009 Q2 WSO2 Technical Update
2009 Q2 WSO2 Technical Update
 
Hybrid Cloud Networking
Hybrid Cloud NetworkingHybrid Cloud Networking
Hybrid Cloud Networking
 
Windows offloaded data_transfer_steve_olsson
Windows offloaded data_transfer_steve_olssonWindows offloaded data_transfer_steve_olsson
Windows offloaded data_transfer_steve_olsson
 
z/VM 6.2: Increasing the Endless Possibilities of Virtualization
z/VM 6.2: Increasing the Endless Possibilities of Virtualizationz/VM 6.2: Increasing the Endless Possibilities of Virtualization
z/VM 6.2: Increasing the Endless Possibilities of Virtualization
 
Prodware wa college - marcel meijer
Prodware   wa college - marcel meijerProdware   wa college - marcel meijer
Prodware wa college - marcel meijer
 
synquery platform
synquery platformsynquery platform
synquery platform
 
Balconies, Patios, Terraces, and Bridges. Architectural approaches for moving...
Balconies, Patios, Terraces, and Bridges. Architectural approaches for moving...Balconies, Patios, Terraces, and Bridges. Architectural approaches for moving...
Balconies, Patios, Terraces, and Bridges. Architectural approaches for moving...
 
Windows Server 2012 Hyper-V Networking Evolved
Windows Server 2012 Hyper-V Networking Evolved Windows Server 2012 Hyper-V Networking Evolved
Windows Server 2012 Hyper-V Networking Evolved
 
K8S_Learning_Notebook_01
K8S_Learning_Notebook_01K8S_Learning_Notebook_01
K8S_Learning_Notebook_01
 
Decomposing applications for deployability and scalability #springone2gx #s12gx
Decomposing applications for deployability and scalability #springone2gx #s12gxDecomposing applications for deployability and scalability #springone2gx #s12gx
Decomposing applications for deployability and scalability #springone2gx #s12gx
 
DockerCon SF 2015: Docker at Lyft
DockerCon SF 2015: Docker at LyftDockerCon SF 2015: Docker at Lyft
DockerCon SF 2015: Docker at Lyft
 
Microsoft Silverlight 2
Microsoft Silverlight 2Microsoft Silverlight 2
Microsoft Silverlight 2
 
Windows Azure Design Patterns
Windows Azure Design PatternsWindows Azure Design Patterns
Windows Azure Design Patterns
 

More from LinkedIn

More from LinkedIn (20)

How LinkedIn is Transforming Businesses
How LinkedIn is Transforming BusinessesHow LinkedIn is Transforming Businesses
How LinkedIn is Transforming Businesses
 
Networking on LinkedIn 101
Networking on LinkedIn 101Networking on LinkedIn 101
Networking on LinkedIn 101
 
5 تحديثات على ملفك في 5 دقائق
5 تحديثات على ملفك في 5 دقائق5 تحديثات على ملفك في 5 دقائق
5 تحديثات على ملفك في 5 دقائق
 
5 LinkedIn Profile Updates in 5 Minutes
5 LinkedIn Profile Updates in 5 Minutes5 LinkedIn Profile Updates in 5 Minutes
5 LinkedIn Profile Updates in 5 Minutes
 
The Student's Guide to LinkedIn
The Student's Guide to LinkedInThe Student's Guide to LinkedIn
The Student's Guide to LinkedIn
 
The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017The Top Skills That Can Get You Hired in 2017
The Top Skills That Can Get You Hired in 2017
 
Accelerating LinkedIn’s Vision Through Innovation
Accelerating LinkedIn’s Vision Through InnovationAccelerating LinkedIn’s Vision Through Innovation
Accelerating LinkedIn’s Vision Through Innovation
 
How To Tell Your #workstory
How To Tell Your #workstoryHow To Tell Your #workstory
How To Tell Your #workstory
 
LinkedIn Q1 2016 Earnings Call
LinkedIn Q1 2016 Earnings CallLinkedIn Q1 2016 Earnings Call
LinkedIn Q1 2016 Earnings Call
 
The 2016 LinkedIn Job Search Guide
The 2016 LinkedIn Job Search GuideThe 2016 LinkedIn Job Search Guide
The 2016 LinkedIn Job Search Guide
 
LinkedIn Q4 2015 Earnings Call
LinkedIn Q4 2015 Earnings CallLinkedIn Q4 2015 Earnings Call
LinkedIn Q4 2015 Earnings Call
 
Banish The Buzzwords
Banish The BuzzwordsBanish The Buzzwords
Banish The Buzzwords
 
LinkedIn Bring In Your Parents Day 2015 - Your Parents' Best Career Advice
LinkedIn Bring In Your Parents Day 2015 - Your Parents' Best Career AdviceLinkedIn Bring In Your Parents Day 2015 - Your Parents' Best Career Advice
LinkedIn Bring In Your Parents Day 2015 - Your Parents' Best Career Advice
 
LinkedIn Q3 2015 Earnings Call
LinkedIn Q3 2015 Earnings CallLinkedIn Q3 2015 Earnings Call
LinkedIn Q3 2015 Earnings Call
 
LinkedIn Economic Graph Research: Toronto
LinkedIn Economic Graph Research: TorontoLinkedIn Economic Graph Research: Toronto
LinkedIn Economic Graph Research: Toronto
 
Freelancers Are LinkedIn Power Users [Infographic]
Freelancers Are LinkedIn Power Users [Infographic]Freelancers Are LinkedIn Power Users [Infographic]
Freelancers Are LinkedIn Power Users [Infographic]
 
Top Industries for Freelancers on LinkedIn [Infographic]
Top Industries for Freelancers on LinkedIn [Infographic]Top Industries for Freelancers on LinkedIn [Infographic]
Top Industries for Freelancers on LinkedIn [Infographic]
 
LinkedIn Quiz: Which Parent Are You When It Comes to Helping Guide Your Child...
LinkedIn Quiz: Which Parent Are You When It Comes to Helping Guide Your Child...LinkedIn Quiz: Which Parent Are You When It Comes to Helping Guide Your Child...
LinkedIn Quiz: Which Parent Are You When It Comes to Helping Guide Your Child...
 
LinkedIn Connect to Opportunity™ -- Stories of Discovery
LinkedIn Connect to Opportunity™ -- Stories of DiscoveryLinkedIn Connect to Opportunity™ -- Stories of Discovery
LinkedIn Connect to Opportunity™ -- Stories of Discovery
 
LinkedIn Q2 2015 Earnings Call
LinkedIn Q2 2015 Earnings CallLinkedIn Q2 2015 Earnings Call
LinkedIn Q2 2015 Earnings Call
 

Recently uploaded

Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
Overkill Security
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
FIDO Alliance
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 

Building LinkedIn's Next Generation Architecture with OSGi

  • 1. OSGi Building LinkedIn's Next Generation Architecture with OSGI Yan Pujante Distinguished Software Engineer Member of the Founding Team @ LinkedIn ypujante@linkedin.com http://www.linkedin.com/in/yan
  • 2. Background ■ LinkedIn created in 03/2003 • close to 30M members • profitable with 5 revenue lines • HQ in Mountain View (400 employees) ■ Technologies • 2 datacenters (~ 600 machines) • SOA, java, tomcat, spring framework, http, Oracle, MySQL, servlets, jsp, graph, OSGi... • dev on MacOS X, prod on Solaris
  • 3. Challenges ■ Growing engineering team on a monolithic code base (still modular) ■ Growing product team wanting more and more feature, faster ■ Growing operations team deploying more and more servers
  • 4. Challenges (SOA in dev) Front-End Back-End X 1 3 webapp Z 2 Y webapp 4 M N webapp jetty (1) webapp P N R webapp webapp webapp tomcat jetty (2) ■ Front-end: many BL services in one webapp (in tomcat) ■ Back-end: many wars in 5 containers (jetty) with 1 service per war ■ Note that prod and dev are different
  • 5. Container Challenge ■ 1 war with N services • does not scale for dev (conflicts, monolithic...) ■ N wars with 1 service • does not scale from a container point of view (no shared jars) ■ Can add containers but only 12Gb of RAM :(
  • 6. Challenges (SOA in prod) ■ Upgrading back-end service to new version requires downtime • Hardware LB does not account for version ■ Upgrading front-end service to new version requires redeploy • N services in 1 war ■ Adding new back-end service painful • lots of manual configuration (LB, front- end...)
  • 7. Solution: OSGi ■ Belief that OSGi is one of the tools that will help us address those challenges Why OSGi?
  • 8. OSGi intro ■ OSGi means “Open Services Gateway initiative” ■ OSGi is a spec with several implementations • Equinox (eclipse!) • Knoplerfish • Felix (Apache)
  • 9. OSGi intro (cont.) ■ OSGi has some very good properties • Smart class loading => multiple versions jars ok • Highly dynamic => deploy / undeploy built in • Services registry • Highly extensible / configurable ■ OSGi bundle = Jar File with OSGi manifests
  • 10. OSGi bundle Specification-Title: Colorado Software Summit 2008 Hello Wolrd Client Bundle-Activator: com.linkedin.colorado.helloworld.client.HelloWorldClientActivator Import-Package: com.linkedin.colorado.helloworld.api;version=quot;[1.0.0,1.0.1)quot;, com.linkedin.colorado.helloworld.client;version=quot;[1.0.0,1.0.1)quot;, org.osgi.framework;version=quot;[1.4.0,1.4.1)quot; Export-Package: com.linkedin.colorado.helloworld.client;version=quot;1.0.0quot; Bundle-Version: 1.0.0 Bundle-Name: colorado-helloworld-client Bundle-ManifestVersion: 2 Bundle-SymbolicName: colorado-helloworld-client Bnd-LastModified: 1224557973403 Generated-On: 20081020 Tool: Bnd-<unknown version> Implementation-Version: DevBuild
  • 11. BundleActivator ■ In a war: ServletContextListener public interface ServletContextListener extends EventListener { void contextInitialized(ServletContextEvent event); void contextDestroyed(ServletContextEvent event); } web.xml <listener> <listener-class>com.colorado.MyListener</listener-class> </listener> ■ In a Bundle: BundleActivator public interface BundleActivator { void start(BundleContext bundleContext) throws Exception; void stop(BundleContext bundleContext) throws Exception; } MANIFEST.MF Bundle-Activator: com.colorado.MyActivator
  • 12. BundleContext ■ The bundle context is the entry point: • registerService / getServiceReference => to register / get services from registry • addBundleListener / addServiceListener => to listens / extends the framework • even installBundle ! • ... and more
  • 13. Demo ■ Equinox demo... stay tuned...
  • 14. Web Container JARs WAR ■ Services exported Services with Spring/RPC ■ Services in same war can see each other SpringRPC ■ Share the jars WEB Container VM HTTP
  • 15. Web Container JARs JARs Services Services ■ Cannot share jars SpringRPC SpringRPC ■ Cannot talk directly WEB Container VM HTTP
  • 16. OSGi container Bundles ■ Bundles (jars) shared Service Registry ■ Services shared ■ Dynamic replacement of bundles OSGi Container VM • OSGi solves the container challenge
  • 17. Distributed OSGi ■ OSGi is currently container centric ■ Next version (4.2) will introduce distributed OSGi • What do we do in the meantime ?
  • 18. LinkedIn distributed OSGi Bundles Service Service Registry Registry C1 VM ■ Service ‘red’ talks to service ‘green’ (local) • What happens if we move ‘green’ to a different container ?
  • 19. LinkedIn distributed OSGi Bundles Service Registry Bundles C2 Service Registry VM Bundles C1 VM Service Registry C3 VM
  • 20. LinkedIn distributed OSGi Bundles Service Registry Bundles 2 C2 Service Registry VM 2 Bundles C1 VM Service Registry C3 VM
  • 21. LinkedIn distributed OSGi Bundles Service Registry Bundles 2 C2 Service Registry VM 2 3 Bundles C1 VM Service Registry 3 C3 VM
  • 22. LinkedIn distributed OSGi Bundles Service Registry Bundles 2 C2 Service Registry VM 2 3 Bundles C1 VM Service Registry 3 C3 VM
  • 23. LinkedIn distributed OSGi ■ no more N-1 / 1-N problem • libraries and services can be shared in 1 container (mem. footprint smaller) • services shared across containers ■ transparent location to clients • no more configurations to change when adding/removing/moving services ■ software load balancer • much more flexible (handle version)
  • 24. LB and version Bundles Bundles Service Registry Service Registry 2 2 C2 VM 3 Bundles C1 VM Service Registry 3 C3 VM
  • 25. Everything is perfect... ■ ...Not really • OSGi has some problems
  • 26. OSGi problems ■ OSGi is great, but tooling is not quite there yet ■ Not every lib is a bundle ■ OSGi was designed for embedded devices => using it for server side is recent (but very active)
  • 27. OSGi problems ■ OSGi is quite low level => but there is some work to ‘hide’ the complexity • spring DM (spring dynamic module) • multiple vendors containers ■ Spring DM Server, Glassfish, Infiniflow ■ OSGi is container centric, but next version will add distributed OSGi (although no support for LB)
  • 28. OSGi problems (cont.) ■ version management can be nightmarish • Import-Package: com.linkedin.util;version=1.0.0 ■ version=1.0.0 means [1.0.0, ∞) ■ should use at least: version=[1.0.0,2.0.0) ■ runtime is dynamic and can result in untested code being executed!
  • 29. Runtime version problem ■ client1 and client2 uses Service 3.0.0 ■ Dependencies are ‘loose’: [3.0.0, 4.0.0)
  • 30. Runtime version problem ■ We upgrade client1 and service ■ client2 starts using green bundles ■ => Most likely untested
  • 31. Runtime version solutions ? ■ A solution is to lock version: • [1.0.0,1.0.0] => no slack • [1.0.0,1.0.1) => tiny bit of slack for emergency mode ■ Does it really work ? spring 2.5.5 imports hibernate version [3.1,∞) ■ Can OSGi even resolve with everything locked down ?
  • 32. Runtime version problem ■ With maximal lock-down, client2 cannot use the new service
  • 33. Runtime version solutions ? ■ Services cannot talk to each other directly => need serialization for backward compatible services (dynamic proxy)
  • 34. Despite problems... ■ ...OSGi and community moving in the right direction
  • 35. Where are we ? ■ Bundle repository (big amount of work... in progress) ■ Use ivy/bnd for generating bundles ■ Evaluating container • Infiniflow (from Paremus) most likely the one • LinkedIn spring / SCA to deploy composites ■ Work on the load balancer/distribution (in progress) ■ Work on tooling / build integration (Sigil from Paremus) ■ Much much more to do...
  • 36. Conclusion ■ Using OSGi... definitely! ■ But we do not want application developers to have to deal with it.
  • 37. More information ■ Check my posts on the LinkedIn blog (OSGi series). More to come...