A presentation about microservices at BlaBlaCar.
Talk given at sfPot March 2015 at SensioLabs
What’s the v3?
● after the v2 (thanks cap’tain obvious!)
● Full sf2 application
● contains EVERYTHING
○ dead code
18 août 2011
6 days after:
Steve Jobs resigns as the CEO of Apple Inc.
● Everything in the same place
● only one application to deploy
● only one application to explain to newcomers
(even if a lot of time is needed to understand
It was a good choice at this moment.
There is “only” 268 041 NLOC for symfony/symfony
There is “only” 15 506 commits for symfony/symfony
There is “only” 10 228 commits for joyent/node
There is “only” 9 266 commits for twbs/bootstrap
There is 44 809 commits for rails/rails (but it’s ruby… #troll)
There is “only” 17 593 tests for symfony/symfony… #ohwait
minutes to run them all
28 minutes for symfony/symfony… #fake
minutes to deploy
Problems of a very huge code base
● Very (VERY) Hard to maintain
● Deployment process (including tests) is too
“With minor change
comes major bugs”
Myself, based on my personal experience.
Let’s do it again!
The new developer silver bullet!
“In computing, microservices is a software architecture
design pattern, in which complex applications are
composed of small, independent processes communicating
with each other using language-agnostic APIs. These
services are small, highly decoupled and focus on
doing a small task.”
You know from where comes this definition
We now have 60+ workers in… 60+ git
● easy to:
○ write / launch tests
● always the same code base:
○ same command to consume
○ same deployment script
● We made OSS: swarrot/swarrot
○ new repo
○ new build plan in bamboo
○ a bit of chef for deployment
● new side projects:
○ to configure our broker (Rabbit)
○ to deal with configuration
● increase ops complexity
● Multi DC. \o/
● Need to split data across the world.
● Need to shard data.
But how to
achieve this when
you don’t even
know how your
How to shard users?
You gonna hate Doctrine ORM.
You gonna hate all your listeners.
You gonna hate everyone.
● identify & isolate the business logic
● identify & isolate data calls
● without rewriting the whole application
● without impacting the actual delivery
● must be usable everywhere (not only in our
Do what we want with our data and our
Strict separation of concerns
One repository for everything
● tried with more => complex for development
● still easily splittable
● 1 interface. Can have several
● easy to
○ add cache
○ change backend
○ shard data
● Strict rules:
○ findOne* => return an array or throw exception
○ findBy* => return an Adapter
● Lots of entry points! (called “action”)
● Request / Response / Handler pattern
● Flat request / response => no objects. \o/
● can call 0-n times the data layer.
● event dispatched into RabbitMQ
● We always have a response object or an exception. No
more null everywhere. \o/
● Separation of concern
● The ability to isolate anything!
● strict rules (exceptions & co)
● easy to understand
● applications updates
● new side projects (again)
○ to deal with fixtures
● kind of duplicate code
Cassandra for messaging
Rating data isolation
● Need to deploy the whole application
● 1 bundle
● 54 controllers
● 36 957 NLOC
● Lot of shared code
● Can break the website
● Several independent applications
● Centralized application to handler
permissions / connection
● A bit like SensioConnect for all Sensio
The silver bullet doesn’t exist!
Microservices comes with several drawbacks
but it is worth it!
We will continue to move forward
We need your help! ;)