Building Microservices @ Squarespace
QCon New York 2017
Franklin Angulo @feangulo
Building Microservices @ Squarespace QCon New York 2017 INSERT - - PowerPoint PPT Presentation
Franklin Angulo @feangulo Building Microservices @ Squarespace QCon New York 2017 INSERT IMAGE HERE AGENDA 01 Microservice Framework 02 Organizational Changes 03 New Opportunities & Challenges Service Contextual Healthchecks Discovery
QCon New York 2017
Franklin Angulo @feangulo
INSERT IMAGE HERE
01 Microservice Framework 02 Organizational Changes 03 New Opportunities & Challenges
Microservice Framework
Healthchecks Service Discovery Contextual Information Structured Logging Metrics API Documentation Distributed Tracing Dynamic Configuration
Healthchecks
service: name: taxation version: 1.0 server: port: 8080 management: port: 8081
Healthchecks
http://taxation101.eqx.dal.prod.squarespace.net:8081/healthcheck { "status":"UP", "taxation-core":{ "healthy":true "message":"Service is running version TAX-459" } }
Service Discovery & Registration
Service B Service A Service C Service Discovery Consul Zookeeper
Service Discovery & Registration
Contextual Information
Client v3.1 Taxation Service Billing Service Context Id Client Version Client Source Type JaOLrH2O
Structured Logging
Taxation Service GC Logs Access Logs Application Logs
Structured Logging
tail -f /data/logs/taxation-access.log 2017-03-22 07:24:45:026 GMT thread=jetty-846 contextId=JaOLrH2O contextSourceType=billing clientVersion=taxation-client-3.1 level=INFO class=AccessLog ip=10.100.101.205 method=GET uri=/api/1/taxation/rates queryString= httpVersion=HTTP/1.1 responseCode=200 responseTimeMs=39 responseSize=-1 logging.level: DEBUG logging: level:
com.squarespace.metrics.Graphite: "OFF" directory: /data/logs extension: .log maxFileSize: 512MB totalSizeCap: 8GB maxHistory: 5
Metrics
graphite: enabled: true enableConsole: false host: {{ graphite_host }} port: {{ graphite_port }}
Metrics
http://taxation101.eqx.dal.prod.squarespace.net:8081/metrics { "mem":2210292, "mem.free":831939, "processors":2, "threads":89, "GET.api.1.taxation.tax-overrides.sourceTypes.admin.requests.snapshot.stdDev":0, "GET.api.1.taxation.exemptions.externalId.requests.snapshot.99thPercentile":90, "GET.api.1.taxation.exemptions.requests.oneMinuteRate":2.964393875E-314, "GET.api.1.taxation.exemptions.externalId.requests.meanRate":1.4890452464986816, "PUT.api.1.taxation.tax-overrides.id.decisions.requests.snapshot.98thPercentile":22, "GET.api.1.taxation.vat-countries.list-results.sourceTypes.billing.requests.snapshot.p75":0 }
Metrics
Distributed Tracing
Dynamic Configuration
vars: tracing_sample_rate: prod: 0.2 stage: 1.0 qa1: 1.0
Dynamic Configuration
API Documentation
Microservice Framework
Client-Side Load Balancing Latency & Fault Tolerance Client-Side Caching Asynchronous Request Execution HTTP Request Builders
Client-Side Load Balancing
Client Service X Service X Service X Service Discovery Application Container
Latency & Fault Tolerance
Service B Service A Service C Service A Client Service B Client Service C Client User Request Application Container
Latency & Fault Tolerance
Service B Service A Service C Service A Client 10 Threads Service B Client 5 Threads Service C Client 5 Threads User Request
Fail fast, fail silent, or fallback
Application Container
Hystrix
Client-Side Caching
Service X Service X Client User Request Application Container
Asynchronous Request Execution
Client Service A Service Z Application Container Service B Service C Service D
HTTP Request Builders
getCurrentProductOfferingTemplate = group .newTemplateBuilder(“getCurrentProductOffering”) .withMethod(HttpMethod.GET.name()) .withUriTemplate(RESOURCE_URL + “/offerings/countries/{country}/current”) .build();
Server Systems Product & Data
Server TechOps SRE Core Svcs
Location Taxation Billing Currency
Provisioning
Provisioning
Ansible & Configuration Management
Release Engineering / Developer Productivity
Release Engineering & Developer Productivity Drone Helm
Ansible & Configuration Management hello-service/deploy/deploy.yml:
Ansible & Configuration Management hello-service/deploy/config.yml.j2:
Build & Deploy Tooling
Observability & Alerting
Observability & Alerting
Observability & Alerting Tooling
Observability & Alerting Tooling
Observability & Alerting Tooling
Observability & Alerting Tooling
Observability & Alerting Tooling
Service Dashboard
Self-service provisioning Code generation Pull-based metrics Log collection improvements Distributed tracing improvements Alerting improvements
Microservices Journey
2013: small (< 50 engineers) build product & grow customer base whatever works 2014: medium (< 100 engineers) we have a lot of customers now! whatever works doesn't work anymore 2016: large (100+ engineers) architect for scalability and reliability
?: XL (200+ engineers)
Thank you!
squarespace.com/careers Franklin Angulo @feangulo