30
Scale with Microservices Võ Duy Tuấn CEO/Founder Teamcrop.com

Scale with Microservices

Embed Size (px)

Citation preview

Page 1: Scale with Microservices

Scale with Microservices

Võ  Duy  Tuấn  CEO/Founder  Teamcrop.com  

Page 2: Scale with Microservices

Vo Duy Tuan CEO/Founder @ Teamcrop.com

§  PHP

§  Web Scalability & Optimization

§  Data Mining

§  E-Commerce

§  Docker & Microservices

Interests

Page 3: Scale with Microservices

WHY we choose Microservices?

Page 4: Scale with Microservices

1. ERP System

Page 5: Scale with Microservices

2. Multi-platform

Page 6: Scale with Microservices

3. Separation of concerns

A design principle for separating a computer program into distinct sections, such that

each section addresses a separate concern. - Wikipedia

Page 7: Scale with Microservices

4. Resource allocation

Page 8: Scale with Microservices

5. Trend

Page 9: Scale with Microservices

HOW we implement Microservices?

Page 10: Scale with Microservices

1. Bounded context

Page 11: Scale with Microservices

2. Inter-service communication

•  Authentication: –  Json Web Token (JWT) –  Access Trusted Network

•  Communications: –  Restful (HTTP) –  SOAP (HTTP) –  AMQP –  App specific: Redis… –  Protobuf

Page 12: Scale with Microservices

3. Micro-framework

•  Easy to learn •  Easy to code •  Easy to run •  Easy to test •  Easy to deploy •  Easy to upgrade •  Restful Web Service •  Slim framework

Page 13: Scale with Microservices

4. Single Page App (SPA)

Page 14: Scale with Microservices

5. Configuration

Page 15: Scale with Microservices

5. Configuration (cont.)

Page 16: Scale with Microservices

6. Logging

Page 17: Scale with Microservices

6. Logging (cont.)

Page 18: Scale with Microservices

7. Monitoring

API  Status  Monitoring  from  statuscake.com  

Page 19: Scale with Microservices

7. Monitoring (cont)

Page 20: Scale with Microservices

8. Docker

Page 21: Scale with Microservices

8. Docker overview

Page 22: Scale with Microservices

8. Docker keywords

•  Container •  Image •  Registry •  Port •  Volume •  Dockerfile

Page 23: Scale with Microservices

8. Docker Container CLI

docker run -ti -d \

-h tc-todo \

--restart=always \

--name tc-todo-$RANDOM -p :80 \

-e SERVICE_TAGS=tc-todo \

-e CONFIG_URL=http://configurl.com/?abc \

-e GRAPHITE_IP=127.0.0.1 \

-v /services/tc-todo/private:/var/www/private \

-v /services/tc-todo/src:/var/www/src \

voduytuan/tc-microservice

Page 24: Scale with Microservices

9. Service discovery

Page 25: Scale with Microservices

OPS / Service discovery (cont.)

Page 26: Scale with Microservices

9. Service discovery (cont.)

HAProxy  

Consul-­‐template  

Docker  Engine  

Backend  01  :  Port  32680  

Backend  02  :  Port  32681  

Backend  03  :  Port  32682  

Update  haproxy.cfg  &  Reload  haproxy  

CONSUL   REGISTRATOR  

NoSfy  

Update  

Pull  1  

2  

3  

4  5  

Client  

gliderlabs/registrator  gliderlabs/consul-­‐server  

Page 27: Scale with Microservices

9. Service discovery (cont.)

Sample  template  of  Haproxy,  will  parsed  by  Consul-­‐template  

Page 28: Scale with Microservices

10. Continuous Integration / Continuous Deployment

Page 29: Scale with Microservices

10. Continuous Integration / Continuous Deployment

Page 30: Scale with Microservices

Thanks! CONTACT: [email protected]

0938 916 902

teamcrop.com