Meetic Backend Mutation With Symfony

60
Backend Mutation With Symfony

Transcript of Meetic Backend Mutation With Symfony

Page 1: Meetic Backend Mutation With Symfony

Backend MutationWith Symfony

Page 2: Meetic Backend Mutation With Symfony

Joris CalabreseHead Of

Industrialization

Etienne BroutinArchitect

Page 3: Meetic Backend Mutation With Symfony

Meetic corp

• Started in 2001

• Leader in Europe, 17 countries

• Millions of Monthly Active Users

• 150 people in IT team

Page 4: Meetic Backend Mutation With Symfony

Past•

Present•

Future

Page 5: Meetic Backend Mutation With Symfony

Start up + Rapid Growth=

Spaghetti

Page 6: Meetic Backend Mutation With Symfony

Monolithic code

Webservices

Backoffices

Mobile Web

WAP

Desktop

Cronjobs

Page 7: Meetic Backend Mutation With Symfony

700k

NLOC

Page 8: Meetic Backend Mutation With Symfony

Billing Systems

DataBase centric architecture

MailingBI

Procedures + Triggers

Page 9: Meetic Backend Mutation With Symfony

Some Metrics

4 000TABLES

900configurations

400Servers

Page 10: Meetic Backend Mutation With Symfony

Need to change something ?

A. Ask 400 peopleB. Read all the code, understand everything then notify everyone

C. Break everythingD. Add a dirty “if” for your specific caseD. Add a dirty “if” for your specific case

Page 11: Meetic Backend Mutation With Symfony

Spaghetti + Quality Approach=

J’ai de la chance

Page 12: Meetic Backend Mutation With Symfony

What Was Our Development Env?

• Locked Files System• 1 Database for all Developers• No Automated Tests

Page 13: Meetic Backend Mutation With Symfony

QA

• 1 release every 2 weeks• 50 projects by release• 1 button !

What Was Our Quality Approach?

Page 14: Meetic Backend Mutation With Symfony

Who wants to play?

Illustration: mailchimp • mailchimp.com

Page 15: Meetic Backend Mutation With Symfony

When it works…

Page 16: Meetic Backend Mutation With Symfony

…and when it fails!

Page 17: Meetic Backend Mutation With Symfony

Some Stats

10TEAMS

2Deploy/WEEK

2012 2015

Plateform Growth

1

5

65BUGS/WEEK

1ROLLBACK/W

EEK

Spec v1

Page 18: Meetic Backend Mutation With Symfony

Bug Cost

Source: Applied Software Measurement, Capers Jones, 1996

Page 19: Meetic Backend Mutation With Symfony

And, If we want to add automated tests?

A. Chuck Norris develops without bug

B. Only test get_next_week()

C. Mock 200 global variables and 35 functions

D. I will do it when I have timeD. I will do it when I have time

Page 20: Meetic Backend Mutation With Symfony

New Talent + Innovation Need

=New Architecture

Page 21: Meetic Backend Mutation With Symfony

Target

Page 22: Meetic Backend Mutation With Symfony

All Clients are born equal in dignity and rights1

Page 23: Meetic Backend Mutation With Symfony

SOA architecture

Prevents code duplicationMutualize features Web Services

Page 24: Meetic Backend Mutation With Symfony

But this single, centralized webservice will still be huge and complex ?

Too long…

Page 25: Meetic Backend Mutation With Symfony

All Web Services have a single responsibility

2

Message Photos Profile Search

Page 26: Meetic Backend Mutation With Symfony

Strict REST API

profiles messages

GET /profiles/xxxxPUT /profiles/xxxx

GET /messages/xxxxPOST /messages

Page 27: Meetic Backend Mutation With Symfony

profiles messages

Do not share your data

Page 28: Meetic Backend Mutation With Symfony

Inside Business services

Symfony serialization for JSON input / output

Business Logic

Cache Layer

Doctrine DBAL

Controller

Service

Proxy Cache

DAO

Page 29: Meetic Backend Mutation With Symfony

Online Photos Profile Rights Search Boost

That means clients should make several calls to display a single page?

Too long…

Page 30: Meetic Backend Mutation With Symfony

Online Photos Profile Rights Search Boost

But from client point of view

Page 31: Meetic Backend Mutation With Symfony

Online Photos Profile Rights Search Boost

But from client point of view

Page 32: Meetic Backend Mutation With Symfony

API Exposure Layer

Page 33: Meetic Backend Mutation With Symfony

Separation of concerns

business logicdatabase access

orchestrationsecurity, sessionsconfiguration

UX

API Exposure Layer

Page 34: Meetic Backend Mutation With Symfony

Exposure layer

API Exposure Layer

Web Business Services

Back Office

Mailing

Payments

Page 35: Meetic Backend Mutation With Symfony

Inside Exposure Layer

Use Guzzle with batch calls

FOS\RESTBundle

Orchestrate API callsAssemble results from APIs

Controller

Manager

API Client

Page 36: Meetic Backend Mutation With Symfony

Android application

Example to display a list of members

GET /members

Get a list of user ids using Location search

Fetch user data

Exposure Layer

Configuration:

group B

uses location search

AB Tests Search Profile

user is from group B

1 23

Page 37: Meetic Backend Mutation With Symfony

Migration Strategy

Webservices

Web Business Services

Page 38: Meetic Backend Mutation With Symfony

New Quality Approach

Page 39: Meetic Backend Mutation With Symfony

Testing Strategy: Unit test

Page 40: Meetic Backend Mutation With Symfony

Threshold Spirit

Controller

Service

DAO

Complexity Code Coverage

Complexity Code Coverage

Complexity Code Coverage

Page 41: Meetic Backend Mutation With Symfony

Testing Strategy: Integration test

Page 42: Meetic Backend Mutation With Symfony

Continuous Integration

60JOBS

5Agents

5Platform

10 builds in

prOgress

Page 43: Meetic Backend Mutation With Symfony

Product Centric

• Kept a good Knowledge

• Share Product Vision

• Share a same vocable

Behavior Driven Development

Page 44: Meetic Backend Mutation With Symfony

Testing Strategy: Behavior Test

Android application

GET /members

Exposure Layer

AB Tests Search Profile

1 23

Given I am a user of the B groupAnd my geoloc position is ParisWhen I launch a search on the onlineThen I see a list of profileAnd the first profiles are near of my position

Page 45: Meetic Backend Mutation With Symfony

Docker Focus

• Allow the dev to automated testing all technical stack

• 50 instances to launch in parallel

• Different scope and context for the automated tests

Page 46: Meetic Backend Mutation With Symfony

Docker Focus: How to?

DockerCompose

Exposure Layer

BusinessService

LegacyService

Oracle

MySQL

1

2

3

4

5

23

45

Page 47: Meetic Backend Mutation With Symfony

QA Position

Design Build Test Prod

Page 48: Meetic Backend Mutation With Symfony

QA Position

Design Build Test Prod

Page 49: Meetic Backend Mutation With Symfony

Team Autopsy

Front Developer• AngularJS, Grunt, …• Code Review• TDD, BDD

Back Developer• Design• Symfony2, Composer, …• Code Review• TDD,BDD

Product Owner• Define feature• Scenario writing• Define Business Indicators

Page 50: Meetic Backend Mutation With Symfony

Developer Community

• Continuous Learning

• Ease the sharing

• Improve the Skill Switching

• Community Of Practice

• BBL

Page 51: Meetic Backend Mutation With Symfony

Source Management

180Repositories

12groups

14Technos

50+Users

Page 52: Meetic Backend Mutation With Symfony

Jenkins/Gitlab Focus

master

Working-branch

Unit tests

Integration tests

Static Analyse

Hey all!Who wants to review my MR?

I would love to. You can assign it to me.

Page 53: Meetic Backend Mutation With Symfony

Dev Infrastructure

API

API

Page 54: Meetic Backend Mutation With Symfony

Some Stats

2012 2015

1x

7x

Bug In By Week

2012 2015

2

10

Deployment by Day

0,5%Of rollback

3 756Written tests

91,3

%Code

coverage

Page 55: Meetic Backend Mutation With Symfony

Our New Future

Page 56: Meetic Backend Mutation With Symfony

• Impact management

• Reusability

From Architecture point of view

Page 57: Meetic Backend Mutation With Symfony

Continuous Deployment

<< Dev Metrics

Prod Metrics >>

Page 58: Meetic Backend Mutation With Symfony

Next Challenges

Page 59: Meetic Backend Mutation With Symfony

Harder, Better, Faster, Stronger!

by

Page 60: Meetic Backend Mutation With Symfony