SlideShare uma empresa Scribd logo
1 de 23
Enterprise	
  OSGi	
  at	
  eBay	
  
	
  


Tony	
  Ng	
  
Director	
  of	
  Engineering	
  
May,	
  2012	
  
Agenda	
  

•  About	
  eBay	
  
•  Why	
  OSGi	
  
•  How	
  are	
  we	
  using	
  OSGi	
  
•  Lessons	
  learned	
  




                                           2	
  
$68.6
billion
In merchandise sold in 2011




                              3	
  
eBay	
  at	
  Internet	
  Scale	
  

•  100+	
  million	
  acHve	
  buyers	
  and	
  sellers	
  worldwide	
  
•  250	
  million	
  queries	
  each	
  day	
  to	
  our	
  search	
  engine	
  
•  300+	
  million	
  items	
  in	
  50,000	
  categories	
  
•  39	
  countries	
  and	
  10	
  languages	
  	
  
•  9	
  petabytes	
  of	
  data	
  
•  2	
  billion	
  page	
  views	
  each	
  day	
  
•  75	
  billion	
  database	
  calls	
  
                                            4	
  
Challenges	
  for	
  our	
  Code	
  Base	
  
•  ~	
  44	
  million	
  of	
  lines	
  of	
  code	
  and	
  
   growing	
  
       –  O(1,000)	
  of	
  jars	
  
       –  O(10,000)	
  of	
  Java	
  packages	
                 knowledge               complexity


       –  O(100,000)	
  of	
  Java	
  classes	
  

•  Code	
  is	
  monolithic	
  -­‐	
  many	
  
   dependencies	
  and	
  Hght	
  coupling	
  
•  Simple	
  code	
  change	
  ripples	
  
   throughout	
  the	
  system	
                                            code size


•  Developers	
  slow	
  down	
  and	
  
   become	
  risk	
  averse	
  

                                                       5


	
  
Next	
  Gen	
  Pla>orm	
  Guiding	
  Principles	
  

•  Modularity	
  is	
  first	
  class	
  design	
  concept	
  
•  Technology	
  refresh:	
  prefer	
  open	
  source	
  technologies	
  
•  Easy	
  integraHon	
  of	
  mulHple	
  applicaHon	
  frameworks	
  
   and	
  libraries	
  
•  Fast	
  development	
  iteraHons	
  
•  Team	
  autonomy	
  
•  OpHmize	
  end-­‐to-­‐end	
  development	
  cycle	
  

                                       6	
  
Next	
  Gen	
  Stack	
  
                                           Applications (ebay.com, Mobile)
                             E-commerce Services (Search, Item, Cart, Checkout etc)
   Maven / Eclipse IDE




                            Security          Resource            Metadata         Logging
                         Experimentation       Config           Localization      Tracking

                         Data Access          Svcs Fwk          Orchestration      JS Fwk




                                                                                                 Cloud
                          HTML5/CSS          Spring MVC            JQuery            JSP
                             OSGi             Spring DI            Servlet      Init / Handler

                                           Container (Geronimo / WAS CE)

                                                          JVM

                                              Operating System (Linux)

               Core platform               Platform frameworks          Application & services
Our	
  Goals	
  with	
  Modularity	
  

•  Tame	
  complexity	
  	
  
•  Organize	
  our	
  code	
  base	
  in	
  loose	
  coupling	
  fashion	
  
•  Establish	
  clear	
  code	
  ownership,	
  boundaries	
  and	
  
   dependencies	
  
•  Allow	
  different	
  components	
  (and	
  teams)	
  evolve	
  at	
  
   different	
  speeds	
  
•  Increase	
  development	
  agility	
  


                                       8
Why	
  OSGi	
  
Goal	
                                                              How	
  OSGi	
  Helps	
  
Hide	
  implementaEon	
  details	
                                  Export-­‐Package	
  

Accurate	
  understanding	
  and	
  enforcement	
  of	
             Bundle	
  manifest	
  
dependencies	
                                                      (Imports	
  &	
  Exports)	
  
                                                                    SemanEc	
  versioning	
  
Faster	
  iteraEon	
  for	
  code	
  change	
                       Update	
  and	
  restart	
  
                                                                    affected	
  bundles	
  only	
  


Isolate	
  and	
  run	
  mulEple	
  versions	
  of	
  the	
  same	
   Support	
  for	
  mulEple	
  
modules	
                                                             versions	
  

Technology	
  maturity	
                                            Robust	
  community	
  and	
  
                                                                    support	
  


                                                   9	
  
Top	
  Level	
  ConsideraEons	
  

•  What	
  OSGi	
  features	
  to	
  use	
  
   –  Focus	
  on	
  modularity	
  

•  End-­‐to-­‐end	
  development	
  lifecycle	
  
   –  IDE	
  and	
  non-­‐IDE	
  paths	
  
   –  Build,	
  repository	
  and	
  tool	
  integraHon	
  

•  ExisHng	
  code	
  migraHon	
  
•  Developer	
  learning	
  curve	
  


                                           10	
  
Bundle	
  Guidelines	
  

•  Create	
  from	
  boaom	
  up	
  
•  Sound	
  architecture	
  boundary	
  
•  Free	
  of	
  split	
  packages	
  
•  SemanHc	
  versioning	
  
•  Export	
  package	
  versions	
  should	
  match	
  bundle	
  version	
  
•  Use	
  Import-­‐Package	
  rather	
  than	
  Require-­‐Bundle	
  
    –  With	
  sensible	
  version	
  ranges	
  

•  Address	
  dynamic	
  classloading	
  

                                               11	
  
Dynamic	
  Classloading	
  

•  ProblemaHc	
  usage	
  
   –  Class.forName()	
  
   –  ClassLoader	
  loadClass	
  or	
  getResource	
  
   –  Thread	
  context	
  class	
  loader	
  

•  Short-­‐term	
  fix	
  
   –  DynamicImport-­‐Package:	
  *	
  

•  Long-­‐term	
  fix	
  
   –  Refactor	
  code	
  (if	
  possible)	
  so	
  client	
  can	
  pass	
  class	
  or	
  
      classloader	
  to	
  framework	
  

                                                 12	
  
Bundle	
  CreaEon	
  


  POM

               Maven    Bundle (Jar)
                        with            Global
                        OSGi            Maven
               Bundle   Manifest       Repository
 Java source   Plugin
 files




                          13	
  
OSGi	
  Manifest	
  GeneraEon	
  

•  Maven	
  arHfact	
  version	
  ==	
  bundle	
  version	
  ==	
  export	
  
   packages	
  version	
  
•  Follow	
  semanHc	
  versioning	
  (semver.org)	
  
•  Scan	
  code	
  (BND)	
  to	
  derive	
  import	
  and	
  export	
  packages	
  
•  Use	
  major	
  version	
  matching	
  for	
  Import-­‐Packages:	
  
   –  Ex:	
  [1.1.2,2.0)	
  

•  By	
  default,	
  all	
  packages	
  are	
  exported	
  except	
  
   –  impl.*	
  and	
  internal.*	
  


                                          14	
  
Two-­‐Stage	
  Dependency	
  Wiring	
  
  Maven Repo
                                                                       OSGi wiring
    A.jar; v1            Maven
                                         A.jar; v1                     based on
    A.jar; v2                            A.jar; v2                     bundle
    B.jar; v1                            B.jar; v2                     subset
    B.jar; v2            POM
    C.jar; v3         Dependency                                       a.*; v2
        .                                                              b.*; v2
        .
        .

(all bundles, all                        Bundle Subset                   Runtime
versions)

 •  Benefits	
  
     –  Smaller	
  bundle	
  set	
  
     –  IsolaHon	
  from	
  changes	
  in	
  global	
  repository	
  (reproducibility)	
  
                                           15	
  
App	
  Development	
  Environment	
  

•  Eclipse	
  Helios	
  
   –  Geronimo	
  Eclipse	
  Plugin	
  
   –  Apache	
  Felix	
  Maven	
  Bundle	
  Plugin	
  
   –  OSGi	
  tooling	
  plugin	
  
   –  Standard	
  plugins	
  for	
  Maven	
  and	
  Git	
  integraHon	
  

•  Others	
  
   –  Maven	
  archetypes	
  for	
  app	
  /	
  bundle	
  project	
  creaHon	
  
   –  Jenkins	
  CI	
  



                                           16	
  
ApplicaEon	
  Development	
  

•  ApplicaHons	
  packaged	
  as	
  EBA	
  
•  Build	
  Hme:	
  Plajorm	
  parent	
  POM	
  
   –  Pre-­‐defined	
  plajorm	
  bundles	
  dependencies.	
  Updated	
  
      regularly.	
  
   –  App	
  developers	
  can	
  extend	
  /	
  override	
  

•  RaHonale	
  
   –  CerHficaHon	
  across	
  the	
  specific	
  versions	
  
   –  Ensure	
  applicaHon	
  progresses	
  towards	
  newer	
  versions	
  
   –  SHll	
  maintain	
  ability	
  to	
  override	
  on	
  a	
  per	
  app	
  basis	
  

                                             17	
  
ApplicaEon	
  Deployment	
  

EBA
Application WAR
                                          VM / Physical
All dependent bundles                     Host
Local OBR xml
Activation scripts                            QA

                            Cloud
                        Deployment
Configuration Files     Infrastructure
                                          VM / Physical
                                          Host
Container


JVM                                       VM / Physical
                                          Host


App Deployment Unit                      Production
                             18	
  
ExisEng	
  Code	
  MigraEon	
  
•  Incrementally	
  migrate	
  applicaHons	
  to	
  new	
  stack	
  
•  Most	
  efforts	
  spent	
  in	
  migraHng	
  exisHng	
  library	
  jars	
  
•  Built	
  tool	
  to	
  detect	
  duplicate	
  class	
  /	
  split	
  packages	
  across	
  
   jars	
  
    –  Merge	
  the	
  jars	
  
    –  Manual	
  refactoring	
  
•  Deal	
  with	
  class	
  loading	
  code	
  
•  Ensure	
  transiHve	
  dependencies	
  are	
  “bundle-­‐ized”	
  
•  Need	
  to	
  migrate	
  third-­‐party	
  libraries	
  if	
  they	
  are	
  not	
  OSGi-­‐
   enabled	
  

                                             19	
  
Issues	
  We	
  Encountered	
  

•  Steep	
  learning	
  curve	
  for	
  developers	
  
•  Build	
  tools	
  integraHon	
  
•  Debugging	
  resoluHon	
  problems	
  
•  IniHalizaHon	
  ordering	
  of	
  bundles	
  
•  ImporHng	
  bundle	
  containing	
  only	
  non-­‐Java	
  resources	
  
•  Bundle	
  space	
  isolaHon	
  between	
  container	
  and	
  
   applicaHons	
  
	
  
                                      20	
  
What	
  Works	
  Well	
  

•  OSGi	
  modularity	
  enforcement	
  leads	
  to	
  beaer	
  code	
  
   organizaHon	
  and	
  reuse	
  
•  Explicit	
  versioning	
  and	
  dependency	
  management	
  
•  Solid	
  end-­‐to-­‐end	
  development	
  experience	
  with	
  
   proper	
  tooling	
  integraHon	
  
•  Bundles	
  working	
  in	
  both	
  OSGi	
  and	
  non-­‐OSGi	
  
   environments	
  
•  Dynamic	
  updates	
  
                                       21	
  
Lessons	
  Learned	
  

•  Need	
  a	
  few	
  in-­‐house	
  OSGi	
  experts	
  
       –  Evangelism	
  
       –  Best	
  pracHces	
  
       –  Support	
  
•  Reduce	
  direct	
  exposure	
  to	
  OSGi	
  API	
  for	
  developers	
  
•  Important	
  to	
  prescribe	
  end-­‐to-­‐end	
  development	
  lifecycle	
  
•  Some	
  automaHon	
  to	
  support	
  migraHon	
  of	
  exisHng	
  code	
  
   base	
  
•  Take	
  small	
  steps	
  

                                            22




	
  
Enterprise OSGi at eBay

Mais conteúdo relacionado

Mais procurados

GR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting Grails
GR8Conf
 
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5
ITCamp
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
Atlassian
 

Mais procurados (20)

GlassFish 3.1 at JCertif 2011
GlassFish 3.1 at JCertif 2011GlassFish 3.1 at JCertif 2011
GlassFish 3.1 at JCertif 2011
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
 
AD112 -- Development and Deployment of Lotus Product Documentation Wikis
AD112 -- Development and Deployment of Lotus Product Documentation WikisAD112 -- Development and Deployment of Lotus Product Documentation Wikis
AD112 -- Development and Deployment of Lotus Product Documentation Wikis
 
Ad106 - XPages Just Keep Getting Better
Ad106 - XPages Just Keep Getting BetterAd106 - XPages Just Keep Getting Better
Ad106 - XPages Just Keep Getting Better
 
Mavenizing your Liferay project
Mavenizing your Liferay projectMavenizing your Liferay project
Mavenizing your Liferay project
 
GR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting GrailsGR8Conf 2011: Adopting Grails
GR8Conf 2011: Adopting Grails
 
Ad102 - Extreme Makeover -- LotusScript and Java Editor Edition
Ad102 - Extreme Makeover -- LotusScript and Java Editor EditionAd102 - Extreme Makeover -- LotusScript and Java Editor Edition
Ad102 - Extreme Makeover -- LotusScript and Java Editor Edition
 
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
Creating Quick and Powerful Web applications with Oracle, GlassFish and NetBe...
 
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
The Java EE 7 Platform: Developing for the Cloud  (FISL 12)The Java EE 7 Platform: Developing for the Cloud  (FISL 12)
The Java EE 7 Platform: Developing for the Cloud (FISL 12)
 
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5
ITCamp 2011 - Alessandro Pilotti - Optimizing ASPNet and PHP apps on IIS 7.5
 
Red Hat Open Day JBoss Fuse
Red Hat Open Day JBoss FuseRed Hat Open Day JBoss Fuse
Red Hat Open Day JBoss Fuse
 
The State of Java under Oracle at JCertif 2011
The State of Java under Oracle at JCertif 2011The State of Java under Oracle at JCertif 2011
The State of Java under Oracle at JCertif 2011
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
 
Java keynote preso
Java keynote presoJava keynote preso
Java keynote preso
 
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
AD113 -- IBM Lotus Notes Discussion Template: Next Generation and Other OpenN...
 
Java modules
Java modulesJava modules
Java modules
 
Java EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The CloudJava EE Arquillian Testing with Docker & The Cloud
Java EE Arquillian Testing with Docker & The Cloud
 
Concierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded DevicesConcierge - Bringing OSGi (back) to Embedded Devices
Concierge - Bringing OSGi (back) to Embedded Devices
 
Subversion Edge Overview
Subversion Edge OverviewSubversion Edge Overview
Subversion Edge Overview
 

Semelhante a Enterprise OSGi at eBay

Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
njbartlett
 
OSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesOSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application Bundles
Rob Davies
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
Igor Anishchenko
 
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
10322210023
 

Semelhante a Enterprise OSGi at eBay (20)

Monoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is ModularityMonoliths are so 2001 – What you need is Modularity
Monoliths are so 2001 – What you need is Modularity
 
OSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 IndiaOSGi and Java EE in GlassFish - Tech Days 2010 India
OSGi and Java EE in GlassFish - Tech Days 2010 India
 
Jax london 2011
Jax london 2011Jax london 2011
Jax london 2011
 
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil BartlettJava Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
Java Core | Java 8 and OSGi Modularisation | Tim Ellison & Neil Bartlett
 
OSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worldsOSGi & Java EE in GlassFish - Best of both worlds
OSGi & Java EE in GlassFish - Best of both worlds
 
OSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application BundlesOSGi made simple - Fuse Application Bundles
OSGi made simple - Fuse Application Bundles
 
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
OSGi & Java EE: A hybrid approach to Enterprise Java Application Development,...
 
Introducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management PlatformIntroducing Apricot, The Eclipse Content Management Platform
Introducing Apricot, The Eclipse Content Management Platform
 
OSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFishOSGi-enabled Java EE applications in GlassFish
OSGi-enabled Java EE applications in GlassFish
 
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFishOSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFish
 
Eclipse Apricot
Eclipse ApricotEclipse Apricot
Eclipse Apricot
 
Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)Jalimo Slides Linuxtag2007 (English)
Jalimo Slides Linuxtag2007 (English)
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
Overview of PaaS: Java experience
Overview of PaaS: Java experienceOverview of PaaS: Java experience
Overview of PaaS: Java experience
 
Cont0519
Cont0519Cont0519
Cont0519
 
A Platform Approach to Enterprise Content Management with Eclipse Apricot, CM...
A Platform Approach to Enterprise Content Management with Eclipse Apricot, CM...A Platform Approach to Enterprise Content Management with Eclipse Apricot, CM...
A Platform Approach to Enterprise Content Management with Eclipse Apricot, CM...
 
Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)Apache Drill (ver. 0.2)
Apache Drill (ver. 0.2)
 
Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -Create *real* modular Java applications - a brief introduction -
Create *real* modular Java applications - a brief introduction -
 
MWLUG - Universal Java
MWLUG  -  Universal JavaMWLUG  -  Universal Java
MWLUG - Universal Java
 
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
1. JAVA_Module_1-edited - AJIN ABRAHAM.pptx.pdf
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Enterprise OSGi at eBay

  • 1. Enterprise  OSGi  at  eBay     Tony  Ng   Director  of  Engineering   May,  2012  
  • 2. Agenda   •  About  eBay   •  Why  OSGi   •  How  are  we  using  OSGi   •  Lessons  learned   2  
  • 4. eBay  at  Internet  Scale   •  100+  million  acHve  buyers  and  sellers  worldwide   •  250  million  queries  each  day  to  our  search  engine   •  300+  million  items  in  50,000  categories   •  39  countries  and  10  languages     •  9  petabytes  of  data   •  2  billion  page  views  each  day   •  75  billion  database  calls   4  
  • 5. Challenges  for  our  Code  Base   •  ~  44  million  of  lines  of  code  and   growing   –  O(1,000)  of  jars   –  O(10,000)  of  Java  packages   knowledge complexity –  O(100,000)  of  Java  classes   •  Code  is  monolithic  -­‐  many   dependencies  and  Hght  coupling   •  Simple  code  change  ripples   throughout  the  system   code size •  Developers  slow  down  and   become  risk  averse   5  
  • 6. Next  Gen  Pla>orm  Guiding  Principles   •  Modularity  is  first  class  design  concept   •  Technology  refresh:  prefer  open  source  technologies   •  Easy  integraHon  of  mulHple  applicaHon  frameworks   and  libraries   •  Fast  development  iteraHons   •  Team  autonomy   •  OpHmize  end-­‐to-­‐end  development  cycle   6  
  • 7. Next  Gen  Stack   Applications (ebay.com, Mobile) E-commerce Services (Search, Item, Cart, Checkout etc) Maven / Eclipse IDE Security Resource Metadata Logging Experimentation Config Localization Tracking Data Access Svcs Fwk Orchestration JS Fwk Cloud HTML5/CSS Spring MVC JQuery JSP OSGi Spring DI Servlet Init / Handler Container (Geronimo / WAS CE) JVM Operating System (Linux) Core platform Platform frameworks Application & services
  • 8. Our  Goals  with  Modularity   •  Tame  complexity     •  Organize  our  code  base  in  loose  coupling  fashion   •  Establish  clear  code  ownership,  boundaries  and   dependencies   •  Allow  different  components  (and  teams)  evolve  at   different  speeds   •  Increase  development  agility   8
  • 9. Why  OSGi   Goal   How  OSGi  Helps   Hide  implementaEon  details   Export-­‐Package   Accurate  understanding  and  enforcement  of   Bundle  manifest   dependencies   (Imports  &  Exports)   SemanEc  versioning   Faster  iteraEon  for  code  change   Update  and  restart   affected  bundles  only   Isolate  and  run  mulEple  versions  of  the  same   Support  for  mulEple   modules   versions   Technology  maturity   Robust  community  and   support   9  
  • 10. Top  Level  ConsideraEons   •  What  OSGi  features  to  use   –  Focus  on  modularity   •  End-­‐to-­‐end  development  lifecycle   –  IDE  and  non-­‐IDE  paths   –  Build,  repository  and  tool  integraHon   •  ExisHng  code  migraHon   •  Developer  learning  curve   10  
  • 11. Bundle  Guidelines   •  Create  from  boaom  up   •  Sound  architecture  boundary   •  Free  of  split  packages   •  SemanHc  versioning   •  Export  package  versions  should  match  bundle  version   •  Use  Import-­‐Package  rather  than  Require-­‐Bundle   –  With  sensible  version  ranges   •  Address  dynamic  classloading   11  
  • 12. Dynamic  Classloading   •  ProblemaHc  usage   –  Class.forName()   –  ClassLoader  loadClass  or  getResource   –  Thread  context  class  loader   •  Short-­‐term  fix   –  DynamicImport-­‐Package:  *   •  Long-­‐term  fix   –  Refactor  code  (if  possible)  so  client  can  pass  class  or   classloader  to  framework   12  
  • 13. Bundle  CreaEon   POM Maven Bundle (Jar) with Global OSGi Maven Bundle Manifest Repository Java source Plugin files 13  
  • 14. OSGi  Manifest  GeneraEon   •  Maven  arHfact  version  ==  bundle  version  ==  export   packages  version   •  Follow  semanHc  versioning  (semver.org)   •  Scan  code  (BND)  to  derive  import  and  export  packages   •  Use  major  version  matching  for  Import-­‐Packages:   –  Ex:  [1.1.2,2.0)   •  By  default,  all  packages  are  exported  except   –  impl.*  and  internal.*   14  
  • 15. Two-­‐Stage  Dependency  Wiring   Maven Repo OSGi wiring A.jar; v1 Maven A.jar; v1 based on A.jar; v2 A.jar; v2 bundle B.jar; v1 B.jar; v2 subset B.jar; v2 POM C.jar; v3 Dependency a.*; v2 . b.*; v2 . . (all bundles, all Bundle Subset Runtime versions) •  Benefits   –  Smaller  bundle  set   –  IsolaHon  from  changes  in  global  repository  (reproducibility)   15  
  • 16. App  Development  Environment   •  Eclipse  Helios   –  Geronimo  Eclipse  Plugin   –  Apache  Felix  Maven  Bundle  Plugin   –  OSGi  tooling  plugin   –  Standard  plugins  for  Maven  and  Git  integraHon   •  Others   –  Maven  archetypes  for  app  /  bundle  project  creaHon   –  Jenkins  CI   16  
  • 17. ApplicaEon  Development   •  ApplicaHons  packaged  as  EBA   •  Build  Hme:  Plajorm  parent  POM   –  Pre-­‐defined  plajorm  bundles  dependencies.  Updated   regularly.   –  App  developers  can  extend  /  override   •  RaHonale   –  CerHficaHon  across  the  specific  versions   –  Ensure  applicaHon  progresses  towards  newer  versions   –  SHll  maintain  ability  to  override  on  a  per  app  basis   17  
  • 18. ApplicaEon  Deployment   EBA Application WAR VM / Physical All dependent bundles Host Local OBR xml Activation scripts QA Cloud Deployment Configuration Files Infrastructure VM / Physical Host Container JVM VM / Physical Host App Deployment Unit Production 18  
  • 19. ExisEng  Code  MigraEon   •  Incrementally  migrate  applicaHons  to  new  stack   •  Most  efforts  spent  in  migraHng  exisHng  library  jars   •  Built  tool  to  detect  duplicate  class  /  split  packages  across   jars   –  Merge  the  jars   –  Manual  refactoring   •  Deal  with  class  loading  code   •  Ensure  transiHve  dependencies  are  “bundle-­‐ized”   •  Need  to  migrate  third-­‐party  libraries  if  they  are  not  OSGi-­‐ enabled   19  
  • 20. Issues  We  Encountered   •  Steep  learning  curve  for  developers   •  Build  tools  integraHon   •  Debugging  resoluHon  problems   •  IniHalizaHon  ordering  of  bundles   •  ImporHng  bundle  containing  only  non-­‐Java  resources   •  Bundle  space  isolaHon  between  container  and   applicaHons     20  
  • 21. What  Works  Well   •  OSGi  modularity  enforcement  leads  to  beaer  code   organizaHon  and  reuse   •  Explicit  versioning  and  dependency  management   •  Solid  end-­‐to-­‐end  development  experience  with   proper  tooling  integraHon   •  Bundles  working  in  both  OSGi  and  non-­‐OSGi   environments   •  Dynamic  updates   21  
  • 22. Lessons  Learned   •  Need  a  few  in-­‐house  OSGi  experts   –  Evangelism   –  Best  pracHces   –  Support   •  Reduce  direct  exposure  to  OSGi  API  for  developers   •  Important  to  prescribe  end-­‐to-­‐end  development  lifecycle   •  Some  automaHon  to  support  migraHon  of  exisHng  code   base   •  Take  small  steps   22