SlideShare ist ein Scribd-Unternehmen logo
1 von 47
A Series Of Unfortunate Container Events
Netflix’s container platform lessons learned
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
netflix-titus
Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
About the speakers and team
Follow along - @sargun @tomaszbak_ca @fabiokung
@aspyker @amit_joshee @anwleung
2
Netflix’s container management platform
● Titus
● Scheduling
○ Service & batch jobs
○ Resource management
● Container Execution
○ Docker/AWS Integration
○ Netflix Infra Support
Service
Job Management
Resource Management & Optimization
Container Execution
Integration
Batch
3
Containers In
Production
4
Current Titus scale
● Deployed across multiple AWS accounts & three regions
● Over 5,000 instances (Mostly M4.4xls & R3.8xls)
● Over a week period launched over 1,000,000 containers
● Over 10,000 containers running concurrently
5
Single cloud platform for VMs and containers
● CI/CD (Spinnaker)
● Telemetry systems
● Discovery and RPC load balancing
● Healthcheck, Edda and system metrics
● Chaos monkey
● Traffic control (Flow & Kong)
● Netflix secure secret management
● Interactive access (ala ssh)
6
Integrate containers with AWS EC2
● VPC Connectivity (IP per container)
● Security Groups
● EC2 Metadata service
● IAM Roles
● Multi-tenant isolation (cpu, memory, disk quota, network)
● Live and S3 persisted logs rotation & mgmt
● Environmental context to similar to user data
● Autoscaling service jobs (coming)
7
● Service
○ Stream Processing (Flink)
○ UI Services (NodeJS)
○ Internal dashboards
● Batch
○ Personalization ML model training (GPUs)
○ Content value analysis
○ Digital watermarking
○ Ad hoc reporting
○ Continuous integration builds
○ Media encoding experimentation
Container users on Titus
Archer
8
Titus high level overview
9
RheaRheaTitus API
Cassandra
Titus Scheduler
● Job Lifecycle Control
● Resource Management
EC2 Autoscaling
Fenzo
9
container
container
container
docker
Titus Agents
Mesos agent
Docker
Docker Registry
containercontainerUser Containers
AWS Virtual Machines
Mesos
Titus System AgentsWorkflow
Systems
9
Look away, look away, Look away, look away
This session will wreck your evening​, your whole life, and your day
Every single episode is nothing but dismay
So, look away, Look away, look away
Lessons learned from a year in production?
10
Expect
Bad Actors
11
Run-away submissions
Submit a job, check status
If API doesn’t answer
assume 404 and re-submit
Problem:
User
12
Worked for our content processing job of 100 containers
Let’s run our “back-fill” -- 100s of thousands of containers
Problems
● Scheduler runs out of memory
● All other jobs get queued behind
Solutions
● Scheduler capacity groups
● Absolute caps on number of concurrent live jobs
● Upstream systems doing ingest control
System perceived as infinite queue
User
13
Uses REST/JSON poorly
{ env: { “PATH” : null } }
Problems
● Scheduler crashes, fails over, crashes, repeat
Solutions
● Input validation, input fuzz testing, exception handling
Invalid Jobs
User
14
Failing jobs that repeat
Image: “org/imagename:lateest”
Command: /bin/besh -c ...
Problems
● Containers can launch FAST! Can be restarted FAST!
● Scheduler works really hard
● Cloud resources allocated/deallocated FAST
Solutions
● Rate limiting of failing jobs
User
15
Problems
● Scheduler fails, can’t recover due to “bad” jobs
Solutions
Manual removal of bad job state? ✖ Test production data sets in staging
✔
Testing for “bad” job data
16
1. Export job data
2. Restore job data
3. Test recovery
4. Deploy new code
PROD
STAGING
PROD
Identifying bad actors
V2 API
● user (optional)
V2 Auditing
● Added collection of user
performing action
V3 API
● Owner -> teamEmail (required)
17
● User Namespaces
○ Docker 1.10 - User Namespaces (Feb 2016)
○ Docker 1.11 - Fixed shared networking NSs
■ User id mapping is per daemon (not per container)
○ Deployed user namespaces recently
■ Problems - shared NFS, OSX LDAP uid/gid’s
● Locked Down hosts
○ Users only have access to containers, not hosts
○ Required “power user” ssh access for perf/debugging
Really bad actors - container escapes protections
18
The Cloud Isn’t Perfect
19
Cloud rate limiting and overall limits
Let’s do a red/black deploy of 2000 containers instantly
Problems
● Scheduler and distributed host fleet ... no problem!
● Cloud provider … problem!
Solutions
● Exponential backoff with jitter on hosts
● Setting expectations of maximum concurrent launches
● Rate limiting of container scheduling and overall number of containers
User
20
Hosts start or go bad
Problems
● Hosts come up with flakey networks
● Host disks come up and are slow
● Hosts go bad over time
Solutions
● Scheduler must be aware
of host health checks
● Linux, storage, etc warming
● Auto-termination if hosts take too
long to become healthy
21
Upgrades - In place upgrades
● Simpler for container users
● Infrastructure becomes mutable
● Doesn’t leverage elastic cloud
● How to handle rollback?
Docker V1
Titus Agents V1
Mesos V1
Batch Container #1
Service Container #2
Docker V2
Titus Agents V2
Mesos V2
Batch Container #1
Service Container #2
Agent Agent with updates
✖
✖
✖
22
Upgrades - Whole cluster red/black
● Full red/black takes hours
● Costly (duplicate clusters)
● Insufficient Capacity Exception (ICE)
● Rollback requires ALL containers to move twice
✖
23
Upgrades - Partitioned cluster updates
● Requires complex scheduler knowledge
○ Batch jobs to have runtime limits
○ Service jobs with Spinnaker migration tasks
● Starting point for fleet cluster management
Docker V1
Titus Agents V1
Mesos V1
Batch Container #1
Service Container #2
Docker V2
Titus Agents V2
Mesos V2
Service Container #2
Let “drain”
old
new
✖
✖
✖
24
CI/CD
Task
Migration
Our Code Isn’t Perfect
25
Disconnected containers
Problem
● Host agent controllers lock up
● Control plane can’t kill replaced containers
User
● Why is my old code still running?
Solutions
● Monitor and alert on differences
● Reconcile to this system as
aggressively as possible Container
Scheduler
I’m running
You shouldn’t be!
Agent
Stop Container
×
×
Locked
Up
26
Scheduler failover speed is important
27
StandBy
C*
save
Active
C*
restore
Scheduler failover time increased
with scale
● Loss of API availability
● Reconciliation bugs caused task
crashes
Solutions:
● Data sharding (current vs old tasks)
● Do as little as possible during startup
Active Active✖
Know your dependencies
28
Agent
DNSS3Zookeeper
Problems
● Container creation errors
● Logs upload failure
● Task crashes
Solutions
● Retries
● Rate limiting
● Isolation
● Containers start with Docker .. end with the kernel
● Best container runtimes deeply leverage kernel primitives
○ Resource Isolation
○ Security
○ Networking etc
● Debugging tools (tracepoints, perf events) not container aware
○ Need for BPF, Kprobe
Containers require kernel knowledge
29
Problems
● Our instances fail
● Our code fails
● Our dependencies fail
Solutions
● Learn to love the Chaos Monkey
● Enabled for prod and all
services (even our scheduler)
Strategy: Embrace chaos
30
Alerting and dashboards key
Very complex system == very complex telemetry and alerting
Continuously evolving
● Based on real incidents and resulting deep analysis
Telemetry system Number
Metrics 100’s
Dashboard Graphs 70+
Alerts 50+
Elastic Search Indexes 4
31
Temporary ad hoc remediation
● Manual babysitting of scheduler state
● Pin high when auto-scaling and
capacity management isn’t work
● Automated for each ssh across all nodes
○ Detecting and remediating problems
32
What has worked well?
33
Solid software
Docker Distribution
● Our Docker registry
● Simple redirect on top of S3
Apache Mesos
● Extensible resource manager
● Highly reliable replicated log
Zookeeper
● Leader Election
● Isolated
Cassandra
● CDE Internal Service
● Careful of access model
34
Managing the Titus product
Focus on core business value
● Container cluster management
Features are important
● Deciding what not to do …
Just as important!
Deliberately chose NOT to do
● Service Discovery / RPC
● Continuous Delivery
35
Ops enablement
Phase 1: Manual red/black deploys
Phase 2: Runbook for on-call
Phase 3: Automated pipelines
Deploy New ASG
Find Current
Leader
Terminate Non
Leader Nodes
Terminate Current
Leader
36
Problem
● If you aren’t measuring, you don’t know
● If you don’t know, you can’t improve
Solutions
● Our SLOs
○ Start Latency
○ % Crashed
○ API Availability
● Once we started watching, we started improving
Service Level Objectives (SLOs)
37
Onboarding slowly
38
Documenting container readiness
● Broken down by type of application and feature set
● Readiness expressed in
○ Alpha (early users), beta (subject to change), GA (mass adoption)
39
Growing usage slowly, carefully
Titus Created
Batch GA
4Q 2015
Service Support
Added
1Q 2016
First Scale
Production Service
4Q 2016
Netflix Customer
Facing Service
2Q 2017
40
shadow
Key takeaways
● Expect problematic containers & workloads
● Continued need for cloud to evolve for containers
● Container schedulers, runtime are complex
● Ops enablement key for production systems
● Users need help adopting containers responsibly
● Worth the effort due to value containers unlock
41
Questions?
42
Backup
Titus High Level Overview
44
Titus UITitus UI
RheaRheaTitus API
Titus UI
Cassandra
Titus Master
Job Management &
Scheduler
Zookeeper
EC2
Auto-scaling API
Mesos Master
Fenzo
44
Docker
Registry
Docker
Registry
container
container
container
docker
Titus Agent
metrics agents
Titus executor
logging agent
btrfs
Mesos agent
Docker
S3
Docker
Registry
container
Pod & VPC network
drivers
containercontainer
AWS
metadata proxy
Integration
AWS VMs
Watch the video with slide synchronization on
InfoQ.com!
https://www.infoq.com/presentations/netflix-
titus

Weitere ähnliche Inhalte

Mehr von C4Media

Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDC4Media
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine LearningC4Media
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at SpeedC4Media
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsC4Media
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsC4Media
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerC4Media
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleC4Media
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeC4Media
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereC4Media
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing ForC4Media
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data EngineeringC4Media
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreC4Media
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsC4Media
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechC4Media
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/awaitC4Media
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaC4Media
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayC4Media
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?C4Media
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseCockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseC4Media
 
A Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with BrooklinA Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with BrooklinC4Media
 

Mehr von C4Media (20)

Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 
Navigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery TeamsNavigating Complexity: High-performance Delivery and Discovery Teams
Navigating Complexity: High-performance Delivery and Discovery Teams
 
High Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in AdtechHigh Performance Cooperative Distributed Systems in Adtech
High Performance Cooperative Distributed Systems in Adtech
 
Rust's Journey to Async/await
Rust's Journey to Async/awaitRust's Journey to Async/await
Rust's Journey to Async/await
 
Opportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven UtopiaOpportunities and Pitfalls of Event-Driven Utopia
Opportunities and Pitfalls of Event-Driven Utopia
 
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/DayDatadog: a Real-Time Metrics Database for One Quadrillion Points/Day
Datadog: a Real-Time Metrics Database for One Quadrillion Points/Day
 
Are We Really Cloud-Native?
Are We Really Cloud-Native?Are We Really Cloud-Native?
Are We Really Cloud-Native?
 
CockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL DatabaseCockroachDB: Architecture of a Geo-Distributed SQL Database
CockroachDB: Architecture of a Geo-Distributed SQL Database
 
A Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with BrooklinA Dive into Streams @LinkedIn with Brooklin
A Dive into Streams @LinkedIn with Brooklin
 

Kürzlich hochgeladen

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Kürzlich hochgeladen (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

A Series of Unfortunate Container Events @Netflix

  • 1. A Series Of Unfortunate Container Events Netflix’s container platform lessons learned
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/ netflix-titus
  • 3. Presented at QCon New York www.qconnewyork.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4. About the speakers and team Follow along - @sargun @tomaszbak_ca @fabiokung @aspyker @amit_joshee @anwleung 2
  • 5. Netflix’s container management platform ● Titus ● Scheduling ○ Service & batch jobs ○ Resource management ● Container Execution ○ Docker/AWS Integration ○ Netflix Infra Support Service Job Management Resource Management & Optimization Container Execution Integration Batch 3
  • 7. Current Titus scale ● Deployed across multiple AWS accounts & three regions ● Over 5,000 instances (Mostly M4.4xls & R3.8xls) ● Over a week period launched over 1,000,000 containers ● Over 10,000 containers running concurrently 5
  • 8. Single cloud platform for VMs and containers ● CI/CD (Spinnaker) ● Telemetry systems ● Discovery and RPC load balancing ● Healthcheck, Edda and system metrics ● Chaos monkey ● Traffic control (Flow & Kong) ● Netflix secure secret management ● Interactive access (ala ssh) 6
  • 9. Integrate containers with AWS EC2 ● VPC Connectivity (IP per container) ● Security Groups ● EC2 Metadata service ● IAM Roles ● Multi-tenant isolation (cpu, memory, disk quota, network) ● Live and S3 persisted logs rotation & mgmt ● Environmental context to similar to user data ● Autoscaling service jobs (coming) 7
  • 10. ● Service ○ Stream Processing (Flink) ○ UI Services (NodeJS) ○ Internal dashboards ● Batch ○ Personalization ML model training (GPUs) ○ Content value analysis ○ Digital watermarking ○ Ad hoc reporting ○ Continuous integration builds ○ Media encoding experimentation Container users on Titus Archer 8
  • 11. Titus high level overview 9 RheaRheaTitus API Cassandra Titus Scheduler ● Job Lifecycle Control ● Resource Management EC2 Autoscaling Fenzo 9 container container container docker Titus Agents Mesos agent Docker Docker Registry containercontainerUser Containers AWS Virtual Machines Mesos Titus System AgentsWorkflow Systems 9
  • 12. Look away, look away, Look away, look away This session will wreck your evening​, your whole life, and your day Every single episode is nothing but dismay So, look away, Look away, look away Lessons learned from a year in production? 10
  • 14. Run-away submissions Submit a job, check status If API doesn’t answer assume 404 and re-submit Problem: User 12
  • 15. Worked for our content processing job of 100 containers Let’s run our “back-fill” -- 100s of thousands of containers Problems ● Scheduler runs out of memory ● All other jobs get queued behind Solutions ● Scheduler capacity groups ● Absolute caps on number of concurrent live jobs ● Upstream systems doing ingest control System perceived as infinite queue User 13
  • 16. Uses REST/JSON poorly { env: { “PATH” : null } } Problems ● Scheduler crashes, fails over, crashes, repeat Solutions ● Input validation, input fuzz testing, exception handling Invalid Jobs User 14
  • 17. Failing jobs that repeat Image: “org/imagename:lateest” Command: /bin/besh -c ... Problems ● Containers can launch FAST! Can be restarted FAST! ● Scheduler works really hard ● Cloud resources allocated/deallocated FAST Solutions ● Rate limiting of failing jobs User 15
  • 18. Problems ● Scheduler fails, can’t recover due to “bad” jobs Solutions Manual removal of bad job state? ✖ Test production data sets in staging ✔ Testing for “bad” job data 16 1. Export job data 2. Restore job data 3. Test recovery 4. Deploy new code PROD STAGING PROD
  • 19. Identifying bad actors V2 API ● user (optional) V2 Auditing ● Added collection of user performing action V3 API ● Owner -> teamEmail (required) 17
  • 20. ● User Namespaces ○ Docker 1.10 - User Namespaces (Feb 2016) ○ Docker 1.11 - Fixed shared networking NSs ■ User id mapping is per daemon (not per container) ○ Deployed user namespaces recently ■ Problems - shared NFS, OSX LDAP uid/gid’s ● Locked Down hosts ○ Users only have access to containers, not hosts ○ Required “power user” ssh access for perf/debugging Really bad actors - container escapes protections 18
  • 21. The Cloud Isn’t Perfect 19
  • 22. Cloud rate limiting and overall limits Let’s do a red/black deploy of 2000 containers instantly Problems ● Scheduler and distributed host fleet ... no problem! ● Cloud provider … problem! Solutions ● Exponential backoff with jitter on hosts ● Setting expectations of maximum concurrent launches ● Rate limiting of container scheduling and overall number of containers User 20
  • 23. Hosts start or go bad Problems ● Hosts come up with flakey networks ● Host disks come up and are slow ● Hosts go bad over time Solutions ● Scheduler must be aware of host health checks ● Linux, storage, etc warming ● Auto-termination if hosts take too long to become healthy 21
  • 24. Upgrades - In place upgrades ● Simpler for container users ● Infrastructure becomes mutable ● Doesn’t leverage elastic cloud ● How to handle rollback? Docker V1 Titus Agents V1 Mesos V1 Batch Container #1 Service Container #2 Docker V2 Titus Agents V2 Mesos V2 Batch Container #1 Service Container #2 Agent Agent with updates ✖ ✖ ✖ 22
  • 25. Upgrades - Whole cluster red/black ● Full red/black takes hours ● Costly (duplicate clusters) ● Insufficient Capacity Exception (ICE) ● Rollback requires ALL containers to move twice ✖ 23
  • 26. Upgrades - Partitioned cluster updates ● Requires complex scheduler knowledge ○ Batch jobs to have runtime limits ○ Service jobs with Spinnaker migration tasks ● Starting point for fleet cluster management Docker V1 Titus Agents V1 Mesos V1 Batch Container #1 Service Container #2 Docker V2 Titus Agents V2 Mesos V2 Service Container #2 Let “drain” old new ✖ ✖ ✖ 24 CI/CD Task Migration
  • 27. Our Code Isn’t Perfect 25
  • 28. Disconnected containers Problem ● Host agent controllers lock up ● Control plane can’t kill replaced containers User ● Why is my old code still running? Solutions ● Monitor and alert on differences ● Reconcile to this system as aggressively as possible Container Scheduler I’m running You shouldn’t be! Agent Stop Container × × Locked Up 26
  • 29. Scheduler failover speed is important 27 StandBy C* save Active C* restore Scheduler failover time increased with scale ● Loss of API availability ● Reconciliation bugs caused task crashes Solutions: ● Data sharding (current vs old tasks) ● Do as little as possible during startup Active Active✖
  • 30. Know your dependencies 28 Agent DNSS3Zookeeper Problems ● Container creation errors ● Logs upload failure ● Task crashes Solutions ● Retries ● Rate limiting ● Isolation
  • 31. ● Containers start with Docker .. end with the kernel ● Best container runtimes deeply leverage kernel primitives ○ Resource Isolation ○ Security ○ Networking etc ● Debugging tools (tracepoints, perf events) not container aware ○ Need for BPF, Kprobe Containers require kernel knowledge 29
  • 32. Problems ● Our instances fail ● Our code fails ● Our dependencies fail Solutions ● Learn to love the Chaos Monkey ● Enabled for prod and all services (even our scheduler) Strategy: Embrace chaos 30
  • 33. Alerting and dashboards key Very complex system == very complex telemetry and alerting Continuously evolving ● Based on real incidents and resulting deep analysis Telemetry system Number Metrics 100’s Dashboard Graphs 70+ Alerts 50+ Elastic Search Indexes 4 31
  • 34. Temporary ad hoc remediation ● Manual babysitting of scheduler state ● Pin high when auto-scaling and capacity management isn’t work ● Automated for each ssh across all nodes ○ Detecting and remediating problems 32
  • 35. What has worked well? 33
  • 36. Solid software Docker Distribution ● Our Docker registry ● Simple redirect on top of S3 Apache Mesos ● Extensible resource manager ● Highly reliable replicated log Zookeeper ● Leader Election ● Isolated Cassandra ● CDE Internal Service ● Careful of access model 34
  • 37. Managing the Titus product Focus on core business value ● Container cluster management Features are important ● Deciding what not to do … Just as important! Deliberately chose NOT to do ● Service Discovery / RPC ● Continuous Delivery 35
  • 38. Ops enablement Phase 1: Manual red/black deploys Phase 2: Runbook for on-call Phase 3: Automated pipelines Deploy New ASG Find Current Leader Terminate Non Leader Nodes Terminate Current Leader 36
  • 39. Problem ● If you aren’t measuring, you don’t know ● If you don’t know, you can’t improve Solutions ● Our SLOs ○ Start Latency ○ % Crashed ○ API Availability ● Once we started watching, we started improving Service Level Objectives (SLOs) 37
  • 41. Documenting container readiness ● Broken down by type of application and feature set ● Readiness expressed in ○ Alpha (early users), beta (subject to change), GA (mass adoption) 39
  • 42. Growing usage slowly, carefully Titus Created Batch GA 4Q 2015 Service Support Added 1Q 2016 First Scale Production Service 4Q 2016 Netflix Customer Facing Service 2Q 2017 40 shadow
  • 43. Key takeaways ● Expect problematic containers & workloads ● Continued need for cloud to evolve for containers ● Container schedulers, runtime are complex ● Ops enablement key for production systems ● Users need help adopting containers responsibly ● Worth the effort due to value containers unlock 41
  • 46. Titus High Level Overview 44 Titus UITitus UI RheaRheaTitus API Titus UI Cassandra Titus Master Job Management & Scheduler Zookeeper EC2 Auto-scaling API Mesos Master Fenzo 44 Docker Registry Docker Registry container container container docker Titus Agent metrics agents Titus executor logging agent btrfs Mesos agent Docker S3 Docker Registry container Pod & VPC network drivers containercontainer AWS metadata proxy Integration AWS VMs
  • 47. Watch the video with slide synchronization on InfoQ.com! https://www.infoq.com/presentations/netflix- titus