From 1 to 20 million users the technical story of BlaBlaCar

From 1 to 20 million users the technical story of BlaBlaCar

IPC Spring Berlin 2015

F135ce7f204af6fac8075b469685c91d?s=128

Matthieu Moquet

June 06, 2015
Tweet

Transcript

  1. 4.

    Why this talk? ❖ History of the BlaBlaCar platform ❖

    Overview our main technical choices ❖ Understand of our culture & methodologies
  2. 9.
  3. 10.
  4. 11.
  5. 13.
  6. 14.
  7. 22.
  8. 24.

    — Eberhardt Von Kuenheim « The big will not always

    eat the small, 
 but the fast ones will overtake the slow ones »
  9. 32.
  10. 37.

    Progressive Rollout ❖ Open new countries with v3 one by

    one ❖ It took about 2.5 years to run v3 everywhere ❖ Today we can deploy new features for a set of users (by attributes or random)
  11. 39.

    ELK

  12. 45.

    Photo Storage Don’t store static BLOB into MySQL. Use an

    elastic filesystem storage. MySQL AWS S3
  13. 47.

    Varnish Fast reverse proxy cache 30% HIT/MISS Firemode to handle

    high traffic (TTL) Be careful with authenticated user blocks (Javascript is your friend)
  14. 50.

    workers/      mail      sms      push

         image-­‐resize      indexer      cache-­‐invalidation      elasticsearch-­‐indexation      trip-­‐publication      ... github.com/swarrot
  15. 52.
  16. 59.

    Today we are mainly Monolithics But we would love using

    more Micro-Services Easier to deploy Development workflow Legacy database Smaller teams Faster deployments Easier to scale out
  17. 60.

    Gateway Principles (Clean Architecture) Decouple models (not db) Isolate business

    & data accesses (in the Monolytics to better decouple in micro services) Restrictive rules Enter the
  18. 66.

    But how to cache the API? GET  /api/trips?from=Paris&to=Berlin   Authorization:

     Bearer  7c82e855b0415f27bd92d   HTTP/1.1  200  OK   {          "trips":  [...]   }
  19. 67.

    { Reverse proxy is useless if only the app knows

    the authorizations Reverse Proxy Client User Scopes Access Token
  20. 72.

    What backend servers receive GET  /api/trips?from=Paris&to=Berlin   X-­‐Auth-­‐User:  1337  

    X-­‐Auth-­‐Client:  android   X-­‐Auth-­‐Scope:  user_info,messages
  21. 73.

    App gets an Access Token from the origin Reverse Proxy

    App submit request with Access Token Reverse Proxy transform Access Token header into custom X-Auth headers
  22. 74.

    Cachable response HTTP/1.1  200  OK   Content-­‐Type  application/json   Vary:

     X-­‐Auth-­‐Scope   ! {  "trips":  [  ...  ]  }
  23. 77.

    ‣ Know the read requests before creating your data models

    ‣ Create as many tables (KeySpaces) than you have views ‣ Denormalize the data (no join allowed)
  24. 78.

    CQRS & Event Sourcing ❖ Separate Read & Write ❖

    Eventual consistency ❖ But hard to do with legacy software / database See talk PHPTour 2015 at moquet.net