SlideShare a Scribd company logo
1 of 55
1
Scaling Stack Overflow
David Fullerton, VP Engineering • @df07
QCon NYC • 2015-06-12
2
**SPOILERS**
3
Conclusions
1. Our architecture is boring
4
Conclusions
1. Our architecture is boring
1. How we keep it boring is interesting
5
What’s Stack Overflow?
6
Q&A for Programmers
• 9.4M questions
• 16M answers
• 45M uniques / month
• 8,000 new questions every day
(quantcast.com/stackoverflow.com)
7
Developer Jobs
• Best place on the internet to get a programming
job or hire a developer
8
Part of Stack Exchange Network
• Stack Overflow-style Q&A in 143 other topics &
languages
9
A Distributed Team
• 34 developers, 6 sysadmins, 6 designers
• 75% remote
10
A Distributed Team
• 34 developers, 6 sysadmins, 6 designers
• 75% remote
11
How do we work?
• Remote work culture
• Hire smart people and get out of their way
• Full-stack developers / sysadmins with a
specialty
12
Our Architecture
(I warned you, it’s boring)
13(stackexchange.com/performance)
14
“Monolith Plus” architecture
• Almost everything happens in
the web tier + DB
• A few services pulled out and
optimized
15
Scales pretty well (for us)
• 4 billion requests per month, 3000 req/s peak
• 800M SQL queries per day, 8500/s peak
16
(opserver – https://github.com/opserver/opserver)
17
(opserver – https://github.com/opserver/opserver)
18
New York
(primary)
Oregon
(secondary)
Availability (also boring)
19
Deploys
• All day every day
• Rolling deploys through the web tier
(TeamCity)
Fast!
20
Testing
• Test on our users
• Feature flag
– Turn it on for a subset of sites to see how it
performs
21
* Works for us!
• Read-heavy load centered on one page
• Not as much customized content as some sites
• A forgiving community
22
23
How did we get here?
24
Our Process
1. Start with what we know
2. Measure it live
3. Fix the slow
25
Step 1: Start with what we know
• Original developers knew C# and MSSQL
• Started with a bunch of off-the-shelf tools:
– ASP.NET MVC
– LINQ to SQL
– MSSQL + SQL fulltext search
– Built-in caching (no Redis)
26
Step 2: Measure it live
• Performance is a feature!
• Test under real load
• Measure, don’t guess
27
(miniprofiler – https://github.com/MiniProfiler/dotnet)
28
(miniprofiler – https://github.com/MiniProfiler/dotnet)
29
(opserver – https://github.com/opserver/opserver)
30
(opserver – https://github.com/opserver/opserver)
31
Step 3: Fix the slow
• Slow performance is a bug, fix it now!
• Over time, replace major parts of our stack:
– Caching and Redis
– SQL access
– Tag Engine
– Elasticsearch
32
• Already hand-rolling queries for performance
• LINQ to SQL provides basic ORM:
Dapper
33
• Problem:
Dapper
34
• Solution: replace the object mapper
• Idea: emit raw IL, then cache mapper
Dapper
35
• Results (500 iterations):
Dapper
(dapper– https://code.google.com/p/dapper-dot-net/)
36
Tag Engine
37
Tag Engine
• Early hack: use SQL fulltext search to index tags
38
Tag Engine
• Problem:
39
Tag Engine
• Problem:
• Performance!
40
Tag Engine
• Highly custom in-memory tag index cache
• Carefully memory-managed to avoid GC stalls
– Learned the hard way: see “Assault by GC” by
Marc Gravell
• Serialize / deserialize from disk on build
41
Results
42
Results
1. Start with what we know
2. Measure it live
3. Fix the slow
Optimize for performance,
get scale thrown in
43
Results
• “Monolith Plus” architecture
• Extract services that solve real problems, not
imagined ones
• Avoid SOA “tax”
44
So my primary guideline would be don’t even
consider microservices unless you have a
system that’s too complex to manage as a
monolith
- Martin Fowler, “MicroservicePremium”
45
Conclusions
46
Conclusions
1. Our architecture is boring
2. How we keep it boring is interesting:
1. Start with what we know
2. Measure it live
3. Fix the slow
47
Application
• You can optimize for performance and get scale
thrown in (almost for free)
• Your monolith can scale further than you think
• SOA is not the only way
– Know your own problem space
– Fix actual problems
48
Questions?
(We’re all about questions)
Obligatory:
• We’re hiring! stackexchange.com/work-here
• Open source! stackexchange.github.io
• Follow me! twitter.com/df07
49
50
Here Be Dragons
(rejected slides)
51
• Started with basic OutputCache (cache rendered
HTML for a page)
• ~4% cache hit rate
Caching
52
• Add in-memory & Redis caching
Caching
53
StackExchange.Redis
• Wrote our own library for talking to Redis
• Multiplexing operations over a single connection
• Aware of primary / secondary instances
– Can target reads at secondary slave
54
StackExchange.Redis
(opserver – https://github.com/opserver/opserver)
55
Moonspeak (Localization)

More Related Content

What's hot

What's hot (20)

Lrug
LrugLrug
Lrug
 
Supersize me: Making Drupal go large
Supersize me: Making Drupal go largeSupersize me: Making Drupal go large
Supersize me: Making Drupal go large
 
dotnetsheff: Continuous delivery with Team City and Octopus Deploy
dotnetsheff: Continuous delivery with Team City and Octopus Deploydotnetsheff: Continuous delivery with Team City and Octopus Deploy
dotnetsheff: Continuous delivery with Team City and Octopus Deploy
 
Gartner Infrastructure and Operations Summit Berlin 2015 - DevOps Journey
Gartner Infrastructure and Operations Summit Berlin 2015 - DevOps JourneyGartner Infrastructure and Operations Summit Berlin 2015 - DevOps Journey
Gartner Infrastructure and Operations Summit Berlin 2015 - DevOps Journey
 
Modern Module Development
Modern Module DevelopmentModern Module Development
Modern Module Development
 
New Server in an Hour
New Server in an HourNew Server in an Hour
New Server in an Hour
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015
 
Perforce's Java Platform: Continuous Integration For Real
Perforce's Java Platform: Continuous Integration For RealPerforce's Java Platform: Continuous Integration For Real
Perforce's Java Platform: Continuous Integration For Real
 
Practical Methods for Adopting DevOps - Michael Stahnke
Practical Methods for Adopting DevOps - Michael StahnkePractical Methods for Adopting DevOps - Michael Stahnke
Practical Methods for Adopting DevOps - Michael Stahnke
 
Performance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample applicationPerformance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample application
 
Alexei Vladishev - Opening Speech
Alexei Vladishev - Opening SpeechAlexei Vladishev - Opening Speech
Alexei Vladishev - Opening Speech
 
Node.js for .NET Developers
Node.js for .NET DevelopersNode.js for .NET Developers
Node.js for .NET Developers
 
Desktop Intro
Desktop IntroDesktop Intro
Desktop Intro
 
Make It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version ControlMake It Cooler: Using Decentralized Version Control
Make It Cooler: Using Decentralized Version Control
 
Let's server your Data
Let's server your DataLet's server your Data
Let's server your Data
 
Fundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CDFundamentals of DevOps and CI/CD
Fundamentals of DevOps and CI/CD
 
Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming Ceylon From Here to Infinity: The Big Picture and What's Coming
Ceylon From Here to Infinity: The Big Picture and What's Coming
 
Short-Training asp.net vNext
Short-Training asp.net vNextShort-Training asp.net vNext
Short-Training asp.net vNext
 
Continuous Delivery for the Rest of Us
Continuous Delivery for the Rest of UsContinuous Delivery for the Rest of Us
Continuous Delivery for the Rest of Us
 
Celery workshop
Celery workshopCelery workshop
Celery workshop
 

Viewers also liked

Viewers also liked (8)

Импорт древеных брикетов База европейских импортёров древесных брикетов 2014
 Импорт древеных брикетов  База европейских импортёров древесных брикетов 2014 Импорт древеных брикетов  База европейских импортёров древесных брикетов 2014
Импорт древеных брикетов База европейских импортёров древесных брикетов 2014
 
Millennials haiku deck
Millennials haiku deckMillennials haiku deck
Millennials haiku deck
 
Millennials haiku deck
Millennials haiku deckMillennials haiku deck
Millennials haiku deck
 
Informații suplimentare
Informații suplimentareInformații suplimentare
Informații suplimentare
 
In Mold Labeling Technology "IML"
In Mold Labeling Technology "IML"In Mold Labeling Technology "IML"
In Mold Labeling Technology "IML"
 
Strategic Planning Process
Strategic Planning ProcessStrategic Planning Process
Strategic Planning Process
 
IML Decoration for TRIM Ultra-Thinwall Packaging
IML Decoration for TRIM Ultra-Thinwall PackagingIML Decoration for TRIM Ultra-Thinwall Packaging
IML Decoration for TRIM Ultra-Thinwall Packaging
 
Advanced IML Systems Technology to Minimize Cost
Advanced IML Systems Technology to Minimize CostAdvanced IML Systems Technology to Minimize Cost
Advanced IML Systems Technology to Minimize Cost
 

Similar to Scaling Stack Overflow (QCon NYC 2015)

Oem12c patching -OOW13
Oem12c patching -OOW13Oem12c patching -OOW13
Oem12c patching -OOW13
Bobby Curtis
 

Similar to Scaling Stack Overflow (QCon NYC 2015) (20)

Get your Project back in Shape!
Get your Project back in Shape!Get your Project back in Shape!
Get your Project back in Shape!
 
The Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey VasilievThe Silver Bullet Syndrome by Alexey Vasiliev
The Silver Bullet Syndrome by Alexey Vasiliev
 
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit EuropeAutomation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
Automation: The Good, The Bad and The Ugly with DevOpsGuys - AppD Summit Europe
 
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
DevOpsGuys - DevOps Automation - The Good, The Bad and The UglyDevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
DevOpsGuys - DevOps Automation - The Good, The Bad and The Ugly
 
Performance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons LearnedPerformance Benchmarking: Tips, Tricks, and Lessons Learned
Performance Benchmarking: Tips, Tricks, and Lessons Learned
 
Kylin Engineering Principles
Kylin Engineering PrinciplesKylin Engineering Principles
Kylin Engineering Principles
 
JavaFX 101
JavaFX 101JavaFX 101
JavaFX 101
 
DefCore: The Interoperability Standard for OpenStack
DefCore: The Interoperability Standard for OpenStackDefCore: The Interoperability Standard for OpenStack
DefCore: The Interoperability Standard for OpenStack
 
Bridging the divide between architecture and code (US version)
Bridging the divide between architecture and code (US version)Bridging the divide between architecture and code (US version)
Bridging the divide between architecture and code (US version)
 
Into The Box 2020 Keynote Day 1
Into The Box 2020 Keynote Day 1Into The Box 2020 Keynote Day 1
Into The Box 2020 Keynote Day 1
 
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps StoryDOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
DOES16 London - Jonathan Fletcher - Re-imagining Hiscox IT: A DevOps Story
 
InteropWG Intro & Vertical Programs (May. 2017)
InteropWG Intro & Vertical Programs (May. 2017)InteropWG Intro & Vertical Programs (May. 2017)
InteropWG Intro & Vertical Programs (May. 2017)
 
Circuit 2015 Keynote - Carsten Ziegeler
Circuit 2015 Keynote -  Carsten ZiegelerCircuit 2015 Keynote -  Carsten Ziegeler
Circuit 2015 Keynote - Carsten Ziegeler
 
The Evolution of Continuous Delivery at Scale @ Linkedin
The Evolution of Continuous Delivery at Scale @ LinkedinThe Evolution of Continuous Delivery at Scale @ Linkedin
The Evolution of Continuous Delivery at Scale @ Linkedin
 
PHP Unconference Continuous Integration
PHP Unconference Continuous IntegrationPHP Unconference Continuous Integration
PHP Unconference Continuous Integration
 
Oem12c patching -OOW13
Oem12c patching -OOW13Oem12c patching -OOW13
Oem12c patching -OOW13
 
Best Practices for Enterprise Continuous Delivery of Oracle Fusion Middlewa...
Best Practices for Enterprise Continuous Delivery of Oracle Fusion Middlewa...Best Practices for Enterprise Continuous Delivery of Oracle Fusion Middlewa...
Best Practices for Enterprise Continuous Delivery of Oracle Fusion Middlewa...
 
Integrating RightScale, Windows, and .NET for Fun and Profit - RightScale Com...
Integrating RightScale, Windows, and .NET for Fun and Profit - RightScale Com...Integrating RightScale, Windows, and .NET for Fun and Profit - RightScale Com...
Integrating RightScale, Windows, and .NET for Fun and Profit - RightScale Com...
 
OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...
OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...
OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...
 
OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...
OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...
OSDC 2015: Martin Gerhard Loschwitz - Kristian Köhntopp | 45 Minutes of OpenS...
 

Recently uploaded

Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
panagenda
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 

Scaling Stack Overflow (QCon NYC 2015)

Editor's Notes

  1. SSDs. 2x12 core processors (48 cores with hyperthreading), 2x 10Gb network on SQL.