SlideShare a Scribd company logo
1 of 49
Download to read offline
High Availability
                            Server apps


                             Tarek Ziade & Benoît Chesneau

Monday, October 3, 2011                                      1
• The C10K problem
                    • “It's time for web servers to handle ten
                          thousand clients simultaneously, don't you
                          think? After all, the web is a big place now. “
                    • http://www.kegel.com/c10k.html


Monday, October 3, 2011                                                     2
More & more hits
Monday, October 3, 2011                      3
More & more media
Monday, October 3, 2011                       4
• 1993 - 1998 - CGI (and java applets...)
                    • Apache & Prefork - simple
                    • Multiprocessing - threads vs events


                                            A bit of history
Monday, October 3, 2011                                         5
Monday, October 3, 2011   6
• 1993 - 1998 - CGI (and java applets...)
                    • Apache & Prefork - simple
                    • Multiprocessing - threads vs events


                                            A bit of history
Monday, October 3, 2011                                         7
Clients




          Socket          Port 80



        Worker



    Application
                          Minitel
Monday, October 3, 2011             8
Waiting...
Monday, October 3, 2011                9
Moar
Monday, October 3, 2011          10
Fork
Monday, October 3, 2011          11
Fork
Monday, October 3, 2011          12
Fork
Monday, October 3, 2011          13
Fork
Monday, October 3, 2011          14
Multiprocessing
Monday, October 3, 2011                     15
multiprocessing
Monday, October 3, 2011                     16
• Threads or Events ?
                   • Apache, Nginx, Node.js, .... (Erlang)



Monday, October 3, 2011                                      17
• MPM Prefork
                          $ ab -n 1000000 -c 250 http://127.0.0.1/
                          $ ps ax|grep apache2|wc -l
                          152


                    • MPM Worker (hybride prefork + threads
                           par requêtes)
                          $ ps ax|grep apache2|wc -l
                          5




Monday, October 3, 2011                                              18
• 1 master process, several workers
                    • Prefork
                    • Accepts several connections per worker
                    • Events


Monday, October 3, 2011                                        19
• 1 single thread
                    • 1 event loop (READ/WRITE)
                    • Context switching



                                            Event Loop
Monday, October 3, 2011                                  20
• Nginx VS Apache
                    • http://blog.webfaction.com/a-little-holiday-
                          present




Monday, October 3, 2011                                              21
Nginx versus Apache (with the worker-MPM)
                for serving a small static file:




Monday, October 3, 2011                                     22
Memory usage




Monday, October 3, 2011                  23
http://www.ostinelli.net/a-comparison-between-misultin-mochiweb-cowboy-nodejs-and-tornadoweb/




                                                                                                              Choice
Monday, October 3, 2011                                                                                                   24
• WSGI (PEP 3333)
                    • Prefork - shared socket
                    • async & sync workers (gevent, eventlet,
                          tornado, ...)
                    • Easy to use in Django, Paster, ...


Monday, October 3, 2011                                         25
Fork
Monday, October 3, 2011          26
Fork + async
Monday, October 3, 2011                  27
• HTTP Stream
                    • Restartless upgrades ala Nginx
                    • Simple CLI:
                          $ gunicorn -w 3 test:app
                    • greins (https://github.com/meebo/greins)


Monday, October 3, 2011                                          28
Monday, October 3, 2011   29
Monday, October 3, 2011   30
asynchronous
                               or
                          synchronous


Monday, October 3, 2011                  31
• bandwidth-bound & CPU-bound apps
                    • Fast operations required
                    • Needs a way to hold incoming connections
                          (cf nginx + gunicorn sync)



                                                   synchronous
Monday, October 3, 2011                                          32
• websocket, longpolling
                    • apps with long, blocking calls
                    • streaming
                    • slow clients
                    • slowloris & other DoS

                                               asynchronous
Monday, October 3, 2011                                       33
gevent & eventlet

                    • Network libraries
                    • synchronous API
                    • monkey patch
                    • co-routines
                    • Code is always running async
                                          gevent & eventlet
Monday, October 3, 2011                                       34
twisted

                    • asynchronous library
                    • Events & callbacks
                    • Twisted server == single event loop

                                                  twisted
Monday, October 3, 2011                                     35
Monday, October 3, 2011   36
• message passing
                          • greenlets
                          • py.py --withmod-_stackless
          http://www.grant-olson.net/python/intro-to-stackless-python



                                                stackless
Monday, October 3, 2011                                                 37
• ulimit is your friend
                    • somaxcon
                    • ...



                                              Tuning
Monday, October 3, 2011                                38
Monday, October 3, 2011   39
Monday, October 3, 2011   40
Firefox Sync

Monday, October 3, 2011                  41
Monday, October 3, 2011   42
• 10 frontends web
                    • +123 mysql (percona)
                    • 6 Open Ldap servers (2 masters, 4 slaves)
                    • ~1.5 M active users
                    • ~4 M registered users
                    • ~800 RPS for the storage
                    • CPU: 20% !!! ETooMuch

Monday, October 3, 2011                                           43
• silverlining (http://cloudsilverlining.org/) by
                          @ianb
                    • kraftwerk (http://kraftwerk-wsgi.org)

                                                            Deploy
Monday, October 3, 2011                                                 44
• libcloud (http://libcloud.apache.org/): deploy
                          on the “clouds”
                    • juju (https://juju.ubuntu.com/) : ubuntu
                          cloud (openstack + ensemble or ec2)



                                                          Deploy
Monday, October 3, 2011                                                45
• Apache Bench (ab)
                    • httperf
                    • Apache Jmeter
                    • Grinder
                    • Funkload

                                          Bench
Monday, October 3, 2011                           46
Funkload
Monday, October 3, 2011              47
Funkload
Monday, October 3, 2011              48
Thanks !


                    • @benoitc
                    • @tarek_ziade


                                          Moar ???
Monday, October 3, 2011                              49

More Related Content

Similar to High Availability Server Apps

How Lanyrd uses Twitter
How Lanyrd uses TwitterHow Lanyrd uses Twitter
How Lanyrd uses TwitterSimon Willison
 
Spotify: Horizontal Scalability for Great Success
Spotify: Horizontal Scalability for Great SuccessSpotify: Horizontal Scalability for Great Success
Spotify: Horizontal Scalability for Great SuccessNick Barkas
 
Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1rit2011
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJAX London
 
node.js for front-end developers
node.js for front-end developersnode.js for front-end developers
node.js for front-end developersGarann Means
 
SeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocket
SeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocketSeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocket
SeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocketProcessOne
 
Deploying large payloads at scale
Deploying large payloads at scaleDeploying large payloads at scale
Deploying large payloads at scaleramonvanalteren
 
Community Code: Xero
Community Code: XeroCommunity Code: Xero
Community Code: XeroSencha
 
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011hugs
 
Theres a rabbit on my symfony
Theres a rabbit on my symfonyTheres a rabbit on my symfony
Theres a rabbit on my symfonyAlvaro Videla
 
Practical Cloud Security
Practical Cloud SecurityPractical Cloud Security
Practical Cloud SecurityJason Chan
 
Hacking Webkit & Its JavaScript Engines
Hacking Webkit & Its JavaScript EnginesHacking Webkit & Its JavaScript Engines
Hacking Webkit & Its JavaScript EnginesSencha
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disquszeeg
 
Intro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingIntro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingJames Williams
 
Scaling application servers for efficiency
Scaling application servers for efficiencyScaling application servers for efficiency
Scaling application servers for efficiencyTomas Doran
 
Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Nikolay Savvinov
 

Similar to High Availability Server Apps (20)

How Lanyrd uses Twitter
How Lanyrd uses TwitterHow Lanyrd uses Twitter
How Lanyrd uses Twitter
 
RunDeck
RunDeckRunDeck
RunDeck
 
Spotify: Horizontal Scalability for Great Success
Spotify: Horizontal Scalability for Great SuccessSpotify: Horizontal Scalability for Great Success
Spotify: Horizontal Scalability for Great Success
 
Pronk like you mean it
Pronk like you mean itPronk like you mean it
Pronk like you mean it
 
Http front-ends
Http front-endsHttp front-ends
Http front-ends
 
Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1Building high traffic http front-ends. theo schlossnagle. зал 1
Building high traffic http front-ends. theo schlossnagle. зал 1
 
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan GallimoreJava EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
Java EE | Apache TomEE - Java EE Web Profile on Tomcat | Jonathan Gallimore
 
node.js for front-end developers
node.js for front-end developersnode.js for front-end developers
node.js for front-end developers
 
SeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocket
SeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocketSeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocket
SeaBeyond 2011 ProcessOne - Eric Cestari: XMPP over WebSocket
 
Deploying large payloads at scale
Deploying large payloads at scaleDeploying large payloads at scale
Deploying large payloads at scale
 
Community Code: Xero
Community Code: XeroCommunity Code: Xero
Community Code: Xero
 
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
 
Theres a rabbit on my symfony
Theres a rabbit on my symfonyTheres a rabbit on my symfony
Theres a rabbit on my symfony
 
Why Play Framework is fast
Why Play Framework is fastWhy Play Framework is fast
Why Play Framework is fast
 
Practical Cloud Security
Practical Cloud SecurityPractical Cloud Security
Practical Cloud Security
 
Hacking Webkit & Its JavaScript Engines
Hacking Webkit & Its JavaScript EnginesHacking Webkit & Its JavaScript Engines
Hacking Webkit & Its JavaScript Engines
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disqus
 
Intro to HTML5 Game Programming
Intro to HTML5 Game ProgrammingIntro to HTML5 Game Programming
Intro to HTML5 Game Programming
 
Scaling application servers for efficiency
Scaling application servers for efficiencyScaling application servers for efficiency
Scaling application servers for efficiency
 
Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...Using the big guns: Advanced OS performance tools for troubleshooting databas...
Using the big guns: Advanced OS performance tools for troubleshooting databas...
 

Recently uploaded

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Recently uploaded (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

High Availability Server Apps