SlideShare a Scribd company logo
Scalable and Reliable
Logging at Pinterest
Krishna Gade
krishna@pinterest.com
Yu Yang
yuyang@pinterest.com
Agenda
• What is Pinterest?
• Logging Infrastructure Deep-dive
• Managing Log Quality
• Summary & Questions
What is Pinterest?
What is Pinterest?
Pinterest is a discovery
engine
What is the weather in SF today?
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
What is central limit theorem?
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
What do I cook for dinner today?
What’s my style?
Where shall we travel this summer?
Pinterest is solving
this
discovery problem
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
Humans
+
Algorithms
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
DataEngConf SF16 - Scalable and Reliable Logging at Pinterest
Kafka
App
Data Architecture
Singer
Qubole
(Hadoop, Spark)
Merced
Pinball Skyline
Redshift
Pinalytics
Product
Storm Stingray
A/B Testing
Logging Infrastructure
Logging Infrastructure
Requirements
• High availability
• Minimum data loss
• Horizontal scalability
• Low latency
• Minimum operation overhead
Pinterest Logging Infrastructure
• thousands of hosts
• >120 billion messages, tens of
terabytes per day
• Kafka as the central message
transportation hub
• >500 Kafka brokers
• home-grown technologies for
logging to Kafka and moving data
from Kafka to cloud storage
AppServers
events
Kafka
Cloud storage
Logging Infrastructure v1
events
Kafka 0.7
Host
app
app
app
data uploader
Real-time consumers
Problems with Kafka 0.7 pipelines
• Data loss
• Kafka 0.7 broker failure —> data loss
• high back pressure —> data loss
• Operability
• broker replacement —> reboot all dependent
services to pick up the latest broker list
Challenges with Kafka that
supports replication
• Multiple copies of messages among brokers
• cannot copy message directly to S3 to
guarantee exact once persistence
• Cannot randomly pick Kafka brokers to write to
• Need to find the leader of each topic partition
• Handle various corner cases
Logging Infrastructure v2
events
Kafka 0.8
Host
app
log files
Singer
Secor/Merced
Sanitizer
Real-time consumers
Logging Agent Requirement
• reliability
• high throughput, low latency
• minimum computation resource usage
• support various log file format (text, thrift, etc.)
• fairness scheduling
Singer Logging Agent
• Simple logging mechanism
• applications log to disk
• Singer monitors file system events and uploads logs to Kafka
• Isolate applications from Singer agent failures
• Isolate applications from Kafka failures
• >100MB/second for log files in thrift
• Production Environment Support
• dynamic configuration detection
• adjustable log uploading latency
• auditing
• heartbeat mechanism
Host
app
log files
Singer
Singer Internals
Singer Architecture
LogStream
monitor
Configuration
watcher
Reader Writer
Log
repository
Reader Writer
Reader Writer
Reader Writer
Log configuration
LogStream processors
A - 1
A -2
B - 1
C - 1
Log configuration
Staged Event Driven Architecture
Running Kafka in the Cloud
• Challenges
• brokers can die unexpectedly
• EBS I/O performance can degrade
significantly due to resource contention
• Avoid virtual hosts co-location on the same
physical host
• faster recovery
Running Kafka in the Cloud
• Initial settings
• c3.2xlarge + EBS
• Current settings
• d2.xlarge
• local disks help to avoid EBS contention problem
• minimize data on each broker for faster recovery
• availability zone aware topic partition allocation
• multiple small clusters (20-40 brokers) for topic isolation
Scalable Data Persistence
33
• Strong consistency: each message is
saved exactly once
• Fault tolerance: any worker node is
allowed to crash
• Load distribution
• Horizontal scalability
• Configurable upload policies
events
Kafka 0.8
Secor/Merced
Secor
34
• Uses Kafka high level consumer
• Strong consistency: each message is
saved exactly once
• Fault tolerance: any worker node is
allowed to crash
• Load distribution
• Configurable upload policies
events
Kafka 0.8
Secor
Challenges with consensus-based workload
distribution
• Kafka consumer group rebalancing can prevent
consumer from making progress
• It is difficult to recover when high-level consumer lags
behind on some topic partitions
• Manual tuning is required for workload distribution of
multiple topics
• Inconvenient to add new topics
• Efficiency
Merced
• central workload
distribution
• master creates
tasks
• master and workers
communicate
through zookeeper
Merced
Log Quality
Log Quality
Log quality can be broken down into two areas:
• log reliability - Reliability is fairly easy to
measure: did we lose any data?
• log correctness - Correctness, on the other
hand, is much more difficult as it requires the
interpretation of data.
Challenges
• Instrumentation is an after-thought for most feature
developers
• Features can get shipped breaking existing logging
or no logging
• Once an iOS or Android release is out, it will keep
generating bad data for weeks
• Data quality bugs are harder to find and fix
compared to code quality
Tooling
Anomaly Detection
• Started with a simple model based
on the assumption that daily
changes are normally distributed.
• Revised that model until it has only a
few alerts, mostly real and important.
• Hooked it up to a daily email to our
metrics avengers.
How did we do?
• Interest follows went up after we started emailing
recommended interests to follow
• Push notifications about board follows broke
• Signups from Google changed as we ran experiments
• Our tracking broke when we released a new repin
experience
• Our tracking of mobile web signups changed
Auditing Logs
Manual audits will have their limitations, especially with
regards to coverage but will catch critical bugs.
• However, we need two things:
• Repeatable process that can scale
• Tooling required to support the process
• Regression Audit
• Maintain a playbook of "core logging actions"
• Use tooling to verify the output of the actions
• New Feature Audit
• Gather requirements for analysis and produce a list of events that
need to be captured with the feature
• Instrument the application
• Test the logging output using existing tooling
Summary
• Invest in your logging infra pretty early on.
• Kafka has matured a lot and with some tuning works
well in the Cloud.
• Data quality is not free, need to proactively ensure it.
• Invest in automated tools to detect quality issues
both pre- and post-release.
• Culture building and education go a long way.
Thank you!
Btw, we’re hiring :)
Questions?

More Related Content

PDF
DataEngConf SF16 - Unifying Real Time and Historical Analytics with the Lambd...
PPTX
DataEngConf SF16 - High cardinality time series search
PDF
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
PDF
Events and metrics the Lifeblood of Webops
PDF
Ml sprint16 thesis_intro
PDF
Scalable and Reliable Logging at Pinterest
PDF
Disaster Recovery Plans for Apache Kafka
PPTX
Kafka Summit NYC 2017 - Apache Kafka in the Enterprise: What if it Fails?
DataEngConf SF16 - Unifying Real Time and Historical Analytics with the Lambd...
DataEngConf SF16 - High cardinality time series search
DataEngConf SF16 - Methods for Content Relevance at LinkedIn
Events and metrics the Lifeblood of Webops
Ml sprint16 thesis_intro
Scalable and Reliable Logging at Pinterest
Disaster Recovery Plans for Apache Kafka
Kafka Summit NYC 2017 - Apache Kafka in the Enterprise: What if it Fails?

What's hot (18)

PDF
The Netflix Way to deal with Big Data Problems
PDF
Docker Usage Patterns - Meetup Docker Paris - November, 10th 2015
PPTX
Lifting the Blinds: Monitoring Windows Server 2012
PDF
Pivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
PDF
A Practical Guide to Selecting a Stream Processing Technology
PDF
RedisConf18 - Transforming Vulnerability Telemetry with Redis Enterprise
PDF
The Future of ETL Isn't What It Used to Be
PDF
AWS Re-Invent 2017 Netflix Keystone SPaaS - Monal Daxini - Abd320 2017
PPTX
High cardinality time series search: A new level of scale - Data Day Texas 2016
PPTX
Streaming Data Integration - For Women in Big Data Meetup
PDF
Scaling monitoring with Datadog
PPTX
Building an Event-oriented Data Platform with Kafka, Eric Sammer
PDF
Integrating Apache Kafka and Elastic Using the Connect Framework
PDF
Apache kafka-a distributed streaming platform
PDF
Simplify Governance of Streaming Data
PDF
netflix-real-time-data-strata-talk
PDF
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
PPTX
The evolution of the big data platform @ Netflix (OSCON 2015)
The Netflix Way to deal with Big Data Problems
Docker Usage Patterns - Meetup Docker Paris - November, 10th 2015
Lifting the Blinds: Monitoring Windows Server 2012
Pivoting Spring XD to Spring Cloud Data Flow with Sabby Anandan
A Practical Guide to Selecting a Stream Processing Technology
RedisConf18 - Transforming Vulnerability Telemetry with Redis Enterprise
The Future of ETL Isn't What It Used to Be
AWS Re-Invent 2017 Netflix Keystone SPaaS - Monal Daxini - Abd320 2017
High cardinality time series search: A new level of scale - Data Day Texas 2016
Streaming Data Integration - For Women in Big Data Meetup
Scaling monitoring with Datadog
Building an Event-oriented Data Platform with Kafka, Eric Sammer
Integrating Apache Kafka and Elastic Using the Connect Framework
Apache kafka-a distributed streaming platform
Simplify Governance of Streaming Data
netflix-real-time-data-strata-talk
Akka Streams And Kafka Streams: Where Microservices Meet Fast Data
The evolution of the big data platform @ Netflix (OSCON 2015)
Ad

Viewers also liked (15)

PDF
DataEngConf SF16 - BYOMQ: Why We [re]Built IronMQ
PDF
DataEngConf SF16 - Data Asserts: Defensive Data Science
PDF
DataEngConf SF16 - Beginning with Ourselves
PDF
DataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
PDF
DataEngConf SF16 - Deriving Meaning from Wearable Sensor Data
PDF
DataEngConf SF16 - Three lessons learned from building a production machine l...
PDF
DataEngConf SF16 - Collecting and Moving Data at Scale
PDF
DataEngConf SF16 - Bridging the gap between data science and data engineering
PDF
DataEngConf SF16 - Running simulations at scale
PDF
DataEngConf SF16 - Tales from the other side - What a hiring manager wish you...
PDF
DataEngConf SF16 - Recommendations at Instacart
PDF
DataEngConf SF16 - Entity Resolution in Data Pipelines Using Spark
PDF
Always Valid Inference (Ramesh Johari, Stanford)
PDF
DataEngConf SF16 - Multi-temporal Data Structures
PDF
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
DataEngConf SF16 - BYOMQ: Why We [re]Built IronMQ
DataEngConf SF16 - Data Asserts: Defensive Data Science
DataEngConf SF16 - Beginning with Ourselves
DataEngConf SF16 - Routing Billions of Analytics Events with High Deliverability
DataEngConf SF16 - Deriving Meaning from Wearable Sensor Data
DataEngConf SF16 - Three lessons learned from building a production machine l...
DataEngConf SF16 - Collecting and Moving Data at Scale
DataEngConf SF16 - Bridging the gap between data science and data engineering
DataEngConf SF16 - Running simulations at scale
DataEngConf SF16 - Tales from the other side - What a hiring manager wish you...
DataEngConf SF16 - Recommendations at Instacart
DataEngConf SF16 - Entity Resolution in Data Pipelines Using Spark
Always Valid Inference (Ramesh Johari, Stanford)
DataEngConf SF16 - Multi-temporal Data Structures
DatEngConf SF16 - Apache Kudu: Fast Analytics on Fast Data
Ad

Similar to DataEngConf SF16 - Scalable and Reliable Logging at Pinterest (20)

PPTX
Distributed Kafka Architecture Taboola Scale
PPTX
Kubernetes at NU.nl (Kubernetes meetup 2019-09-05)
PDF
Agile infrastructure
PPTX
Asynchronous design with Spring and RTI: 1M events per second
PPTX
Cloud Security Monitoring and Spark Analytics
PDF
Fixing twitter
PDF
Fixing_Twitter
PDF
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
PDF
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
PDF
John adams talk cloudy
PDF
AWS for Java Developers workshop
PDF
Building real time data-driven products
PDF
Continuous Delivery: releasing Better and Faster at Dashlane
PDF
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates Uncovered
PPTX
Understanding cloud with Google Cloud Platform
PDF
OSMC 2023 | Current State of Icinga by Bernd Erk
PDF
Kafka Summit SF 2017 - Running Kafka for Maximum Pain
PDF
Chirp 2010: Scaling Twitter
PDF
Monitoring MySQL at scale
PPTX
Automated Data Synchronization: Data Loader, Data Mirror & Beyond
Distributed Kafka Architecture Taboola Scale
Kubernetes at NU.nl (Kubernetes meetup 2019-09-05)
Agile infrastructure
Asynchronous design with Spring and RTI: 1M events per second
Cloud Security Monitoring and Spark Analytics
Fixing twitter
Fixing_Twitter
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
Fixing Twitter Improving The Performance And Scalability Of The Worlds Most ...
John adams talk cloudy
AWS for Java Developers workshop
Building real time data-driven products
Continuous Delivery: releasing Better and Faster at Dashlane
Ruslan Belkin And Sean Dawson on LinkedIn's Network Updates Uncovered
Understanding cloud with Google Cloud Platform
OSMC 2023 | Current State of Icinga by Bernd Erk
Kafka Summit SF 2017 - Running Kafka for Maximum Pain
Chirp 2010: Scaling Twitter
Monitoring MySQL at scale
Automated Data Synchronization: Data Loader, Data Mirror & Beyond

More from Hakka Labs (12)

PDF
DataEngConf SF16 - Spark SQL Workshop
PDF
DataEngConf: Building a Music Recommender System from Scratch with Spotify Da...
PDF
DataEngConf: Data Science at the New York Times by Chris Wiggins
PPTX
DataEngConf: Building the Next New York Times Recommendation Engine
PDF
DataEngConf: Measuring Impact with Data in a Distributed World at Conde Nast
PDF
DataEngConf: Feature Extraction: Modern Questions and Challenges at Google
PPTX
DataEngConf: Talkographics: Using What Viewers Say Online to Measure TV and B...
PPTX
DataEngConf: The Science of Virality at BuzzFeed
PPTX
DataEngConf: Uri Laserson (Data Scientist, Cloudera) Scaling up Genomics with...
PDF
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
PPTX
DataEngConf: Apache Kafka at Rocana: a scalable, distributed log for machine ...
PPTX
DataEngConf: Building Satori, a Hadoop toll for Data Extraction at LinkedIn
DataEngConf SF16 - Spark SQL Workshop
DataEngConf: Building a Music Recommender System from Scratch with Spotify Da...
DataEngConf: Data Science at the New York Times by Chris Wiggins
DataEngConf: Building the Next New York Times Recommendation Engine
DataEngConf: Measuring Impact with Data in a Distributed World at Conde Nast
DataEngConf: Feature Extraction: Modern Questions and Challenges at Google
DataEngConf: Talkographics: Using What Viewers Say Online to Measure TV and B...
DataEngConf: The Science of Virality at BuzzFeed
DataEngConf: Uri Laserson (Data Scientist, Cloudera) Scaling up Genomics with...
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
DataEngConf: Apache Kafka at Rocana: a scalable, distributed log for machine ...
DataEngConf: Building Satori, a Hadoop toll for Data Extraction at LinkedIn

Recently uploaded (20)

PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Spectral efficient network and resource selection model in 5G networks
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Digital-Transformation-Roadmap-for-Companies.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Dropbox Q2 2025 Financial Results & Investor Presentation
Chapter 3 Spatial Domain Image Processing.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
NewMind AI Weekly Chronicles - August'25 Week I
NewMind AI Monthly Chronicles - July 2025
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication

DataEngConf SF16 - Scalable and Reliable Logging at Pinterest

  • 1. Scalable and Reliable Logging at Pinterest Krishna Gade krishna@pinterest.com Yu Yang yuyang@pinterest.com
  • 2. Agenda • What is Pinterest? • Logging Infrastructure Deep-dive • Managing Log Quality • Summary & Questions
  • 4. What is Pinterest? Pinterest is a discovery engine
  • 5. What is the weather in SF today?
  • 7. What is central limit theorem?
  • 10. What do I cook for dinner today?
  • 12. Where shall we travel this summer?
  • 20. Kafka App Data Architecture Singer Qubole (Hadoop, Spark) Merced Pinball Skyline Redshift Pinalytics Product Storm Stingray A/B Testing
  • 22. Logging Infrastructure Requirements • High availability • Minimum data loss • Horizontal scalability • Low latency • Minimum operation overhead
  • 23. Pinterest Logging Infrastructure • thousands of hosts • >120 billion messages, tens of terabytes per day • Kafka as the central message transportation hub • >500 Kafka brokers • home-grown technologies for logging to Kafka and moving data from Kafka to cloud storage AppServers events Kafka Cloud storage
  • 24. Logging Infrastructure v1 events Kafka 0.7 Host app app app data uploader Real-time consumers
  • 25. Problems with Kafka 0.7 pipelines • Data loss • Kafka 0.7 broker failure —> data loss • high back pressure —> data loss • Operability • broker replacement —> reboot all dependent services to pick up the latest broker list
  • 26. Challenges with Kafka that supports replication • Multiple copies of messages among brokers • cannot copy message directly to S3 to guarantee exact once persistence • Cannot randomly pick Kafka brokers to write to • Need to find the leader of each topic partition • Handle various corner cases
  • 27. Logging Infrastructure v2 events Kafka 0.8 Host app log files Singer Secor/Merced Sanitizer Real-time consumers
  • 28. Logging Agent Requirement • reliability • high throughput, low latency • minimum computation resource usage • support various log file format (text, thrift, etc.) • fairness scheduling
  • 29. Singer Logging Agent • Simple logging mechanism • applications log to disk • Singer monitors file system events and uploads logs to Kafka • Isolate applications from Singer agent failures • Isolate applications from Kafka failures • >100MB/second for log files in thrift • Production Environment Support • dynamic configuration detection • adjustable log uploading latency • auditing • heartbeat mechanism Host app log files Singer
  • 30. Singer Internals Singer Architecture LogStream monitor Configuration watcher Reader Writer Log repository Reader Writer Reader Writer Reader Writer Log configuration LogStream processors A - 1 A -2 B - 1 C - 1 Log configuration Staged Event Driven Architecture
  • 31. Running Kafka in the Cloud • Challenges • brokers can die unexpectedly • EBS I/O performance can degrade significantly due to resource contention • Avoid virtual hosts co-location on the same physical host • faster recovery
  • 32. Running Kafka in the Cloud • Initial settings • c3.2xlarge + EBS • Current settings • d2.xlarge • local disks help to avoid EBS contention problem • minimize data on each broker for faster recovery • availability zone aware topic partition allocation • multiple small clusters (20-40 brokers) for topic isolation
  • 33. Scalable Data Persistence 33 • Strong consistency: each message is saved exactly once • Fault tolerance: any worker node is allowed to crash • Load distribution • Horizontal scalability • Configurable upload policies events Kafka 0.8 Secor/Merced
  • 34. Secor 34 • Uses Kafka high level consumer • Strong consistency: each message is saved exactly once • Fault tolerance: any worker node is allowed to crash • Load distribution • Configurable upload policies events Kafka 0.8 Secor
  • 35. Challenges with consensus-based workload distribution • Kafka consumer group rebalancing can prevent consumer from making progress • It is difficult to recover when high-level consumer lags behind on some topic partitions • Manual tuning is required for workload distribution of multiple topics • Inconvenient to add new topics • Efficiency
  • 36. Merced • central workload distribution • master creates tasks • master and workers communicate through zookeeper
  • 39. Log Quality Log quality can be broken down into two areas: • log reliability - Reliability is fairly easy to measure: did we lose any data? • log correctness - Correctness, on the other hand, is much more difficult as it requires the interpretation of data.
  • 40. Challenges • Instrumentation is an after-thought for most feature developers • Features can get shipped breaking existing logging or no logging • Once an iOS or Android release is out, it will keep generating bad data for weeks • Data quality bugs are harder to find and fix compared to code quality
  • 42. Anomaly Detection • Started with a simple model based on the assumption that daily changes are normally distributed. • Revised that model until it has only a few alerts, mostly real and important. • Hooked it up to a daily email to our metrics avengers.
  • 43. How did we do? • Interest follows went up after we started emailing recommended interests to follow • Push notifications about board follows broke • Signups from Google changed as we ran experiments • Our tracking broke when we released a new repin experience • Our tracking of mobile web signups changed
  • 44. Auditing Logs Manual audits will have their limitations, especially with regards to coverage but will catch critical bugs. • However, we need two things: • Repeatable process that can scale • Tooling required to support the process • Regression Audit • Maintain a playbook of "core logging actions" • Use tooling to verify the output of the actions • New Feature Audit • Gather requirements for analysis and produce a list of events that need to be captured with the feature • Instrument the application • Test the logging output using existing tooling
  • 45. Summary • Invest in your logging infra pretty early on. • Kafka has matured a lot and with some tuning works well in the Cloud. • Data quality is not free, need to proactively ensure it. • Invest in automated tools to detect quality issues both pre- and post-release. • Culture building and education go a long way.