SlideShare una empresa de Scribd logo
1 de 32
Software architecture for high
traffic website
Case study - Stack Overflow
Presenter: Ngô Xuân Hòa (Novaon Adnetwork - Novanet)
Hanoi .Net Meetup
Contents
About Stack Overflow
● Beginning
● Restructure #1
● Restructure # 2
● Founders
● Principles
SO architecture
● StackExchange.Redis
● Dapper
● Jil
Open-source Libs
About Stack Overflow
Founders
Jeff Atwood
Joel Spolsky
2008
Stack Overflow
2009 2010 2011
Server Fault
Stack Exchange 1.0
Stack Exchange 2.0
Stack Overflow Carees
Rome wasn’t build in a day!
● 100+ Q&A Sites
● 600+ million pageviews a month
● 3000+ requests per second
● 16+ million users
● 8+ million question
● 40+ million answers
Principles
Perfomance Is a Feature
Cache All The Thing!
Reinvention is OK
Stack Overflow Architecture
2 times restructuring
Stack Exchange 1.0
● ASP.NET MVC
● SQL Server
● LINQ to SQL
● Wikipedia DB
Design
Stack Exchange Network
LINQ to SQL
HAProxy
Redis
Lucene.NET
Scale Up
● Cache every things
● Elastic Search
● Reinvention
Stack Exchange 1.0 Structure
Windows NLBLoad balancing
IIS Server IIS ServerWeb server
SQL ServerDatabase
Window NLB
● Cons:
○ Limit to 8
Nodes
○ Cannot detect
service failed
Web-tier
ASP.NET MVC
LINQ to SQL
SQL Server
● All-in-memory
● Full text search
● 16 million pageviews a month
● 3 million unique visitors a month
● 6 million visits a month
Follow none but learn from everyone!
Pros
● Bottleneck: Database SQL Server
● High cost to scale up
● Simple
Cons
Restructure #1 - Stack Exchange Network
HAProxy
Redis Cache
Lucene.NET
Tag Engine
Stack Exchange Network Structure
HAProxy
Redis
IIS Servers
Database
protobuf
sqlhttp http
Load Balancing
● HAProxy:
○ Run in Linux
○ Free
Web-tier
ASP.NET MVC 3
LINQ to SQL
jQuery 1.4.5
Lucene.Net
Redis
● In-memory cache
● Master-slave
● Messaging notification
3 Type Cache
Local Cache Site Cache
● Use Redis
● Cache Site’s data:
- Q&As
- Acceptance rates
- ...
Global Cache
● Use Redis
● Cache System Data:
- User info
- Inbox
- ...
● Use
HttpRunTime.Cache
● Cache:
- User Session
- View Count
- ...
Update cache flow - Local cache
Local Cache
Redis
DB
Other sites
1 3
2.1
2.2
4
1 - OnStartup - Subcribe invalidation message
to Redis
2.1 - Data changed (by other sites, apps…)
2.2 - Send message to Redis
3 - Redis send Notification to Subscribers
4 - Get data from DB - update Local cache
Deployment flow with HAProxy
● Tell HAProxy to take the server out of rotation via a POST
● Delay to let IIS finish current requests (~5 sec)
● Stop the website
● Copy files
● Start the website
● Local testing, update local cache, etc…
● Re-enable HAProxy via another POST
● High performance
● Low-cost Load Balancing
(use HAProxy)
● Use Messaging của Redis
for cache invalidation
Pros
● Too many SQL query
Cons
● 95 million pageviews a month
● 800 requests per second
● 16 million users
Restructure #2 - Scale Up
Cache All the Thing
Elastic Search
Reinvention
Stack Exchange Network Structure
Elastic Search
Tag Engine
Databases
Redis
HAProxy
5 Level cache
Network Level Local Cache Redis Cache SQL SV Cache SSD
● Network Level: Browser cache…
● Local Cache: HttpRuntime.Cache - Cache all data in memory
● Redis Cache: Cache all data
● SQL Server Cache: Cache all data in memory (the database servers have 384GB of RAM)
Cache Flow
● Check Local Cache
● Else, check Redis Cache and update Local Cache
● If Cache Redis doesn’t have data, fetch from databases, then update Redis Cache
and Local Cache
Cache All the Things!
Pros
● Data has latency
● Very, Very Fast (<400ms)
● Low servers load:
○ IIS: 10-15% CPU usage
○ DB: 10% CPU usage
● 99% request served by cache
Cons
● 95 million pageviews a month
● 800 requests per second
● 16 million users
Open-source Libs
• StackExchange.Redis - high perfomance Redis client
• Dapper - a micro ORM - very fast
• Jil - fast JSON Serializer
Reinvention is OK!
Reference sources
● http://stackoverflow.com
● http://highscalability.com
● http://codinghorror.com
● http://www.joelonsoftware.com
● http://nickcraver.com
● http://josephwoodward.co.uk/2014/02/the-architecture-of-stackoverflow/
Thank you!
Ngô Xuân Hòa
xuanhoa862001@gmail.com

Más contenido relacionado

La actualidad más candente

itlchn 20 - Kien truc he thong chung khoan - Phan 2
itlchn 20 - Kien truc he thong chung khoan - Phan 2itlchn 20 - Kien truc he thong chung khoan - Phan 2
itlchn 20 - Kien truc he thong chung khoan - Phan 2IT Expert Club
 
Building Bizweb Microservices with Docker
Building Bizweb Microservices with DockerBuilding Bizweb Microservices with Docker
Building Bizweb Microservices with DockerKhôi Nguyễn Minh
 
[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API Manager
[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API Manager[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API Manager
[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API ManagerWSO2
 
Domain Driven Design và Event Driven Architecture
Domain Driven Design và Event Driven Architecture Domain Driven Design và Event Driven Architecture
Domain Driven Design và Event Driven Architecture IT Expert Club
 
OpenTelemetry For Developers
OpenTelemetry For DevelopersOpenTelemetry For Developers
OpenTelemetry For DevelopersKevin Brockhoff
 
Monitoring Kubernetes with Prometheus
Monitoring Kubernetes with PrometheusMonitoring Kubernetes with Prometheus
Monitoring Kubernetes with PrometheusGrafana Labs
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking VN
 
Log management system for Microservices
Log management system for MicroservicesLog management system for Microservices
Log management system for MicroservicesVõ Duy Tuấn
 
Prometheus
PrometheusPrometheus
Prometheuswyukawa
 
Logs/Metrics Gathering With OpenShift EFK Stack
Logs/Metrics Gathering With OpenShift EFK StackLogs/Metrics Gathering With OpenShift EFK Stack
Logs/Metrics Gathering With OpenShift EFK StackJosef Karásek
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
REST API 설계
REST API 설계REST API 설계
REST API 설계Terry Cho
 
Distributed Transaction in Microservice
Distributed Transaction in MicroserviceDistributed Transaction in Microservice
Distributed Transaction in MicroserviceNghia Minh
 
Service mesh(istio) monitoring
Service mesh(istio) monitoringService mesh(istio) monitoring
Service mesh(istio) monitoringJeong-Ho Na
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To JenkinsKnoldus Inc.
 
Nginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptxNginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptxwonyong hwang
 
실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 YoungSu Son
 
API : l'architecture REST
API : l'architecture RESTAPI : l'architecture REST
API : l'architecture RESTFadel Chafai
 

La actualidad más candente (20)

itlchn 20 - Kien truc he thong chung khoan - Phan 2
itlchn 20 - Kien truc he thong chung khoan - Phan 2itlchn 20 - Kien truc he thong chung khoan - Phan 2
itlchn 20 - Kien truc he thong chung khoan - Phan 2
 
Building Bizweb Microservices with Docker
Building Bizweb Microservices with DockerBuilding Bizweb Microservices with Docker
Building Bizweb Microservices with Docker
 
Jenkins tutorial
Jenkins tutorialJenkins tutorial
Jenkins tutorial
 
[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API Manager
[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API Manager[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API Manager
[WSO2 API Manager Community Call] Mastering JWTs with WSO2 API Manager
 
Domain Driven Design và Event Driven Architecture
Domain Driven Design và Event Driven Architecture Domain Driven Design và Event Driven Architecture
Domain Driven Design và Event Driven Architecture
 
OpenTelemetry For Developers
OpenTelemetry For DevelopersOpenTelemetry For Developers
OpenTelemetry For Developers
 
Monitoring Kubernetes with Prometheus
Monitoring Kubernetes with PrometheusMonitoring Kubernetes with Prometheus
Monitoring Kubernetes with Prometheus
 
Grokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKIGrokking TechTalk #33: High Concurrency Architecture at TIKI
Grokking TechTalk #33: High Concurrency Architecture at TIKI
 
Log management system for Microservices
Log management system for MicroservicesLog management system for Microservices
Log management system for Microservices
 
Prometheus
PrometheusPrometheus
Prometheus
 
Logs/Metrics Gathering With OpenShift EFK Stack
Logs/Metrics Gathering With OpenShift EFK StackLogs/Metrics Gathering With OpenShift EFK Stack
Logs/Metrics Gathering With OpenShift EFK Stack
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
REST API 설계
REST API 설계REST API 설계
REST API 설계
 
Distributed Transaction in Microservice
Distributed Transaction in MicroserviceDistributed Transaction in Microservice
Distributed Transaction in Microservice
 
Service mesh(istio) monitoring
Service mesh(istio) monitoringService mesh(istio) monitoring
Service mesh(istio) monitoring
 
An Introduction To Jenkins
An Introduction To JenkinsAn Introduction To Jenkins
An Introduction To Jenkins
 
Presentation SOAP
 Presentation SOAP Presentation SOAP
Presentation SOAP
 
Nginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptxNginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptx
 
실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우 실전 서버 부하테스트 노하우
실전 서버 부하테스트 노하우
 
API : l'architecture REST
API : l'architecture RESTAPI : l'architecture REST
API : l'architecture REST
 

Similar a Software architecture for high traffic website

SharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 PerformanceSharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 PerformanceBrian Culver
 
SharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 PerformanceSharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 PerformanceBrian Culver
 
GlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersGlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersRob Tweed
 
Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14GABeech
 
Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14GABeech
 
SharePoint 2010 Boost your farm performance!
SharePoint 2010 Boost your farm performance!SharePoint 2010 Boost your farm performance!
SharePoint 2010 Boost your farm performance!Brian Culver
 
JavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User ExperienceJavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User Experiencereeder29
 
Tuning Your SharePoint Environment
Tuning Your SharePoint EnvironmentTuning Your SharePoint Environment
Tuning Your SharePoint Environmentvmaximiuk
 
Mongo db admin_20110329
Mongo db admin_20110329Mongo db admin_20110329
Mongo db admin_20110329radiocats
 
Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009fschupp
 
RESTful web
RESTful webRESTful web
RESTful webAlvin Qi
 
BlackRay - The open Source Data Engine
BlackRay - The open Source Data EngineBlackRay - The open Source Data Engine
BlackRay - The open Source Data Enginefschupp
 
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Restlet
 
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise Search
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise SearchRestlet: Building a multi-tenant API PaaS with DataStax Enterprise Search
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise SearchDataStax Academy
 
05.m3 cms list-ofwebserver
05.m3 cms list-ofwebserver05.m3 cms list-ofwebserver
05.m3 cms list-ofwebservertarensi
 
Web Servers(IIS, NGINX, APACHE)
Web Servers(IIS, NGINX, APACHE)Web Servers(IIS, NGINX, APACHE)
Web Servers(IIS, NGINX, APACHE)Reza Jebeli
 
Scaling WordPress - Project Lana WordPress Team
Scaling WordPress - Project Lana WordPress TeamScaling WordPress - Project Lana WordPress Team
Scaling WordPress - Project Lana WordPress TeamDat Hoang
 
A Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's RoadmapA Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's RoadmapItai Yaffe
 

Similar a Software architecture for high traffic website (20)

SharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 PerformanceSharePoint Saturday San Antonio: SharePoint 2010 Performance
SharePoint Saturday San Antonio: SharePoint 2010 Performance
 
SharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 PerformanceSharePoint Saturday The Conference 2011 - SP2010 Performance
SharePoint Saturday The Conference 2011 - SP2010 Performance
 
GlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js DevelopersGlobalsDB: Its significance for Node.js Developers
GlobalsDB: Its significance for Node.js Developers
 
Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14
 
Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14Stack Exchange Infrastructure - LISA 14
Stack Exchange Infrastructure - LISA 14
 
Sharepoint Deployments
Sharepoint DeploymentsSharepoint Deployments
Sharepoint Deployments
 
SharePoint 2010 Boost your farm performance!
SharePoint 2010 Boost your farm performance!SharePoint 2010 Boost your farm performance!
SharePoint 2010 Boost your farm performance!
 
JavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User ExperienceJavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User Experience
 
Tuning Your SharePoint Environment
Tuning Your SharePoint EnvironmentTuning Your SharePoint Environment
Tuning Your SharePoint Environment
 
Mongo db admin_20110329
Mongo db admin_20110329Mongo db admin_20110329
Mongo db admin_20110329
 
Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009
 
RESTful web
RESTful webRESTful web
RESTful web
 
NoSQL
NoSQLNoSQL
NoSQL
 
BlackRay - The open Source Data Engine
BlackRay - The open Source Data EngineBlackRay - The open Source Data Engine
BlackRay - The open Source Data Engine
 
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
Cassandra Summit 2015 - Building a multi-tenant API PaaS with DataStax Enterp...
 
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise Search
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise SearchRestlet: Building a multi-tenant API PaaS with DataStax Enterprise Search
Restlet: Building a multi-tenant API PaaS with DataStax Enterprise Search
 
05.m3 cms list-ofwebserver
05.m3 cms list-ofwebserver05.m3 cms list-ofwebserver
05.m3 cms list-ofwebserver
 
Web Servers(IIS, NGINX, APACHE)
Web Servers(IIS, NGINX, APACHE)Web Servers(IIS, NGINX, APACHE)
Web Servers(IIS, NGINX, APACHE)
 
Scaling WordPress - Project Lana WordPress Team
Scaling WordPress - Project Lana WordPress TeamScaling WordPress - Project Lana WordPress Team
Scaling WordPress - Project Lana WordPress Team
 
A Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's RoadmapA Day in the Life of a Druid Implementor and Druid's Roadmap
A Day in the Life of a Druid Implementor and Druid's Roadmap
 

Más de Tung Nguyen Thanh

How to become senior .net developer
How to become senior .net developerHow to become senior .net developer
How to become senior .net developerTung Nguyen Thanh
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design IntroductionTung Nguyen Thanh
 
Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015Tung Nguyen Thanh
 
Agile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationAgile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationTung Nguyen Thanh
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabaseTung Nguyen Thanh
 
HaNoi Net Group Introduction
HaNoi Net Group IntroductionHaNoi Net Group Introduction
HaNoi Net Group IntroductionTung Nguyen Thanh
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven DevelopmentTung Nguyen Thanh
 
Visual studio 2015 ide new features
Visual studio 2015 ide new featuresVisual studio 2015 ide new features
Visual studio 2015 ide new featuresTung Nguyen Thanh
 
How to release every week case study of continuous integration
How to release every week case study of continuous integrationHow to release every week case study of continuous integration
How to release every week case study of continuous integrationTung Nguyen Thanh
 
Workshop fight legacy code write unit test
Workshop fight legacy code write unit testWorkshop fight legacy code write unit test
Workshop fight legacy code write unit testTung Nguyen Thanh
 
Developing windows phone 7 application with silverlight
Developing windows phone 7 application with silverlightDeveloping windows phone 7 application with silverlight
Developing windows phone 7 application with silverlightTung Nguyen Thanh
 
Top 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and AnswersTop 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and AnswersTung Nguyen Thanh
 
New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013Tung Nguyen Thanh
 

Más de Tung Nguyen Thanh (20)

How to become senior .net developer
How to become senior .net developerHow to become senior .net developer
How to become senior .net developer
 
Docker for .net developer
Docker for .net developerDocker for .net developer
Docker for .net developer
 
Domain Driven Design Introduction
Domain Driven Design IntroductionDomain Driven Design Introduction
Domain Driven Design Introduction
 
SignalR with ASP.NET MVC 6
SignalR with ASP.NET MVC 6SignalR with ASP.NET MVC 6
SignalR with ASP.NET MVC 6
 
Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015Continuous Delivery with VS2015 and TFS2015
Continuous Delivery with VS2015 and TFS2015
 
Agile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous IntegrationAgile .NET Development with BDD and Continuous Integration
Agile .NET Development with BDD and Continuous Integration
 
Performance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL DatabasePerformance Tuning And Optimization Microsoft SQL Database
Performance Tuning And Optimization Microsoft SQL Database
 
HaNoi Net Group Introduction
HaNoi Net Group IntroductionHaNoi Net Group Introduction
HaNoi Net Group Introduction
 
TDD - Test Driven Development
TDD - Test Driven DevelopmentTDD - Test Driven Development
TDD - Test Driven Development
 
Refactoring code in .net
Refactoring code in .netRefactoring code in .net
Refactoring code in .net
 
Visual studio 2015 ide new features
Visual studio 2015 ide new featuresVisual studio 2015 ide new features
Visual studio 2015 ide new features
 
Whatmakesoftwareflexible
WhatmakesoftwareflexibleWhatmakesoftwareflexible
Whatmakesoftwareflexible
 
How to release every week case study of continuous integration
How to release every week case study of continuous integrationHow to release every week case study of continuous integration
How to release every week case study of continuous integration
 
Xp not windows xp
Xp not windows xpXp not windows xp
Xp not windows xp
 
Is xp still extreme
Is xp still extremeIs xp still extreme
Is xp still extreme
 
Workshop fight legacy code write unit test
Workshop fight legacy code write unit testWorkshop fight legacy code write unit test
Workshop fight legacy code write unit test
 
Windows Phone Introduction
Windows Phone IntroductionWindows Phone Introduction
Windows Phone Introduction
 
Developing windows phone 7 application with silverlight
Developing windows phone 7 application with silverlightDeveloping windows phone 7 application with silverlight
Developing windows phone 7 application with silverlight
 
Top 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and AnswersTop 100 .NET Interview Questions and Answers
Top 100 .NET Interview Questions and Answers
 
New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013New in Visual Studio and TFS 2013
New in Visual Studio and TFS 2013
 

Último

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Software architecture for high traffic website

  • 1. Software architecture for high traffic website Case study - Stack Overflow Presenter: Ngô Xuân Hòa (Novaon Adnetwork - Novanet) Hanoi .Net Meetup
  • 2. Contents About Stack Overflow ● Beginning ● Restructure #1 ● Restructure # 2 ● Founders ● Principles SO architecture ● StackExchange.Redis ● Dapper ● Jil Open-source Libs
  • 5. 2008 Stack Overflow 2009 2010 2011 Server Fault Stack Exchange 1.0 Stack Exchange 2.0 Stack Overflow Carees Rome wasn’t build in a day!
  • 6. ● 100+ Q&A Sites ● 600+ million pageviews a month ● 3000+ requests per second ● 16+ million users ● 8+ million question ● 40+ million answers
  • 7. Principles Perfomance Is a Feature Cache All The Thing! Reinvention is OK
  • 9. 2 times restructuring Stack Exchange 1.0 ● ASP.NET MVC ● SQL Server ● LINQ to SQL ● Wikipedia DB Design Stack Exchange Network LINQ to SQL HAProxy Redis Lucene.NET Scale Up ● Cache every things ● Elastic Search ● Reinvention
  • 10. Stack Exchange 1.0 Structure Windows NLBLoad balancing IIS Server IIS ServerWeb server SQL ServerDatabase
  • 11. Window NLB ● Cons: ○ Limit to 8 Nodes ○ Cannot detect service failed Web-tier ASP.NET MVC LINQ to SQL SQL Server ● All-in-memory ● Full text search
  • 12. ● 16 million pageviews a month ● 3 million unique visitors a month ● 6 million visits a month
  • 13. Follow none but learn from everyone!
  • 14. Pros ● Bottleneck: Database SQL Server ● High cost to scale up ● Simple Cons
  • 15. Restructure #1 - Stack Exchange Network HAProxy Redis Cache Lucene.NET Tag Engine
  • 16. Stack Exchange Network Structure HAProxy Redis IIS Servers Database protobuf sqlhttp http
  • 17. Load Balancing ● HAProxy: ○ Run in Linux ○ Free Web-tier ASP.NET MVC 3 LINQ to SQL jQuery 1.4.5 Lucene.Net Redis ● In-memory cache ● Master-slave ● Messaging notification
  • 18. 3 Type Cache Local Cache Site Cache ● Use Redis ● Cache Site’s data: - Q&As - Acceptance rates - ... Global Cache ● Use Redis ● Cache System Data: - User info - Inbox - ... ● Use HttpRunTime.Cache ● Cache: - User Session - View Count - ...
  • 19. Update cache flow - Local cache Local Cache Redis DB Other sites 1 3 2.1 2.2 4 1 - OnStartup - Subcribe invalidation message to Redis 2.1 - Data changed (by other sites, apps…) 2.2 - Send message to Redis 3 - Redis send Notification to Subscribers 4 - Get data from DB - update Local cache
  • 20. Deployment flow with HAProxy ● Tell HAProxy to take the server out of rotation via a POST ● Delay to let IIS finish current requests (~5 sec) ● Stop the website ● Copy files ● Start the website ● Local testing, update local cache, etc… ● Re-enable HAProxy via another POST
  • 21. ● High performance ● Low-cost Load Balancing (use HAProxy) ● Use Messaging của Redis for cache invalidation Pros ● Too many SQL query Cons
  • 22. ● 95 million pageviews a month ● 800 requests per second ● 16 million users
  • 23. Restructure #2 - Scale Up Cache All the Thing Elastic Search Reinvention
  • 24. Stack Exchange Network Structure Elastic Search Tag Engine Databases Redis HAProxy
  • 25. 5 Level cache Network Level Local Cache Redis Cache SQL SV Cache SSD ● Network Level: Browser cache… ● Local Cache: HttpRuntime.Cache - Cache all data in memory ● Redis Cache: Cache all data ● SQL Server Cache: Cache all data in memory (the database servers have 384GB of RAM)
  • 26. Cache Flow ● Check Local Cache ● Else, check Redis Cache and update Local Cache ● If Cache Redis doesn’t have data, fetch from databases, then update Redis Cache and Local Cache
  • 27. Cache All the Things!
  • 28. Pros ● Data has latency ● Very, Very Fast (<400ms) ● Low servers load: ○ IIS: 10-15% CPU usage ○ DB: 10% CPU usage ● 99% request served by cache Cons
  • 29. ● 95 million pageviews a month ● 800 requests per second ● 16 million users
  • 30. Open-source Libs • StackExchange.Redis - high perfomance Redis client • Dapper - a micro ORM - very fast • Jil - fast JSON Serializer Reinvention is OK!
  • 31. Reference sources ● http://stackoverflow.com ● http://highscalability.com ● http://codinghorror.com ● http://www.joelonsoftware.com ● http://nickcraver.com ● http://josephwoodward.co.uk/2014/02/the-architecture-of-stackoverflow/
  • 32. Thank you! Ngô Xuân Hòa xuanhoa862001@gmail.com