3 millions users in 10 countries - Techincal history of BlaBlaCar

3 millions users in 10 countries - Techincal history of BlaBlaCar

Discover the technical history of BlaBlaCar. 10 years of history, 10 countries, 3 versions...
Any comments ? https://joind.in/talk/view/9349

418997665c4a3368515ecf9c3d746b95?s=128

Olivier Dolbeau

November 21, 2013
Tweet

Transcript

  1. 3 MILLIONS USERS IN 10 COUNTRIES TECHNICAL STORY OF BLABLACAR

    Created by / Olivier Dolbeau @odolbeau
  2. 3 MILLIONS USERS ?

  3. NO !

  4. 5 MILLIONS USERS !

  5. THE STORY How Blablacar is born ?

  6. A MAN

  7. WHO WANTS TO SEE HIS FAMILY...

  8. WITHOUT TICKETS...

  9. SEEING PLENTY EMPTY CARS...

  10. HAD AN IDEA !

  11. THE CONCEPT How Blablacar works ?

  12. None
  13. DRIVER: EMPTY CAR ?

  14. PASSENGER: LOOKING FOR A VEHICLE ?

  15. TRAVEL TOGETHER !

  16. LET'S TECH ABOUT TECHNIQUE ! Because it's sexy !

  17. V1 Quick & dirty !

  18. "DEVELOPMENT" START IN 2004

  19. U KNOW JOOMLA ?

  20. BUT HAVE YOU MET MAMBO ?

  21. DON'T BE JEALOUS !

  22. OK THE PROTOTYPE WORKS ! Now let's move !

  23. V2 Plain old school PHP

  24. DEVELOPMENT START IN JANUARY 2008

  25. CONTEXT From scratch Use the same database than the V1

  26. SEPTEMBER 2008 Launch in France

  27. JANUARY 2010 Launch in Spain

  28. JUNE 2011 Launch in UK

  29. MAY 2012 Launch in Italy

  30. 1 million users use website every month

  31. 8 680 Average rpm during last month

  32. 329 Average response time during last month (in ms)

  33. 4 683 commits on Git (in the 3 last years)

  34. 285 588 lines of code...

  35. V2 WORKS FINE France (with booking) Spain UK Italy

  36. BUT IT'S NOT GOOD ENOUGH.

  37. NO CODE CONVENTION

  38. HOME MADE CODE

  39. NEED MORE DEVELOPERS And still need ! =)

  40. NOT SCALABLE To search trip ? SQL !

  41. HARD TO MAINTAIN Imagine if YOU have to update the

    lib.trip.php file !
  42. LIB.TRIP.PHP 3770 lines 69 functions 926 lines... for 1 function

    !
  43. IT LOOK LIKE THIS i f ( . . .

    ) { i f ( ) { f o r ( ) { i f ( ) { } e l s e { } } i f ( ) { f o r ( ) { i f ( ) ; e l s e } } } i f ( ) { } }
  44. None
  45. NO TESTS !

  46. None
  47. BETTER THAN V1 RIGHT ?

  48. V3 Let's do beautiful code !

  49. CONTEXT

  50. BLABLACAR IN EUROPE Less than 2 millions members Online booking

    in France only 5 countries From 5 (at the begin) to 20 people in tech team today
  51. BUSINESS REQUIREMENTS We can't stop the site (yeah, really !)

    We can't stop improving v2
  52. TECHNICAL NEEDS

  53. WELL KNOWN FRAMEWORK To hire developers To avoid long learning

    curve To not reinvent the wheel (i18n, forms, templates, etc.) To code quickly
  54. SYMPHONY

  55. None
  56. None
  57. GOOD CODE Readabability Fiability Speed Scalability

  58. READABILITY ? PSR-2 Code reviews

  59. FIABILITY ? Unit tests with PHPUnit Functionnal tests with Behat

    Continous integration with Bamboo
  60. SPEED ? Asynchronous job Cache (thanks sf2)

  61. SCALIBILITY ? ElasticSearch RabbitMQ

  62. DEVELOPMENT START IN MARCH 2012

  63. AND AFTER 6 MONTHS...

  64. OCTOBER 2012 Launch in Belgium

  65. OCTOBER 2012 Launch in Netherlands

  66. AUGUST 2012 Launch in Portugal

  67. OCTOBER 2012 Launch in Luxembourg

  68. OCTOBER 2012 Launch in Poland

  69. MIGRATION TO V3

  70. OCTOBER 2012 UK

  71. NOVEMBER 2012 Italy

  72. NOVEMBER 2012 Spain

  73. AND OUR LAST COUNTRY... Released in 1 week only

  74. APRIL 2013 Launch in Germany

  75. WHAT DO YOU THINK ? :)

  76. NOT ONLY A PHP REFACTORING !

  77. FOR SEARCH ? No more SQL !

  78. FOR ASYNCHRONOUS TASKS ? No more SQL !

  79. FOR LOCKS ? No more SQL !

  80. FOR LOGS ? No more tail on servers !

  81. FOR SERVERS ? No more manual installation !

  82. AND ALSO Between 5 and 15 deployments / day New

    Relic for application monitoring S3 for photo EC2 (logstash, newsletters, ...) 30 slots for dev / preprod env
  83. SO NOW ?

  84. IS V3 BETTER THAN V2 ?

  85. AVERAGE RPM DURING LAST MONTH V2: 8 680 V3: 2

    790
  86. AVERAGE RESPONSE TIME DURING LAST MONTH (IN MS) V2: 329

    V3: 278
  87. LINES OF CODE V2: 285 588 V3: 199 774

  88. NOT REALLY RELEVANT RIGHT ?

  89. WHAT DO WE THINK ABOUT SF2 ? To hire developers

    To avoid long learning curve To not reinvent the wheel (i18n, forms, templates, etc.) To code quickly
  90. WHAT DO WE THINK ABOUT OUR CODE Readabability Fiability Speed

    Scalability
  91. READABILITY

  92. TOO MANY EVENTS Inside sf2 !

  93. WE MADE THIS

  94. None
  95. IT MADE THIS

  96. WORKERS, WORKERS, WORKERS ! (you're going to hear about it

    in the next slides)
  97. FIABILITY

  98. SHARED DB BETWEEN V2 & V3 Very hard to maintain

  99. ARE YOU DBA ?

  100. SPEED... IN WORKERS

  101. EFFECTIVELY, V3 IS FASTER THAN V2 BUT...

  102. WORKERS INSIDE APPLICATION ? We have to boot the whole

    sf2 kernel ! Lot of code to deploy just for a worker Lot of code = memory leaks
  103. NOW WE USE CILEX Still have a DIC (Pimple) Clone

    a skeleton, write your own logic and you're down Fast to deploy blablacar/worker-lib
  104. SCALABILITY

  105. 1 - DIRECT ACCESS TO DB The front should not

    access directly to DB
  106. THE FRONT SHOULD NOT ACCESS DIRECTLY TO DB

  107. WE'RE WRITTEN JAVA... Simple REST API Multiple backends (MySQL, CouchBase,

    ElasticSearch, ...) No more direct access to data Normalize data for v3 (and all applications ?) Wait & See. :)
  108. 2 - V3 IS TOO MONOLITHIC.

  109. IT'S NOT ONLY ABOUT WORKERS !

  110. SOA !

  111. DECOUPLED APPLICATIONS

  112. WORKERS, WORKERS, WORKERS ! mails sms user actions user ips

    ...
  113. BUT ALSO... geoproxy phonenumber waypagg

  114. SO... YOU'RE DOWN ?

  115. MIGRATE FRANCE TO V3

  116. MIGRATE MOBILE TO V3

  117. EXPLODE OUR APPLICATION (I really want do to that !

    \o/)
  118. BECAME AN INTERNATIONAL COMPANY ?

  119. QUESTIONS ? Follow me: @odolbeau You want to work with

    us ? cv@blablacar.com