Your SlideShare is downloading. ×
Tornado
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Tornado

3,906
views

Published on

Published in: Technology

0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,906
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
65
Comments
0
Likes
8
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • - Facebook Tornado (ce este tornado, structura de ansamblu a modulelor, care sunt beneficiile, cum se utilizeaza)- Rata de adoptie pe web a tehnologiilor (weekend sized-problem)
  • Cati au cont pe faceboook?Stie cineva ce e friendfeed?La ce foloseste?Acquisition price, value baby (Tornado)
  • - Ce e tornado in esenta?blocking vs non-blocking- Select O(n) , epoll O(1)- Real time web services: search, news, contacts
  • Transcript

    • 1. Real Time Web Server
    • 2. Real Time, so what?
      Tornado – The baby that comes with it
      1000s simultaneously active connections
    • 3. Open-source (Apache 2.0 License)
      Nginx
      Non-blocking web server
      Epoll (callbacks on the kernel file structure)
      Push vs Pull (long polling)
      Real-time web services
    • 4. - Module List
    • 5. - Code Snippets
      URL Mapping (get + post)
      class MainHandler(tornado.web.RequestHandler):
      def get(self):
      self.write("You requested the main page")
      class StoryHandler(tornado.web.RequestHandler):
      def get(self, story_id):
      self.write("You requested the story " + story_id)
      application = tornado.web.Application([ (r"/", MainHandler), (r"/story/([0-9]+)", StoryHandler), ])
      Post arguments
      class MainHandler(tornado.web.RequestHandler):
      def get(self):
      self.write('<html><body><form action="/" method="post">'
      '<input type="text" name="message">'
      '<input type="submit" value="Submit">'
      '</form></body></html>')
      def post(self):
      self.set_header("Content-Type", "text/plain")
      self.write("You wrote " + self.get_argument("message"))
      HTTPRequest
    • 6. - Code Snippets
      HTML Templates
      <html>
      <head>
      <title>{{ title }}</title>
      </head>
      <body>
      <ul>
      {% for item in items %}
      <li>{{ escape(item) }}</li>
      {% end %}
      </ul>
      </body>
      </html>
      Template Handler
      class MainHandler(tornado.web.RequestHandler):
      def get(self):
      Items = ["Item 1", "Item 2", "Item 3"]
      self.render("template.html", title="My title", items=items)
    • 7. - UI Modules
      Widget
      Blog Post 1
      Widget
      myModule.py
      Blog Post 2
      Widget
      Web Page
      <short python code here…>
    • 10. - Asynchronous Requests
      1. Fetch data
      www.website.com
      Picasa/Flickr
      2. Response (callback)
      Synchronous Requests
      • immediate server response
      • 11. cannot later-update the client
      Asynchronous Requests
      • immediate server response
      • 12. allows for 3rd party services
      • 13. push technologies
    • - References
      Non-blocking
      Long-polling
      Web Server
      CSRF Protection
      Asynchronous
      Signed Cookies
      modular
      Tornado - http://www.tornadoweb.org/
      Epoll man page - http://linux.die.net/man/4/epoll
      Long Pooling - http://en.wikipedia.org/wiki/Push_technology
      CSRF - http://en.wikipedia.org/wiki/Cross-site_request_forgery
      Hack it now…
      Q/A minute
    • 14. Cristian Andreica
      331 CB
      cristian.andreica@gmail.com
      : @acristian
      http://www.slideshare.net/cristianAndreica/tornado
      Thank YOU!