SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Tornado Rocking the Non-Blocking Web Contact: Twitter:	 Kurtiss Hare, CTO & Co-Founder of playhaven.com @kurtiss
What is Tornado? Scalable, Non-blocking Web Server Powered www.friendfeed.com Now open-sourced by Facebook after FF acquisition
Why Tornado?
Why Tornado? Paul Buchheit
Why Tornado? Don’t Be Paul Buchheit
Why Tornado? Processor/Thread Model CherryPy, Mod_WSGI, uWSGI, … Lightweight Threads Gevent, Eventlet, … IOLoop/Callback Model Tornado, Cogen, … What are you trying to do?
Why Tornado? Trying to address the c10k problem? 10,000 concurrent connections Processor/thread is known to fall over Trying to enable real-time/long-polling, WebSockets? Different problem than handling many short-lived, pipelined requests. Want to extend your arsenal with a tool that addresses these problems? Tornado might be for you.
Tornado’s Architecture ~2000 clients tornado.ioloop._poll tornado.web.RequestHandler tornado.httpserver.HTTPServer socket.socket tornado.ioloop.IOStream tornado.httpserver.HTTPConnection tornado.web.Application Routing/MVC tornado.ioloop
Tornado’s Architecture tornado.ioloop._poll Edge-triggered when possible (epoll/kqueue) Falls back on level triggered (select) Handles: Callback registration New connections Connections with new data Heart of Tornado’s approach to c10k
Hello, world import tornado.httpserver import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler):     def get(self):         self.write("Hello, world") application = tornado.web.Application([     (r"/", MainHandler), ]) if __name__ == "__main__”:     http_server = tornado.httpserver.HTTPServer(application)     http_server.listen(8888)     tornado.ioloop.IOLoop.instance().start()
Rocking the Non-Block class MainHandler(tornado.web.RequestHandler):     @tornado.web.asynchronous     def get(self):         http = tornado.httpclient.AsyncHTTPClient()         http.fetch("http://friendfeed-api.com/v2/feed/kurtiss",                    callback=self.async_callback(self.on_response))     def on_response(self, response):         if response.error: raise tornado.web.HTTPError(500)         json = tornado.escape.json_decode(response.body)         self.write("Fetched " + str(len(json["entries"])) + " entries ”)         self.finish()
Performance Notes Source: http://developers.facebook.com/blog/post/301
Performance Notes Better Comparisons Node.js – Tornado by 110% throughput [0] Twisted.Web – Tornado by 84% shorter average response time [1] Caveat Emptor, OK? http://nichol.as/benchmark-of-python-web-servers Of note, “Server Latency,” vs. gEvent, uWSGI Likely due to CPU availability Nothing beats a load test on your own environment PlayHaven’s use is modest, but growing: <500 concurrent web requests No long polling … yet. [0] http://news.ycombinator.com/item?id=1089340 [1] http://www.apparatusproject.org/blog/2009/09/twisted-web-vs-tornado-part-deux/
Let’s Code
Questions? Beer?

Weitere ähnliche Inhalte

Was ist angesagt?

Real time server
Real time serverReal time server
Real time serverthepian
 
Even faster django
Even faster djangoEven faster django
Even faster djangoGage Tseng
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node jsfakedarren
 
用Tornado开发RESTful API运用
用Tornado开发RESTful API运用用Tornado开发RESTful API运用
用Tornado开发RESTful API运用Felinx Lee
 
Ruby HTTP clients comparison
Ruby HTTP clients comparisonRuby HTTP clients comparison
Ruby HTTP clients comparisonHiroshi Nakamura
 
Coroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in PractiseCoroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in PractiseChristian Melchior
 
Phl mongo-philly-tornado-2011
Phl mongo-philly-tornado-2011Phl mongo-philly-tornado-2011
Phl mongo-philly-tornado-2011hangxin1940
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkFabio Tiriticco
 
Implementing Comet using PHP
Implementing Comet using PHPImplementing Comet using PHP
Implementing Comet using PHPKing Foo
 
Vert.x clustering on Docker, CoreOS and ETCD
Vert.x clustering on Docker, CoreOS and ETCDVert.x clustering on Docker, CoreOS and ETCD
Vert.x clustering on Docker, CoreOS and ETCDTim Nolet
 
Using Websockets with Play!
Using Websockets with Play!Using Websockets with Play!
Using Websockets with Play!Andrew Conner
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.jsPrabin Silwal
 
Node worshop Realtime - Socket.io
Node worshop Realtime - Socket.ioNode worshop Realtime - Socket.io
Node worshop Realtime - Socket.ioCaesar Chi
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Codenoamt
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebeanFaren faren
 
Real Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.ioReal Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.ioMindfire Solutions
 

Was ist angesagt? (20)

Real time server
Real time serverReal time server
Real time server
 
Even faster django
Even faster djangoEven faster django
Even faster django
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Building a real life application in node js
Building a real life application in node jsBuilding a real life application in node js
Building a real life application in node js
 
用Tornado开发RESTful API运用
用Tornado开发RESTful API运用用Tornado开发RESTful API运用
用Tornado开发RESTful API运用
 
Ruby HTTP clients comparison
Ruby HTTP clients comparisonRuby HTTP clients comparison
Ruby HTTP clients comparison
 
Coroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in PractiseCoroutines for Kotlin Multiplatform in Practise
Coroutines for Kotlin Multiplatform in Practise
 
Phl mongo-philly-tornado-2011
Phl mongo-philly-tornado-2011Phl mongo-philly-tornado-2011
Phl mongo-philly-tornado-2011
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
WebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! FrameworkWebSockets wiith Scala and Play! Framework
WebSockets wiith Scala and Play! Framework
 
Implementing Comet using PHP
Implementing Comet using PHPImplementing Comet using PHP
Implementing Comet using PHP
 
Vert.x clustering on Docker, CoreOS and ETCD
Vert.x clustering on Docker, CoreOS and ETCDVert.x clustering on Docker, CoreOS and ETCD
Vert.x clustering on Docker, CoreOS and ETCD
 
About Node.js
About Node.jsAbout Node.js
About Node.js
 
AJAX Transport Layer
AJAX Transport LayerAJAX Transport Layer
AJAX Transport Layer
 
Using Websockets with Play!
Using Websockets with Play!Using Websockets with Play!
Using Websockets with Play!
 
A complete guide to Node.js
A complete guide to Node.jsA complete guide to Node.js
A complete guide to Node.js
 
Node worshop Realtime - Socket.io
Node worshop Realtime - Socket.ioNode worshop Realtime - Socket.io
Node worshop Realtime - Socket.io
 
Groovy Powered Clean Code
Groovy Powered Clean CodeGroovy Powered Clean Code
Groovy Powered Clean Code
 
Java Play RESTful ebean
Java Play RESTful ebeanJava Play RESTful ebean
Java Play RESTful ebean
 
Real Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.ioReal Time Communication using Node.js and Socket.io
Real Time Communication using Node.js and Socket.io
 

Andere mochten auch

Tornado presentation
Tornado presentationTornado presentation
Tornado presentationveronicakes
 
GEOG101 Tornado Presentation
GEOG101 Tornado PresentationGEOG101 Tornado Presentation
GEOG101 Tornado PresentationTracy Mascorro
 
Thinking Tornadoes
Thinking TornadoesThinking Tornadoes
Thinking TornadoesSimon Jones
 
La morfologia il caso
La morfologia il casoLa morfologia il caso
La morfologia il casoefeso78
 
Presentation visual aide tornado burdick qcc101
Presentation visual aide tornado burdick qcc101Presentation visual aide tornado burdick qcc101
Presentation visual aide tornado burdick qcc101Chad Burdick
 
tornado powerpoint
 tornado powerpoint tornado powerpoint
tornado powerpointclh121
 
Holly's Tornado Presentation
Holly's Tornado PresentationHolly's Tornado Presentation
Holly's Tornado Presentationjennyv1
 
Introduction to Tornado - TienNA
Introduction to Tornado - TienNAIntroduction to Tornado - TienNA
Introduction to Tornado - TienNAFramgia Vietnam
 
Handling Disaster and Overcoming Adversity - Mayflower Mayor Randy Holland
Handling Disaster and Overcoming Adversity - Mayflower Mayor Randy HollandHandling Disaster and Overcoming Adversity - Mayflower Mayor Randy Holland
Handling Disaster and Overcoming Adversity - Mayflower Mayor Randy HollandTim Vahsholtz, Quartzlight Marketing
 
Mapping a Tornado Tragedy: Library Technology Conference 2017
Mapping a Tornado Tragedy: Library Technology Conference 2017Mapping a Tornado Tragedy: Library Technology Conference 2017
Mapping a Tornado Tragedy: Library Technology Conference 2017Melody Dworak
 

Andere mochten auch (18)

Tornado
TornadoTornado
Tornado
 
Tornado presentation
Tornado presentationTornado presentation
Tornado presentation
 
GEOG101 Tornado Presentation
GEOG101 Tornado PresentationGEOG101 Tornado Presentation
GEOG101 Tornado Presentation
 
Thinking Tornadoes
Thinking TornadoesThinking Tornadoes
Thinking Tornadoes
 
Hurricanes
HurricanesHurricanes
Hurricanes
 
La morfologia il caso
La morfologia il casoLa morfologia il caso
La morfologia il caso
 
Presentation 2
Presentation 2Presentation 2
Presentation 2
 
HCS Tornado Safety
HCS Tornado SafetyHCS Tornado Safety
HCS Tornado Safety
 
Vasu
VasuVasu
Vasu
 
Presentation visual aide tornado burdick qcc101
Presentation visual aide tornado burdick qcc101Presentation visual aide tornado burdick qcc101
Presentation visual aide tornado burdick qcc101
 
tornado powerpoint
 tornado powerpoint tornado powerpoint
tornado powerpoint
 
Holly's Tornado Presentation
Holly's Tornado PresentationHolly's Tornado Presentation
Holly's Tornado Presentation
 
Tornadoes
TornadoesTornadoes
Tornadoes
 
Introduction to Tornado - TienNA
Introduction to Tornado - TienNAIntroduction to Tornado - TienNA
Introduction to Tornado - TienNA
 
Handling Disaster and Overcoming Adversity - Mayflower Mayor Randy Holland
Handling Disaster and Overcoming Adversity - Mayflower Mayor Randy HollandHandling Disaster and Overcoming Adversity - Mayflower Mayor Randy Holland
Handling Disaster and Overcoming Adversity - Mayflower Mayor Randy Holland
 
Tornadoes
TornadoesTornadoes
Tornadoes
 
Mapping a Tornado Tragedy: Library Technology Conference 2017
Mapping a Tornado Tragedy: Library Technology Conference 2017Mapping a Tornado Tragedy: Library Technology Conference 2017
Mapping a Tornado Tragedy: Library Technology Conference 2017
 
Tornadoes
TornadoesTornadoes
Tornadoes
 

Ähnlich wie Tornado web

Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc  2015 HTTP 1, HTTP 2 and folksDevoxx Maroc  2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folksNicolas Martignole
 
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011Alessandro Nadalin
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiJackson Tian
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.jsguileen
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tourcacois
 
Android Performance #4: Network
Android Performance #4: NetworkAndroid Performance #4: Network
Android Performance #4: NetworkYonatan Levin
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Bar Camp Ubiquity Presentation
Bar Camp Ubiquity PresentationBar Camp Ubiquity Presentation
Bar Camp Ubiquity PresentationAndy Edmonds
 
Bar Camp Talk on Ubiquity
Bar Camp Talk on UbiquityBar Camp Talk on Ubiquity
Bar Camp Talk on Ubiquityguest5014a
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moondavejohnson
 
Performance #4 network
Performance #4  networkPerformance #4  network
Performance #4 networkVitali Pekelis
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersoazabir
 
Life on the Edge with ESI
Life on the Edge with ESILife on the Edge with ESI
Life on the Edge with ESIKit Chan
 
Ruby Conf Preso
Ruby Conf PresoRuby Conf Preso
Ruby Conf PresoDan Yoder
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDDSudar Muthu
 
Building an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twistedBuilding an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twistedDavid Novakovic
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Web Directions
 
12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocratJonathan Linowes
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Pythongturnquist
 

Ähnlich wie Tornado web (20)

Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc  2015 HTTP 1, HTTP 2 and folksDevoxx Maroc  2015 HTTP 1, HTTP 2 and folks
Devoxx Maroc 2015 HTTP 1, HTTP 2 and folks
 
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
 
Why Nodejs Guilin Shanghai
Why Nodejs Guilin ShanghaiWhy Nodejs Guilin Shanghai
Why Nodejs Guilin Shanghai
 
Why Node.js
Why Node.jsWhy Node.js
Why Node.js
 
Node.js: A Guided Tour
Node.js: A Guided TourNode.js: A Guided Tour
Node.js: A Guided Tour
 
Android Performance #4: Network
Android Performance #4: NetworkAndroid Performance #4: Network
Android Performance #4: Network
 
Tornado
TornadoTornado
Tornado
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Bar Camp Ubiquity Presentation
Bar Camp Ubiquity PresentationBar Camp Ubiquity Presentation
Bar Camp Ubiquity Presentation
 
Bar Camp Talk on Ubiquity
Bar Camp Talk on UbiquityBar Camp Talk on Ubiquity
Bar Camp Talk on Ubiquity
 
Ajax to the Moon
Ajax to the MoonAjax to the Moon
Ajax to the Moon
 
Performance #4 network
Performance #4  networkPerformance #4  network
Performance #4 network
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
Life on the Edge with ESI
Life on the Edge with ESILife on the Edge with ESI
Life on the Edge with ESI
 
Ruby Conf Preso
Ruby Conf PresoRuby Conf Preso
Ruby Conf Preso
 
Introduction to node.js GDD
Introduction to node.js GDDIntroduction to node.js GDD
Introduction to node.js GDD
 
Building an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twistedBuilding an inflight entertainment system controller in twisted
Building an inflight entertainment system controller in twisted
 
Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5Dave Orchard - Offline Web Apps with HTML5
Dave Orchard - Offline Web Apps with HTML5
 
12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat12 core technologies you should learn, love, and hate to be a 'real' technocrat
12 core technologies you should learn, love, and hate to be a 'real' technocrat
 
Intro To Spring Python
Intro To Spring PythonIntro To Spring Python
Intro To Spring Python
 

Kürzlich hochgeladen

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 

Kürzlich hochgeladen (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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 New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 

Tornado web

  • 1. Tornado Rocking the Non-Blocking Web Contact: Twitter: Kurtiss Hare, CTO & Co-Founder of playhaven.com @kurtiss
  • 2. What is Tornado? Scalable, Non-blocking Web Server Powered www.friendfeed.com Now open-sourced by Facebook after FF acquisition
  • 4. Why Tornado? Paul Buchheit
  • 5. Why Tornado? Don’t Be Paul Buchheit
  • 6. Why Tornado? Processor/Thread Model CherryPy, Mod_WSGI, uWSGI, … Lightweight Threads Gevent, Eventlet, … IOLoop/Callback Model Tornado, Cogen, … What are you trying to do?
  • 7. Why Tornado? Trying to address the c10k problem? 10,000 concurrent connections Processor/thread is known to fall over Trying to enable real-time/long-polling, WebSockets? Different problem than handling many short-lived, pipelined requests. Want to extend your arsenal with a tool that addresses these problems? Tornado might be for you.
  • 8. Tornado’s Architecture ~2000 clients tornado.ioloop._poll tornado.web.RequestHandler tornado.httpserver.HTTPServer socket.socket tornado.ioloop.IOStream tornado.httpserver.HTTPConnection tornado.web.Application Routing/MVC tornado.ioloop
  • 9. Tornado’s Architecture tornado.ioloop._poll Edge-triggered when possible (epoll/kqueue) Falls back on level triggered (select) Handles: Callback registration New connections Connections with new data Heart of Tornado’s approach to c10k
  • 10. Hello, world import tornado.httpserver import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") application = tornado.web.Application([ (r"/", MainHandler), ]) if __name__ == "__main__”: http_server = tornado.httpserver.HTTPServer(application) http_server.listen(8888) tornado.ioloop.IOLoop.instance().start()
  • 11. Rocking the Non-Block class MainHandler(tornado.web.RequestHandler): @tornado.web.asynchronous def get(self): http = tornado.httpclient.AsyncHTTPClient() http.fetch("http://friendfeed-api.com/v2/feed/kurtiss", callback=self.async_callback(self.on_response)) def on_response(self, response): if response.error: raise tornado.web.HTTPError(500) json = tornado.escape.json_decode(response.body) self.write("Fetched " + str(len(json["entries"])) + " entries ”) self.finish()
  • 12. Performance Notes Source: http://developers.facebook.com/blog/post/301
  • 13. Performance Notes Better Comparisons Node.js – Tornado by 110% throughput [0] Twisted.Web – Tornado by 84% shorter average response time [1] Caveat Emptor, OK? http://nichol.as/benchmark-of-python-web-servers Of note, “Server Latency,” vs. gEvent, uWSGI Likely due to CPU availability Nothing beats a load test on your own environment PlayHaven’s use is modest, but growing: <500 concurrent web requests No long polling … yet. [0] http://news.ycombinator.com/item?id=1089340 [1] http://www.apparatusproject.org/blog/2009/09/twisted-web-vs-tornado-part-deux/