Scaling with Microservice

19
PHP Experience 2016 - IT Master First 90 Scaling With Microservice

Transcript of Scaling with Microservice

Page 1: Scaling with Microservice

PHP Experience 2016 - IT Master

First 90ScalingWithMicroservice

Page 2: Scaling with Microservice

This is our visionBuilding the foundation to Build a 3B Company by FY20

Agenda

+ What we call Microservices ?

+ Benefit and Challenge

+ Scaling in MercadoLivre

+ Lessons Learned

Page 3: Scaling with Microservice
Page 4: Scaling with Microservice
Page 5: Scaling with Microservice

Microservicesis a new "tag" for things we are already doing.

Page 6: Scaling with Microservice

This is our visionBuilding the foundation to Build a 3B Company by FY20

Vs

Monolithic vs Microservices

Page 7: Scaling with Microservice

A Tiny Definition of Microservices

Small Autonomous services communicating with each other using language-agnostic APIs.

Page 8: Scaling with Microservice

+ Different languages, databases, hardware ...

+ Each service can be deployed independently

+ The services are easy to replace

+ Improved fault isolation

Benefit

Page 9: Scaling with Microservice

+ Operations Overhead

+ Avoid Nanoservice

+ Implicit Interfaces

+ Network communication

Challenge

Page 10: Scaling with Microservice

Scaling in MercadoLivre

Page 11: Scaling with Microservice

“Scalability Porn”

18.000.000 Request per minutes

400 Deploys per days

700 Developers in 6 development centers

20.000 Virtual servers

1.500 Physical servers

Page 12: Scaling with Microservice

Microservices - API MercadoLibre

Services Communicate -> HTTP/REST with JSON

API Gateway -> NGINX

NGINX

User Service

Item Service

Categories Service

Page 13: Scaling with Microservice

Lessonslearned

Page 14: Scaling with Microservice

Cache everythingReuse HTTP headers

GET https://api.mercadolibre.com/sites/MLB

HTTP/1.1 200 OK

Cache-Control: max-age=60, stale-while-revalidate=240{........}

Page 15: Scaling with Microservice

200 & 206 Partial ContentDesigned to worst-case

VIP

User Service

Reputation

Service

User Service

Reputation

Service

VIP

Page 16: Scaling with Microservice

Online GET vs Background update Resources with few changes and many outbuildings

User Service

Item Service

Categories Services

Search Service

- Dump all categories- Update each 10 minutes

Page 17: Scaling with Microservice

Duplicate DataEach department can have a copy of the data

POST Item

Item Service

Search Service

Moderation Service

Queue Service

Item DB

Item DB (partial copy)

Item DB (partial copy)

Page 18: Scaling with Microservice

Thank You

Page 19: Scaling with Microservice

?