SlideShare uma empresa Scribd logo
1 de 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?

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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
 

Último

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Último (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
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
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
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...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

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/