JRuby at LinkedIn
                                   in three acts




Baq Haidri | @baqhaidri
Wednesday, August 3rd 2011

           Recruiting Solutions
            professional hacking
Me
• Generalist
• Background in Java, not Ruby




     professional hacking        2
100M+
LinkedIn                                                               90


• Over one user added per second
• Mostly Java
                                                                55
• Strong product focus
                                                         32


                                                  17

                                            8
                            2      4


                           2004   2005    2006   2007   2008   2009    2010
                                         LinkedIn Members (Millions)

    professional hacking
Act I: The Data




    professional hacking   4
source:	
  Mathieu	
  Bas/an	
  using	
  Gephi	
  on	
  LinkedIn	
  skill	
  data
            professional hacking                                                    5
professional hacking
source:	
  Mathieu	
  Bas/an	
  using	
  Gephi	
  on	
  LinkedIn	
  skill	
  data   6
Rails Prototype




    professional hacking   7
Act II: The Challenge




    professional hacking   8
oldemort




professional hacking              9
Service	
  Call


                                                      Security,	
  Auth,	
  Iden5ty
            Naviga5on	
  Bar




                                                      Interna5onaliza5on
                                                      Qui	
  a	
  consulté	
  votre	
  profil?
       Unified	
  URL	
  genera5on




professional hacking                                                                            10
Tomcat
                        LinkedIn	
  Spring	
  MVC
                              SiteMesh
Request                           JRuby-­‐Rack

                                       Sinatra
                                          get ‘/hello’ do
                                            erb :layout
                                          end


                                           <html>
                                             <head>
                                               <title>Hi</title>
                                             </head>
                                             <body>
                                                Hello from JRuby!
                                             </body>
                                           </html>
Response




 professional hacking                                               11
Hello from JRuby!




               professional hacking   12
Service Calls
 Pre-existing library for parallel, de-duplicating async
  data operations, loosely based on REST
 Clunky abstractions in Java, but wrapped by Ruby:




      professional hacking                                  13
Ruby’s simplicity
 Some Ruby wrappers were created to mimic Java
  APIs but Ruby made them more expressive:




     professional hacking                         14
Act III: To Production




    professional hacking   15
#winning!




     huh?




professional hacking           16
Deployment
 Ops knows nothing
  ‣ Configuration
  ‣ Deployment
  ‣ Monitoring
 Standard monitoring already available via JMX:
  ‣ Latency
  ‣ Requests/Second
  ‣ Memory and CPU usage


  source:	
  LinkedIn	
  internal	
  performance	
  graph



              professional hacking                          17
Gotchas
      Unpack wars on deployment
      Watch out for PermGen usage:



                                             Leak!        Restart

                                                                    Fixed




source:	
  LinkedIn	
  internal	
  performance	
  graph




                            professional hacking                       18
Flags
 JVM:
 ‣ -XX:PermSize=256m
 ‣ -XX:MaxPermSize=256m
 ‣ -XX:+CMSClassUnloadingEnabled
 JRuby:
 ‣ None, but still use 1.8.7
 ‣ JRuby 1.6.2




     professional hacking          19
Performance
 Internal latency is averaging 700ms

                                                            Time	
  spent	
  in	
  Ruby
                                                            <=	
  ~50	
  ms	
  




  source:	
  LinkedIn	
  internal	
  performance	
  graph



              professional hacking                                                        20
Conclusion




   professional hacking   21
Happily Ever After
 Adoption of JRuby is growing internally
 Open-minded, polyglot culture




      professional hacking                  22
JRubyConf Swag Contest
 Visit linkedin.com/skills/skill/JRuby
 Tweet-share the page
 Be sure to include link back to JRuby Skills page,
  with the #in tag and a #jrubyconf tag.
 First 40 users to tweet will win a prize
 Winners announced at lunch tomorrow




      professional hacking                             23
Questions?




    professional hacking   24

JRuby At LinkedIn

  • 1.
    JRuby at LinkedIn in three acts Baq Haidri | @baqhaidri Wednesday, August 3rd 2011 Recruiting Solutions professional hacking
  • 2.
    Me • Generalist • Backgroundin Java, not Ruby professional hacking 2
  • 3.
    100M+ LinkedIn 90 • Over one user added per second • Mostly Java 55 • Strong product focus 32 17 8 2 4 2004 2005 2006 2007 2008 2009 2010 LinkedIn Members (Millions) professional hacking
  • 4.
    Act I: TheData professional hacking 4
  • 5.
    source:  Mathieu  Bas/an  using  Gephi  on  LinkedIn  skill  data professional hacking 5
  • 6.
    professional hacking source:  Mathieu  Bas/an  using  Gephi  on  LinkedIn  skill  data 6
  • 7.
    Rails Prototype professional hacking 7
  • 8.
    Act II: TheChallenge professional hacking 8
  • 9.
  • 10.
    Service  Call Security,  Auth,  Iden5ty Naviga5on  Bar Interna5onaliza5on Qui  a  consulté  votre  profil? Unified  URL  genera5on professional hacking 10
  • 11.
    Tomcat LinkedIn  Spring  MVC SiteMesh Request JRuby-­‐Rack Sinatra get ‘/hello’ do erb :layout end <html> <head> <title>Hi</title> </head> <body> Hello from JRuby! </body> </html> Response professional hacking 11
  • 12.
    Hello from JRuby! professional hacking 12
  • 13.
    Service Calls  Pre-existinglibrary for parallel, de-duplicating async data operations, loosely based on REST  Clunky abstractions in Java, but wrapped by Ruby: professional hacking 13
  • 14.
    Ruby’s simplicity  SomeRuby wrappers were created to mimic Java APIs but Ruby made them more expressive: professional hacking 14
  • 15.
    Act III: ToProduction professional hacking 15
  • 16.
    #winning! huh? professional hacking 16
  • 17.
    Deployment  Ops knowsnothing ‣ Configuration ‣ Deployment ‣ Monitoring  Standard monitoring already available via JMX: ‣ Latency ‣ Requests/Second ‣ Memory and CPU usage source:  LinkedIn  internal  performance  graph professional hacking 17
  • 18.
    Gotchas  Unpack wars on deployment  Watch out for PermGen usage: Leak! Restart Fixed source:  LinkedIn  internal  performance  graph professional hacking 18
  • 19.
    Flags  JVM: ‣-XX:PermSize=256m ‣ -XX:MaxPermSize=256m ‣ -XX:+CMSClassUnloadingEnabled  JRuby: ‣ None, but still use 1.8.7 ‣ JRuby 1.6.2 professional hacking 19
  • 20.
    Performance  Internal latencyis averaging 700ms Time  spent  in  Ruby <=  ~50  ms   source:  LinkedIn  internal  performance  graph professional hacking 20
  • 21.
    Conclusion professional hacking 21
  • 22.
    Happily Ever After Adoption of JRuby is growing internally  Open-minded, polyglot culture professional hacking 22
  • 23.
    JRubyConf Swag Contest Visit linkedin.com/skills/skill/JRuby  Tweet-share the page  Be sure to include link back to JRuby Skills page, with the #in tag and a #jrubyconf tag.  First 40 users to tweet will win a prize  Winners announced at lunch tomorrow professional hacking 23
  • 24.
    Questions? professional hacking 24