SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Downloaden Sie, um offline zu lesen
Auto-scaling your API
Insights and Tips from the Zalando Team
JBCNConf 2015

Barcelona, Spain
Sean Patrick Floyd - @oldJavaGuy

Luis Mineiro - @voidmaze
15 countries
3 fulfilment centers
15+ million active customers
2.2+ billion € revenue 2014
130+ million visits per month
8.000+ employees
ONE of EUROPE’S LARGEST ONLINE FASHION RETAILERS
Visit us: tech.zalando.com
Tech hubs in Berlin, Dublin, Dortmund
and Helsinki
Our Scale
Based on https://flic.kr/p/bX5E4c
2 datacenters
thousands of production instances
serving 15 countries
Zalando stack
Credits to our colleague Kolja Wilcke
Credits to our colleague Kolja Wilcke
Credits to our colleague Kolja Wilcke
The Shop
Monolith
We call it “Jimmy”
http://blog.codinghorror.com/new-programming-jargon/
Thousands of Java classes, undocumented features
Business logic on all layers (including the database)
https://flic.kr/p/nBhvfy
https://flic.kr/p/tW4sus
It’s 2013…



Zalando wants to
sponsor hackathons…
We need a REST API!
Hackathon

API
First Step
Let’s create some REST-(ish) Spring
controllers inside our monolithic web
application
Deploy a couple of Jimmy instances just to
serve requests for this “API”
Pros
The infrastructure is already there!
A few days of coding and we’re all set
Cons
This “API” cannot be deployed independently
of Jimmy.
Jimmy is infested with business logic
everywhere.
New
Requirements
New Requirements
We needed this new API for our existing
frontends, also (very high traffic).
Some third-party apps also wanted to use this
API as their backend.
Shop Public API
We decided to build a “real” API as a separate
standalone project.
Of course, there were some dependencies…
Data Sources
1.Catalog - SOLr
2.Stock - Memcached
3.Reviews - REST(-ish) API
4.Recommendations - RPC
5.Database - PostgreSQL
Shop Public API
Catalog Stock Reviews Recommendations Database
All of them in the same data centers.
This should be no problem…
Tech
Company
Paradigm Shift
Until 2014
We’re a Fashion Company that has a lot 

of tech knowledge
2015
Suddenly we’re a Tech Company, providing
“Fashion as a Service”
We established
5 principles
API FIRST
API First
Document and peer review your API in a
format like Swagger before writing a single
line of code.
Ideally, either generate either your server
interfaces or your test data (or both) from the
Swagger spec
REST
REST
Manipulate resources, don't call methods
Expose nouns, not verbs
Use HTTP verbs
GET, PUT, POST, DELETE, PATCH
SAAS
Identity Management
Our backend services don’t expose APIs yet
Company-wide IAM strategy is not ready yet
Can only expose read-only features for now
MICRO-
SERVICES
Microservices
We already have a Service-Oriented
Architecture
It was mostly SOAP, though…
And definitely not micro
CLOUD
Road to AWS
Some challenges ahead…
1. Backend services not available yet
2. SOLr also not available
3. We can’t just move the databases there
How we

did it
Challenges
Catalog and Stock datasources are latency critical
and they’re owned by different teams!
Can we solve that?
Step 1 - move critical datasources to AWS
“Move” Data Sources to AWS
We can’t just move them!
Jimmy also needs them in the data centers,
you insensitive clod!
Ok… we just replicate them.
and then…?
Replicating Data Sources
SOLr has its own replication mechanism
over HTTP
memcached should be easy …
You wish!
Step 2 - Build memcached replication
Stock Relay
Memcached #1
Memcached #2
Memcached #3
Stock Relay(s)
SNS Topic
…
Datacenter
eu-central-1
Memcached ElasticCacheStock Repeater(s) Shop Public APISQS Queue
eu-west-1
Memcached ElasticCacheStock Repeater(s) Shop Public APISQS Queue
us-east-1
Memcached ElasticCacheStock Repeater(s) Shop Public APISQS Queue
SET / DELETE
GET
GET
GET
and then…?
AWS SOLr Repeater
Datacenter Master
eu-central-1
eu-west-1
us-east-1
SOLr Slaves Shop Public APIRegion Repeater
SOLr Slaves Shop Public APIAWS Master Repeater
SOLr Slaves Shop Public APIRegion Repeater
Autoscaling SOLr and API
http://www.docstoc.com/docs/109290533/Lucid-Imagination# by Erick Erickson
Region repeater
Slave #1
Autoscaling Group
Slave #2
Slave n
API
Node #1
Autoscaling Group
API
Node #2
API
Node n
https://api.zalando.com
Scaling Limitations
Edited from https://flic.kr/p/zuBXM
Region repeater
Autoscaling Group
Slave #1
Slave #2
Slave #3
Slave #3
Slave #3
Slave #3
Slave #11
Slave #18
Slave #3
Slave #34Slave #3
Slave #3
Slave #59
Slave #3
Slave #3
Slave #123
Slave #3
Slave #3
Slave #3
Slave #3
Slave #3
Slave #325
Slave #3
Slave #3
Slave #3
Slave #3
Slave
#42815
Y U no scale!
S3 Bucket for Replication
Datacenter Master
eu-central-1
eu-west-1
us-east-1
SOLr Slaves Shop Public API
Master Repeater SOLr Slaves Shop Public API
SOLr Slaves Shop Public API
S3replicationS3replication
I see…
“Onion layers” for Replication
• Start with a single repeater layer -
layer0.solr
• Setup a Route53 CNAME repeater
that links to it - repeater.solr
• Entire slave fleet in the ASG is
always configured to replicate from
repeater.solr
CNAME
repeater
Slave #1
Autoscaling Group
Slave #2
Slave n
slave.solr
layer0-repeater.solr
“Onion layers” for Replication
• Setup CloudWatch alarms for
relevant metrics in the repeater layer.
Give them some slack space.
• Configure it to send notifications to
the onion-layers-topic.
• Bring up your instance of onion-
layers.
CloudWatch
CNAME
repeater
Slave #1
Autoscaling Group
Slave #2
Slave n
slave.solr
layer0-repeater.solr
“Onion layers” for Replication
• onion-layers creates a new ASG
layer. Calculates currentLayer =
currentLayer + 1
• The new layer starts replicating from
layer<currentLayer-1>-repeater
• Adds a new Route53 recordset
layer<currentLayer>-repeater.
CNAME
repeater
CloudWatch
Autoscaling Group
layer1-repeater.solr
layer0-repeater.solr onion-layers
Autoscaling Group
slave.solr
“Onion layers” for Replication
• After replication, the CNAME
repeater is updated to link to
layer<currentLayer>-repeater.
• onion-layers acts on alarms for the
connection between current layer
and previous layer.
• You can still have your own AS
alarms for the connection between
slaves and current layer.
CNAME
repeater
CloudWatch
Autoscaling Group
layer1-repeater.solr
layer0-repeater.solr
Autoscaling Group
slave.solr
Yes. These tools will be open-sourced soon
Thank you for listening
Check out our blog https://tech.zalando.com
Our many open source products https://github.com/zalando
The STUPS stack https://stups.io
Got more questions? You can reach us on twitter
@ZalandoTech
We’re hiring!
Special thanks to Jessie Dude.
No Continuum Transfunctioners were harmed during the production of these slides.

Weitere ähnliche Inhalte

Was ist angesagt?

Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General IntroductionAsma CHERIF
 
Spring framework Introduction
Spring framework IntroductionSpring framework Introduction
Spring framework IntroductionAnuj Singh Rajput
 
From Spring Framework 5.3 to 6.0
From Spring Framework 5.3 to 6.0From Spring Framework 5.3 to 6.0
From Spring Framework 5.3 to 6.0VMware Tanzu
 
Rule Engine: Drools .Net
Rule Engine: Drools .NetRule Engine: Drools .Net
Rule Engine: Drools .NetGuo Albert
 
Spring framework IOC and Dependency Injection
Spring framework  IOC and Dependency InjectionSpring framework  IOC and Dependency Injection
Spring framework IOC and Dependency InjectionAnuj Singh Rajput
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design PatternJaswant Singh
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & ActuatorsVMware Tanzu
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewShahed Chowdhuri
 
Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design PatternSanae BEKKAR
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1Shahzad
 
A Java Microservices Spring Boot and Docker case study.
A Java Microservices Spring Boot and Docker case study.A Java Microservices Spring Boot and Docker case study.
A Java Microservices Spring Boot and Docker case study.Subramanyam Vemala
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan GoleChetan Gole
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design patternMindfire Solutions
 

Was ist angesagt? (20)

Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Spring Core
Spring CoreSpring Core
Spring Core
 
Spring framework Introduction
Spring framework IntroductionSpring framework Introduction
Spring framework Introduction
 
From Spring Framework 5.3 to 6.0
From Spring Framework 5.3 to 6.0From Spring Framework 5.3 to 6.0
From Spring Framework 5.3 to 6.0
 
Design Pattern
Design PatternDesign Pattern
Design Pattern
 
Rule Engine: Drools .Net
Rule Engine: Drools .NetRule Engine: Drools .Net
Rule Engine: Drools .Net
 
Spring framework IOC and Dependency Injection
Spring framework  IOC and Dependency InjectionSpring framework  IOC and Dependency Injection
Spring framework IOC and Dependency Injection
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Spring Boot & Actuators
Spring Boot & ActuatorsSpring Boot & Actuators
Spring Boot & Actuators
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
 
Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design Pattern
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Event Storming and Saga
Event Storming and SagaEvent Storming and Saga
Event Storming and Saga
 
A Java Microservices Spring Boot and Docker case study.
A Java Microservices Spring Boot and Docker case study.A Java Microservices Spring Boot and Docker case study.
A Java Microservices Spring Boot and Docker case study.
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
React js basics
React js basicsReact js basics
React js basics
 
Drools rule Concepts
Drools rule ConceptsDrools rule Concepts
Drools rule Concepts
 

Ähnlich wie Auto-scaling your API: Insights and Tips from the Zalando Team

Increasing velocity via serless semantics
Increasing velocity via serless semanticsIncreasing velocity via serless semantics
Increasing velocity via serless semanticsKfir Bloch
 
SAP portal: breaking and forensicating
SAP portal: breaking and forensicating SAP portal: breaking and forensicating
SAP portal: breaking and forensicating ERPScan
 
AWS Serverless API Management - Meetup
AWS Serverless API Management - MeetupAWS Serverless API Management - Meetup
AWS Serverless API Management - MeetupSamuel Vandecasteele
 
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...Alberto Salazar
 
DevOps Tooling - Pop-up Loft TLV 2017
DevOps Tooling - Pop-up Loft TLV 2017DevOps Tooling - Pop-up Loft TLV 2017
DevOps Tooling - Pop-up Loft TLV 2017Amazon Web Services
 
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API GatewayAWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API GatewayVadim Zendejas
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cachecornelia davis
 
Open-Falcon: A Distributed and High-Performance Monitoring System
Open-Falcon: A Distributed and High-Performance Monitoring SystemOpen-Falcon: A Distributed and High-Performance Monitoring System
Open-Falcon: A Distributed and High-Performance Monitoring SystemYao-Wei Ou
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made SimpleLuciano Mammino
 
Building an Observability Platform in 389 Difficult Steps
Building an Observability Platform in 389 Difficult StepsBuilding an Observability Platform in 389 Difficult Steps
Building an Observability Platform in 389 Difficult StepsDigitalOcean
 
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg PROIDEA
 
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...Alberto Salazar
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSAlberto Paro
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsScala Italy
 
Securing Serverless Architecture
Securing Serverless ArchitectureSecuring Serverless Architecture
Securing Serverless ArchitectureAmazon Web Services
 
AWS Startup Webinar | Developing on AWS
AWS Startup Webinar | Developing on AWSAWS Startup Webinar | Developing on AWS
AWS Startup Webinar | Developing on AWSAmazon Web Services
 

Ähnlich wie Auto-scaling your API: Insights and Tips from the Zalando Team (20)

Increasing velocity via serless semantics
Increasing velocity via serless semanticsIncreasing velocity via serless semantics
Increasing velocity via serless semantics
 
Varun-CV-J
Varun-CV-JVarun-CV-J
Varun-CV-J
 
SAP portal: breaking and forensicating
SAP portal: breaking and forensicating SAP portal: breaking and forensicating
SAP portal: breaking and forensicating
 
Serverless Microservices
Serverless MicroservicesServerless Microservices
Serverless Microservices
 
AWS Serverless API Management - Meetup
AWS Serverless API Management - MeetupAWS Serverless API Management - Meetup
AWS Serverless API Management - Meetup
 
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...
Oracle Code Javaday Sao Paulo Nowadays Architecture Trends, from Monolith to ...
 
DevOps Tooling - Pop-up Loft TLV 2017
DevOps Tooling - Pop-up Loft TLV 2017DevOps Tooling - Pop-up Loft TLV 2017
DevOps Tooling - Pop-up Loft TLV 2017
 
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API GatewayAWS Summit Barcelona 2015 - Introducing Amazon API Gateway
AWS Summit Barcelona 2015 - Introducing Amazon API Gateway
 
Effective DevSecOps
Effective DevSecOpsEffective DevSecOps
Effective DevSecOps
 
Cloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a CacheCloud-native Data: Every Microservice Needs a Cache
Cloud-native Data: Every Microservice Needs a Cache
 
Open-Falcon: A Distributed and High-Performance Monitoring System
Open-Falcon: A Distributed and High-Performance Monitoring SystemOpen-Falcon: A Distributed and High-Performance Monitoring System
Open-Falcon: A Distributed and High-Performance Monitoring System
 
AWS Observability Made Simple
AWS Observability Made SimpleAWS Observability Made Simple
AWS Observability Made Simple
 
Building an Observability Platform in 389 Difficult Steps
Building an Observability Platform in 389 Difficult StepsBuilding an Observability Platform in 389 Difficult Steps
Building an Observability Platform in 389 Difficult Steps
 
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
PLNOG15: The Power of the Open Standards SDN API’s - Mikael Holmberg
 
Knolx session
Knolx sessionKnolx session
Knolx session
 
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...
Oracle Developer Tour Latam Nowadays Architecture Trends, from Monolith to Mi...
 
Scala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJSScala Italy 2015 - Hands On ScalaJS
Scala Italy 2015 - Hands On ScalaJS
 
Alberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.jsAlberto Paro - Hands on Scala.js
Alberto Paro - Hands on Scala.js
 
Securing Serverless Architecture
Securing Serverless ArchitectureSecuring Serverless Architecture
Securing Serverless Architecture
 
AWS Startup Webinar | Developing on AWS
AWS Startup Webinar | Developing on AWSAWS Startup Webinar | Developing on AWS
AWS Startup Webinar | Developing on AWS
 

Mehr von Zalando Technology

Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...Zalando Technology
 
How We Made our Tech Organization and Architecture Converge Towards Scalability
How We Made our Tech Organization and Architecture Converge Towards ScalabilityHow We Made our Tech Organization and Architecture Converge Towards Scalability
How We Made our Tech Organization and Architecture Converge Towards ScalabilityZalando Technology
 
Powering Radical Agility with Docker
Powering Radical Agility with Docker Powering Radical Agility with Docker
Powering Radical Agility with Docker Zalando Technology
 
Flink in Zalando's World of Microservices
Flink in Zalando's World of Microservices  Flink in Zalando's World of Microservices
Flink in Zalando's World of Microservices Zalando Technology
 
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniZalando Technology
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnZalando Technology
 
Zalando Tech: From Java to Scala in Less Than Three Months
Zalando Tech: From Java to Scala in Less Than Three MonthsZalando Tech: From Java to Scala in Less Than Three Months
Zalando Tech: From Java to Scala in Less Than Three MonthsZalando Technology
 
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj TalkSpark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj TalkZalando Technology
 
Building a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickBuilding a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickZalando Technology
 
Radical Agility with Autonomous Teams and Microservices
Radical Agility with Autonomous Teams and MicroservicesRadical Agility with Autonomous Teams and Microservices
Radical Agility with Autonomous Teams and MicroservicesZalando Technology
 
Order Processing at Scale: Zalando at Camunda Community Day
Order Processing at Scale: Zalando at Camunda Community DayOrder Processing at Scale: Zalando at Camunda Community Day
Order Processing at Scale: Zalando at Camunda Community DayZalando Technology
 
ZMON: Monitoring Zalando's Engineering Platform
ZMON: Monitoring Zalando's Engineering PlatformZMON: Monitoring Zalando's Engineering Platform
ZMON: Monitoring Zalando's Engineering PlatformZalando Technology
 
Mobile Testing Challenges at Zalando Tech
Mobile Testing Challenges at Zalando TechMobile Testing Challenges at Zalando Tech
Mobile Testing Challenges at Zalando TechZalando Technology
 

Mehr von Zalando Technology (13)

Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
Stream Processing using Apache Flink in Zalando's World of Microservices - Re...
 
How We Made our Tech Organization and Architecture Converge Towards Scalability
How We Made our Tech Organization and Architecture Converge Towards ScalabilityHow We Made our Tech Organization and Architecture Converge Towards Scalability
How We Made our Tech Organization and Architecture Converge Towards Scalability
 
Powering Radical Agility with Docker
Powering Radical Agility with Docker Powering Radical Agility with Docker
Powering Radical Agility with Docker
 
Flink in Zalando's World of Microservices
Flink in Zalando's World of Microservices  Flink in Zalando's World of Microservices
Flink in Zalando's World of Microservices
 
High Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando PatroniHigh Availability PostgreSQL with Zalando Patroni
High Availability PostgreSQL with Zalando Patroni
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
 
Zalando Tech: From Java to Scala in Less Than Three Months
Zalando Tech: From Java to Scala in Less Than Three MonthsZalando Tech: From Java to Scala in Less Than Three Months
Zalando Tech: From Java to Scala in Less Than Three Months
 
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj TalkSpark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
 
Building a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & SlickBuilding a Reactive RESTful API with Akka Http & Slick
Building a Reactive RESTful API with Akka Http & Slick
 
Radical Agility with Autonomous Teams and Microservices
Radical Agility with Autonomous Teams and MicroservicesRadical Agility with Autonomous Teams and Microservices
Radical Agility with Autonomous Teams and Microservices
 
Order Processing at Scale: Zalando at Camunda Community Day
Order Processing at Scale: Zalando at Camunda Community DayOrder Processing at Scale: Zalando at Camunda Community Day
Order Processing at Scale: Zalando at Camunda Community Day
 
ZMON: Monitoring Zalando's Engineering Platform
ZMON: Monitoring Zalando's Engineering PlatformZMON: Monitoring Zalando's Engineering Platform
ZMON: Monitoring Zalando's Engineering Platform
 
Mobile Testing Challenges at Zalando Tech
Mobile Testing Challenges at Zalando TechMobile Testing Challenges at Zalando Tech
Mobile Testing Challenges at Zalando Tech
 

Kürzlich hochgeladen

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 

Kürzlich hochgeladen (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 

Auto-scaling your API: Insights and Tips from the Zalando Team

  • 1. Auto-scaling your API Insights and Tips from the Zalando Team JBCNConf 2015
 Barcelona, Spain Sean Patrick Floyd - @oldJavaGuy
 Luis Mineiro - @voidmaze
  • 2. 15 countries 3 fulfilment centers 15+ million active customers 2.2+ billion € revenue 2014 130+ million visits per month 8.000+ employees ONE of EUROPE’S LARGEST ONLINE FASHION RETAILERS Visit us: tech.zalando.com Tech hubs in Berlin, Dublin, Dortmund and Helsinki
  • 3. Our Scale Based on https://flic.kr/p/bX5E4c 2 datacenters thousands of production instances serving 15 countries
  • 4. Zalando stack Credits to our colleague Kolja Wilcke
  • 5. Credits to our colleague Kolja Wilcke
  • 6.
  • 7. Credits to our colleague Kolja Wilcke
  • 9. We call it “Jimmy” http://blog.codinghorror.com/new-programming-jargon/
  • 10. Thousands of Java classes, undocumented features Business logic on all layers (including the database) https://flic.kr/p/nBhvfy
  • 11. https://flic.kr/p/tW4sus It’s 2013…
 
 Zalando wants to sponsor hackathons… We need a REST API!
  • 12.
  • 14. First Step Let’s create some REST-(ish) Spring controllers inside our monolithic web application Deploy a couple of Jimmy instances just to serve requests for this “API”
  • 15. Pros The infrastructure is already there! A few days of coding and we’re all set
  • 16. Cons This “API” cannot be deployed independently of Jimmy. Jimmy is infested with business logic everywhere.
  • 18.
  • 19. New Requirements We needed this new API for our existing frontends, also (very high traffic). Some third-party apps also wanted to use this API as their backend.
  • 20. Shop Public API We decided to build a “real” API as a separate standalone project. Of course, there were some dependencies…
  • 21. Data Sources 1.Catalog - SOLr 2.Stock - Memcached 3.Reviews - REST(-ish) API 4.Recommendations - RPC 5.Database - PostgreSQL Shop Public API Catalog Stock Reviews Recommendations Database
  • 22. All of them in the same data centers. This should be no problem…
  • 24. Paradigm Shift Until 2014 We’re a Fashion Company that has a lot 
 of tech knowledge 2015 Suddenly we’re a Tech Company, providing “Fashion as a Service”
  • 27. API First Document and peer review your API in a format like Swagger before writing a single line of code. Ideally, either generate either your server interfaces or your test data (or both) from the Swagger spec
  • 28. REST
  • 29. REST Manipulate resources, don't call methods Expose nouns, not verbs Use HTTP verbs GET, PUT, POST, DELETE, PATCH
  • 30. SAAS
  • 31. Identity Management Our backend services don’t expose APIs yet Company-wide IAM strategy is not ready yet Can only expose read-only features for now
  • 33. Microservices We already have a Service-Oriented Architecture It was mostly SOAP, though… And definitely not micro
  • 34. CLOUD
  • 35. Road to AWS Some challenges ahead… 1. Backend services not available yet 2. SOLr also not available 3. We can’t just move the databases there
  • 37. Challenges Catalog and Stock datasources are latency critical and they’re owned by different teams!
  • 38. Can we solve that?
  • 39. Step 1 - move critical datasources to AWS
  • 40. “Move” Data Sources to AWS We can’t just move them! Jimmy also needs them in the data centers, you insensitive clod! Ok… we just replicate them.
  • 42. Replicating Data Sources SOLr has its own replication mechanism over HTTP memcached should be easy …
  • 44. Step 2 - Build memcached replication
  • 45. Stock Relay Memcached #1 Memcached #2 Memcached #3 Stock Relay(s) SNS Topic … Datacenter eu-central-1 Memcached ElasticCacheStock Repeater(s) Shop Public APISQS Queue eu-west-1 Memcached ElasticCacheStock Repeater(s) Shop Public APISQS Queue us-east-1 Memcached ElasticCacheStock Repeater(s) Shop Public APISQS Queue SET / DELETE GET GET GET
  • 47. AWS SOLr Repeater Datacenter Master eu-central-1 eu-west-1 us-east-1 SOLr Slaves Shop Public APIRegion Repeater SOLr Slaves Shop Public APIAWS Master Repeater SOLr Slaves Shop Public APIRegion Repeater
  • 48. Autoscaling SOLr and API http://www.docstoc.com/docs/109290533/Lucid-Imagination# by Erick Erickson Region repeater Slave #1 Autoscaling Group Slave #2 Slave n API Node #1 Autoscaling Group API Node #2 API Node n https://api.zalando.com
  • 49. Scaling Limitations Edited from https://flic.kr/p/zuBXM Region repeater Autoscaling Group Slave #1 Slave #2 Slave #3 Slave #3 Slave #3 Slave #3 Slave #11 Slave #18 Slave #3 Slave #34Slave #3 Slave #3 Slave #59 Slave #3 Slave #3 Slave #123 Slave #3 Slave #3 Slave #3 Slave #3 Slave #3 Slave #325 Slave #3 Slave #3 Slave #3 Slave #3 Slave #42815
  • 50. Y U no scale!
  • 51. S3 Bucket for Replication Datacenter Master eu-central-1 eu-west-1 us-east-1 SOLr Slaves Shop Public API Master Repeater SOLr Slaves Shop Public API SOLr Slaves Shop Public API S3replicationS3replication
  • 53. “Onion layers” for Replication • Start with a single repeater layer - layer0.solr • Setup a Route53 CNAME repeater that links to it - repeater.solr • Entire slave fleet in the ASG is always configured to replicate from repeater.solr CNAME repeater Slave #1 Autoscaling Group Slave #2 Slave n slave.solr layer0-repeater.solr
  • 54. “Onion layers” for Replication • Setup CloudWatch alarms for relevant metrics in the repeater layer. Give them some slack space. • Configure it to send notifications to the onion-layers-topic. • Bring up your instance of onion- layers. CloudWatch CNAME repeater Slave #1 Autoscaling Group Slave #2 Slave n slave.solr layer0-repeater.solr
  • 55. “Onion layers” for Replication • onion-layers creates a new ASG layer. Calculates currentLayer = currentLayer + 1 • The new layer starts replicating from layer<currentLayer-1>-repeater • Adds a new Route53 recordset layer<currentLayer>-repeater. CNAME repeater CloudWatch Autoscaling Group layer1-repeater.solr layer0-repeater.solr onion-layers Autoscaling Group slave.solr
  • 56. “Onion layers” for Replication • After replication, the CNAME repeater is updated to link to layer<currentLayer>-repeater. • onion-layers acts on alarms for the connection between current layer and previous layer. • You can still have your own AS alarms for the connection between slaves and current layer. CNAME repeater CloudWatch Autoscaling Group layer1-repeater.solr layer0-repeater.solr Autoscaling Group slave.solr
  • 57. Yes. These tools will be open-sourced soon
  • 58. Thank you for listening Check out our blog https://tech.zalando.com Our many open source products https://github.com/zalando The STUPS stack https://stups.io Got more questions? You can reach us on twitter @ZalandoTech We’re hiring! Special thanks to Jessie Dude. No Continuum Transfunctioners were harmed during the production of these slides.