SlideShare uma empresa Scribd logo
PRESENTED BY
Redis as Job Cache in an Auto-Scaling
Distributed Video Rendering Pipeline
Peter Karp
BuzzFeed, Staff Software Engineer
PRESENTED BY
Introduction
BuzzFeed creates ~100 hours of video content a week.
Many video production tasks are repetitive and tedious to do manually.
● Captions
● Adding overlay text to videos (translation, localization).
● Inserting promos, ads or slugs.
● Compilations of related short videos.
● Cut-downs to meet platform time limits.
Short-form videos created using custom editing tool - Vidder!
PRESENTED BY
Three iterations:
1. Prototype renderer as backend on a web server.
2. Production v.1 on microservice.
3. Production v.2 distributed multiprocessing with auto-scaling.
● Decompose rendering into smaller jobs.
● Run jobs on multiple microservers coordinated by a job cache in
Redis.
Problem: Rendering video is slow
PRESENTED BY
Stitcher v.2
Video Rendering Farm
Assemble video clips, images and text together into a video using a simple
json syntax, the Stitcher schema language – StitcherSL.
● Overlay (composite) text, images, video
● Join (stitch) video
● Trim, Crop, Resize, Position
● Captions - rendered between a start/end time
PRESENTED BY
Stitcher v.2
Tech Stack
● Python 3.6
● moviepy
● ffmpeg
● marshmallow
● Redis
PRESENTED BY
Stitcher v.2
Redis Job Cache Requirements
● Access to job info in a distributed microservice architecture
● Persist render jobs while jobs are running
● Long-term persistence not needed
○ Remove data after job is finished
How many have shot videos?
How many have
edited video
content?
Cutting physical media
Using complex interfaces
PRESENTED BY
Vidder
A Simplified Media Editing
Interface
PRESENTED BY
Vidder
A Simplified Media Editing
Interface
Stitcher schema language
Describes how to combine media into a video
● Clips
○ Video
○ Image
○ Text
● Schedules
○ Sequence
○ Parallel
Stitcher schema language - clips
● Video
{"clip": "video", "src": "final.mp4", "in_t": "00:00:05", "out_t": "00:00:07", "width": 1920, "height":
1080}
● Image
{"clip": "img", "src": "homesick_1920x1080_720.png", "dur": 5, "width": 1920, "height": 1080}
● Text
{"clip": "text", "txt": "The End", "dur": 5, "font": "Helvetica", "fontsize": 100, "color": "blue"}
Stitcher schema language - schedules
● Sequence
{"schedule": "seq", "clips": [ … ]}
● Parallel
{"schedule": "par", "clips": [ … ]}
Stitcher schema language - nesting
Schedules are clips too and can be nested!
{"schedule": "seq", "clips": [
{"schedule": "par", "clips": [
{"clip": "video", "src": "beer-ts.mp4", "in_t": "7.92", "out_t": "10.38"},
{"clip": "text", "txt": "Text and Video", "dur": 2.46, "fontsize": 78}
]},
{"schedule": "par", "clips": [
{"clip": "video", "src": "mars1-ts.mp4", "in_t": "0.00", "out_t": "3.33"},
{"clip": "text", "txt": "Text and Video again", "dur": 3.33, "fontsize": 78}
]}
]}
Stitcher schema language - nesting
Stitcher Architecture Evolution
1. Prototype - render in backend of a web server.
2. Production v.1 on microservice - render in a dedicated service.
3. Production v.2 distributed multiprocessing with auto-scaling.
● Decompose rendering into small tasks.
● Run jobs on auto-scaling microservice coordinated by Redis job cache.
Stitcher 0.1 Prototype
media_stitcher
S3
POST
https://stitcher.buzzfeed.com/media-stitcher/conform
{"schedule": "seq", "clips": [ … ]}
Stitcher System
Render engine
PRESENTED BY
Stitcher Prototype Demo
● Select 3 videos with search terms
in the slots.
● Select a clip from each video
using the offset + duration in the
slot.
● Use Stitcher to generate the
custom video
● Over 100K possible videos
25 search terms
~50 videos per search term
9 different offsets (10 - 90%)
9 different durations (1 - 9 seconds)
Video Slot Machine
Stitcher v.1
● Production ready.
● Separate servers for handling the api requests and rendering.
● Used as the video rendering engine for Vidder
Stitcher v.1
media_stitcher_apiVidder
qr_media_renderer
Render engine
S3
POST
https://stitcher.buzzfeed.com/media-stitcher/conform
{"schedule": "seq", "clips": [ … ]}
Stitcher System
Message Queue
qr_media_renderer microservice
msg.touch
Render engine
Validate input
Event handler
Message Queue
Task Complete()
Every 30
sec
multiprocessing.Pool
Cancel
msg.finish()
S3
webhook
PRESENTED BY
Vidder + Stitcher
Hitting some system limits
Stitcher v.2
● Distributed multi-server execution
● Coordination of tasks provided by a Redis Job Cache.
● Enhanced performance with auto-scaling microservice rendering.
● Larger projects are possible in Vidder
● Takes advantage of the independence between Vidder cells
○ Captions
○ Audio track
Media
Renderer
Cell-3
Render-1
Render-2
Render-3
Render-4
Stitcher
payload
{
Cell-1,
Cell-2,
Cell-3,
Cell-4,
}
Message queue
Redis
Job
Cach
e
Media
Renderer
Cell-1
Media
Renderer
Cell-2
Media
Renderer
Cell-4
Stitcher
S3Client Webhook
Media Stitcher
Media Stitcher
Various
Source
URLs
Media
Stitcher
Api
Stitcher v.2
1
2
4
3
5a 5b 5c 5d
67
9,
10
11
12
8
qr_media_renderer microservice
msg.touch
Render engine
Validate input
Event handler
Message Queue
Task Complete()
Every 30
sec
multiprocessing.Pool
Cancel
msg.finish()
S3
PRESENTED BY
Stitcher v.2
Auto-scaling
PRESENTED BY
Stitcher v.2
Redis Job Cache
1. Initialize cache for new job
○ Add unique job_id to jobs set - sadd
○ Add list of task status to status::{job_id} - rpush
2. Mark task with status (“success” or “error”)
○ Set task_id status to status::{job_id} - lset
○ Return True if all tasks set status - lrange
3. Remove job_id from jobs set - srem
PRESENTED BY
Stitcher v.2
Redis Job Cache
● No jobs - jobs set empty
○ {"jobs": []}
● One job in jobs set - 4 tasks “started”
○ "jobs": [{"job_id": "641049e2-4ab9-490e-b90d-fbeb46b18f0f", "size": "4", "status": ["started",
"started", "started", "started"], "started": 4}]}
● One job in jobs set - 2 tasks completed: “success”
○ "jobs": [{"job_id": "641049e2-4ab9-490e-b90d-fbeb46b18f0f", "size": "4", "status":
["started", "success", "started", "success"], "started": 2}]}
PRESENTED BY
Stitcher v.2
Video Rendering Farm
Stitcher v.1 vs v.2 Comparison
V.1 Rendering
Proved value of an automated
rendering pipeline
● Sequential Processing
● All cells processed on one instance
● Intermediate batching of 8-cells at a time
● 2 GB instance
● Long videos hit 15 minutes nsq timeout
V.2 Rendering
Render longer jobs faster on smaller instances
● Fast Parallel Processing
● One Vidder cell processed per instance
● No special-case handling
● 1 GB instance
● Single cells unlikely to hit limit
● Sub-divide jobs to decrease time
PRESENTED BY
Stitcher v.2
Increased Performance
Parallel Render Processing for
better performance
Job distributed across multiple
rendering servers
PRESENTED BY
Automated and assisted editing can
increase productivity in a high volume
production environment.
PRESENTED BY
Conclusion
Scaling video rendering tasks in a high-volume
production environment is challenging. Stitcher
makes it easier. Redis makes it faster.
Thank you!
PRESENTED BY

Mais conteúdo relacionado

Mais procurados

Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0
Cherie Williams
 

Mais procurados (19)

Statyczna analiza kodu PHP
Statyczna analiza kodu PHPStatyczna analiza kodu PHP
Statyczna analiza kodu PHP
 
Modern javascript localization with c-3po and the good old gettext
Modern javascript localization with c-3po and the good old gettextModern javascript localization with c-3po and the good old gettext
Modern javascript localization with c-3po and the good old gettext
 
Cme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration filesCme: a tool to edit and validate configuration files
Cme: a tool to edit and validate configuration files
 
Kubernetes Scheduler deep dive
Kubernetes Scheduler deep diveKubernetes Scheduler deep dive
Kubernetes Scheduler deep dive
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
Beaker: Automated, Cloud-Based Acceptance Testing - PuppetConf 2014
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHP
 
Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0Introducing Pebble SDK 2.0
Introducing Pebble SDK 2.0
 
Everything as a code
Everything as a codeEverything as a code
Everything as a code
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Managing development environments with Docksal
Managing development environments with DocksalManaging development environments with Docksal
Managing development environments with Docksal
 
From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017From Docker to Production - SunshinePHP 2017
From Docker to Production - SunshinePHP 2017
 
Taking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the ExtremeTaking Jenkins Pipeline to the Extreme
Taking Jenkins Pipeline to the Extreme
 
#PDR15 - waf, wscript and Your Pebble App
#PDR15 - waf, wscript and Your Pebble App#PDR15 - waf, wscript and Your Pebble App
#PDR15 - waf, wscript and Your Pebble App
 
Containers: What are they, Really?
Containers: What are they, Really?Containers: What are they, Really?
Containers: What are they, Really?
 
Ninja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for BeginnersNinja Build: Simple Guide for Beginners
Ninja Build: Simple Guide for Beginners
 
Devfest 2021' - Artifact Registry Introduction (Taipei)
Devfest 2021' - Artifact Registry Introduction (Taipei)Devfest 2021' - Artifact Registry Introduction (Taipei)
Devfest 2021' - Artifact Registry Introduction (Taipei)
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 

Semelhante a Redis as Job Cache in an Auto-Scaling Video Rendering Pipeline

An Integrated Asset Management Solution For Quantel sQ Servers
An Integrated Asset Management Solution For Quantel sQ ServersAn Integrated Asset Management Solution For Quantel sQ Servers
An Integrated Asset Management Solution For Quantel sQ Servers
Quantel
 
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Community
 

Semelhante a Redis as Job Cache in an Auto-Scaling Video Rendering Pipeline (20)

C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
Build 2016 - B880 - Top 6 Reasons to Move Your C++ Code to Visual Studio 2015
 
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
IMAGE CAPTURE, PROCESSING AND TRANSFER VIA ETHERNET UNDER CONTROL OF MATLAB G...
 
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
Our Puppet Story – Patterns and Learnings (sage@guug, March 2014)
 
An Integrated Asset Management Solution For Quantel sQ Servers
An Integrated Asset Management Solution For Quantel sQ ServersAn Integrated Asset Management Solution For Quantel sQ Servers
An Integrated Asset Management Solution For Quantel sQ Servers
 
PHP QA Tools
PHP QA ToolsPHP QA Tools
PHP QA Tools
 
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
Ceph Day Beijing: CeTune: A Framework of Profile and Tune Ceph Performance
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)Hack Like It's 2013 (The Workshop)
Hack Like It's 2013 (The Workshop)
 
[ElastixWorld 2016] mediasoup: Powerful WebRTC SFU for Node.js
[ElastixWorld 2016] mediasoup: Powerful WebRTC SFU for Node.js[ElastixWorld 2016] mediasoup: Powerful WebRTC SFU for Node.js
[ElastixWorld 2016] mediasoup: Powerful WebRTC SFU for Node.js
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Orchestrating the execution of workflows for media streaming service and even...
Orchestrating the execution of workflows for media streaming service and even...Orchestrating the execution of workflows for media streaming service and even...
Orchestrating the execution of workflows for media streaming service and even...
 
The Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session IThe Secrets of The FullStack Ninja - Part A - Session I
The Secrets of The FullStack Ninja - Part A - Session I
 
Madcap Case Study from Write2Users, Denmark
Madcap Case Study from Write2Users, DenmarkMadcap Case Study from Write2Users, Denmark
Madcap Case Study from Write2Users, Denmark
 
Building a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesBuilding a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York Times
 
Streaming Tech Sweden 2019 - Serverless Media Processing
Streaming Tech Sweden 2019 - Serverless Media ProcessingStreaming Tech Sweden 2019 - Serverless Media Processing
Streaming Tech Sweden 2019 - Serverless Media Processing
 
Building a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York TimesBuilding a Video Encoding Pipeline at The New York Times
Building a Video Encoding Pipeline at The New York Times
 
SDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLSSDAccel Design Contest: Vivado HLS
SDAccel Design Contest: Vivado HLS
 
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...
Second Skin: Real-Time Retheming a Legacy Web Application with Diazo in the C...
 

Último

AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
Alluxio, Inc.
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
mbmh111980
 

Último (20)

A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024IT Software Development Resume, Vaibhav jha 2024
IT Software Development Resume, Vaibhav jha 2024
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand5 Reasons Driving Warehouse Management Systems Demand
5 Reasons Driving Warehouse Management Systems Demand
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
Tree in the Forest - Managing Details in BDD Scenarios (live2test 2024)
 
The Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion ProductionThe Impact of PLM Software on Fashion Production
The Impact of PLM Software on Fashion Production
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
CompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdfCompTIA Security+ (Study Notes) for cs.pdf
CompTIA Security+ (Study Notes) for cs.pdf
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdfMicrosoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
Microsoft 365 Copilot; An AI tool changing the world of work _PDF.pdf
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
KLARNA -  Language Models and Knowledge Graphs: A Systems ApproachKLARNA -  Language Models and Knowledge Graphs: A Systems Approach
KLARNA - Language Models and Knowledge Graphs: A Systems Approach
 
Workforce Efficiency with Employee Time Tracking Software.pdf
Workforce Efficiency with Employee Time Tracking Software.pdfWorkforce Efficiency with Employee Time Tracking Software.pdf
Workforce Efficiency with Employee Time Tracking Software.pdf
 

Redis as Job Cache in an Auto-Scaling Video Rendering Pipeline

Notas do Editor

  1. Requires high performance system
  2. At BuzzFeed we created a simplified media editing tool Vidder to allow all our content creators make video without the dealing with the complexity of tools like Adobe Premier. Sends a request to Stitcher to render video
  3. Sends a request to Stitcher to render video
  4. EDL
  5. Render engine runs in a microservice that listens on message queue
  6. As users created longer content comprised of more cells Stitcher v.1 started to hit memory and time limits.
  7. Vidder sends render request API sends message to process payload Stitcher initializes Job Cache Stitcher splits payload and sends message to Renderers Renderers listen for message Renderers pull in source media Renderers save video to S3 and update Job Cache Last renderer to finish sends message to Media Stitcher. Stitcher pulls in saved videos and stitches together Stitcher saves complete video Stitcher sends webhook Vidder shows completed video
  8. Additional performance enhancment
  9. 1- each payload runs as separate task