This document provides an overview of the Tornado web server and summarizes its internals. It begins with an introduction to Tornado, describing it as a scalable, non-blocking web server and framework written in Python. It then outlines the main Tornado modules and discusses sockets, I/O monitoring using select, poll and epoll, and how Tornado sets up its server loop and handles requests.
This document summarizes and compares Ruby HTTP client libraries. It discusses the sync and async APIs of 16 libraries including Net::HTTP, HTTPClient, and Faraday. It covers their compatibility, supported features like keep-alive connections, and performance based on benchmarks. The document recommends libraries based on priorities like speed, HTML handling, API clients, and SSL support. It encourages readers to check the detailed feature matrix and report any errors found.
The document discusses using Python for ethical hacking and penetration testing. It provides reasons for using Python such as its ease of use, readable syntax, rich libraries, and existing tools. It then covers various Python libraries and frameworks used for tasks like reconnaissance, scanning, exploitation, and packet manipulation. Specific topics covered include file I/O, requests, sockets, scapy, and more.
The document discusses Node.js and asynchronous I/O. It explains that Node.js is an asynchronous event-driven JavaScript runtime that uses a single-threaded model with non-blocking I/O to handle high volumes of simultaneous connections efficiently. It also discusses how Node.js handles asynchronous operations using an event loop and callback functions instead of blocking operations.
The document discusses the future of asynchronous I/O in Python. It introduces PEP 3156 and the new asyncio module in Python 3.4 as a standard library for asynchronous I/O. It describes how asyncio (called Tulip in the presentation) provides primitives like event loops, transports, protocols and coroutines to build asynchronous applications and frameworks in a pluggable, coroutine-friendly way. It provides examples of using Tulip to run asynchronous tasks and build an echo server.
This talk was given at the Dutch PHP Conference 2011 and details the use of Comet (aka reverse ajax or ajax push) technologies and the importance of websockets and server-sent events. More information is available at http://joind.in/3237.
Presentation: Everything you wanted to know about writing async, high-concurr...
Facing tens of millions of clients continuously downloading binaries from our repositories, we decided to offer an OSS client that natively supports these downloads. In this talk we will share the main challenges in developing a highly-concurrent, resumable, async download library on top of Apache HTTP client. We will cover other libraries we tested and why we decided to reinvent the wheel. We will see important pitfalls we came across when working with HTTP and how using the right combination of techniques can improve performance by a magnitude. We will also see why your initial assumptions may completely change when faced with other players on the network. Consider yourself forewarned: lots of HTTP internals, NIO and concurrency ahead!
As presented at JFokus 2015 (http://www.jfokus.se/jfokus/talks.jsp#Everythingyouwantedt)
Node.js is a server-side JavaScript runtime built on Google's V8 engine. It uses non-blocking I/O and an event loop to handle concurrent connections efficiently without threads. This asynchronous model improves performance compared to traditional blocking I/O and threads. The event loop iterates through callbacks and executes them in order, allowing Node.js to handle many concurrent connections with a single thread.
Everything you wanted to know about writing async, concurrent http apps in java
As presented at CodeMotion Tel Aviv:
Facing tens of millions of clients continuously downloading binaries from its repositories, JFrog decided to offer an OSS client that natively supports these downloads. This session shares the main challenges of developing a highly concurrent, resumable, async download library on top of an Apache HTTP client. It also covers other libraries JFrog tested and why it decided to reinvent the wheel. Consider yourself forewarned: lots of HTTP internals, NIO, and concurrency ahead!
This document provides an introduction to Node.js, a framework for building scalable server-side applications with asynchronous JavaScript. It discusses what Node.js is, how it uses non-blocking I/O and events to avoid wasting CPU cycles, and how external Node modules help create a full JavaScript stack. Examples are given of using Node modules like Express for building RESTful APIs and Socket.IO for implementing real-time features like chat. Best practices, limitations, debugging techniques and references are also covered.
Node.js is a JavaScript runtime built on Chrome's V8 engine that allows building scalable network applications using JavaScript on the server-side. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, suitable for data-intensive real-time applications that run across distributed devices. Common uses of Node.js include building web servers, file upload clients, ad servers, chat servers, and any real-time data applications. The document provides an introduction to Node.js concepts like callbacks, blocking vs non-blocking code, the event loop, streams, events, and modules.
This document provides a complete guide to Node.js, covering installation methods, checking installation, modules, NPM, events, streams, and persisting data. It discusses installing Node.js from nodejs.org, using a version manager like NVM, or compiling from source. It also covers creating a basic web server, reading and writing files, uploading files, and using Socket.IO for real-time applications.
A million connections and beyond - Node.js at scale
This document discusses benchmarks and performance testing of Node.js. It notes that while Node.js can handle over 1 million connections, benchmarks are not that important as other factors like productivity. It explores how to meaningfully measure Node.js performance, compares Node.js to other frameworks like Erlang and Tornado, and argues that benchmarks should reflect real-world use cases rather than simplistic "hello world" tests. The document questions overreliance on benchmarks and emphasizes picking the right tool based on the task.
This document discusses how Groovy enables clean code through features like native JSON support, builders for JSON and markup, checked exceptions, default imports, AST transformations, extension modules, and scripts. Groovy avoids verbosity through features like built-in reader classes and meta-programming capabilities like registered meta-methods that allow overriding core behaviors.
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...
On Saturday, 12 of April, regular quarterly meeting of Tech Hangout Community took place in Creative Space 12, the cultural and educational center based in Kiev! The event was held under the motto «One day of inspiring talks on Web Back-End». This time Python, Ruby and PHP developers gathered to make peace and learn the Force.
*TECH HANGOUT COMMUNITY was found in 2012 by the developers for the developers for knowledge and experience sharing. Such meetings are the part of Innovecs Educational Project that actively develops sphere of internal trainings and knowledge exchange program among professionals. This Initiative was born within the walls of Innovecs and has proved to be extremely popular and high-demand. In a short period of time it gained its own Facebook group with more than 90 members, blog with more than 40 posts and constant quarterly external meeting of Tech hangout community with more than 80 participants. The concept of the event proposes a 30-minute report on the topic previously defined, and the discussion in a roundtable session format.
Join to discuss - https://www.facebook.com/groups/techhangout/
PyCon US 2012 - Web Server Bottlenecks and Performance Tuning
The document discusses web server performance bottlenecks and tuning. It notes that the majority of end-user response time is spent on the frontend. It then examines factors that affect web server performance like memory usage, processes vs threads, client impacts, and application requirements. Specific techniques are suggested for improving performance like using processes over threads, isolating slow clients with Nginx, preloading applications, and monitoring servers.
The document discusses using the Tornado web framework to develop RESTful APIs. It provides examples of implementing RESTful APIs in Tornado, including handling HTTP verbs, returning JSON/JSONP responses, handling exceptions, scraping web pages to monitor server status, and notifying subscribers via push notifications when status changes. Other topics mentioned include internationalization, cron jobs, and related resources for Tornado and RESTful APIs.
Tornado is a Python web framework that focuses on speed and handling large amounts of simultaneous traffic. It allows starting multiple sub-domains on different ports with auto-reloading capabilities. Tornado handles requests by routing them to different handlers that can render templates and return responses. It also supports asynchronous delayed responses using asynchronous HTTP clients.
This document discusses several Ruby web frameworks including Sinatra, Rails, Merb, Camping, and others. It then focuses on Sinatra, describing it as a DSL for quickly creating web applications in Ruby with minimal code. Sinatra applications can be single file, run on Rack, and allow the developer to choose their own template engine and JavaScript library. The document proceeds to provide examples of Sinatra features like routes, views, helpers, filters, configuration, and testing.
The document discusses using Crystal and the Kemal framework for a Rubyist's project that requires streaming log entries in real-time to a browser. While Roda was initially considered for its small size and streaming support, it lacked built-in websocket support needed for the project. Crystal and Kemal were discovered to be faster and smaller than Ruby and frameworks like Sinatra, with Kemal providing an easy way to add websocket support. The author was able to get their project working with Kemal in just 15 minutes due to its simplicity and an active community.
This document introduces Tornado Web and AsyncMongo for asynchronous access to MongoDB from Tornado applications. It discusses evented I/O web servers and the C10k problem. It provides an overview of Tornado Web and demonstrates basic usage. It introduces AsyncMongo for asynchronous MongoDB access from Tornado. It demonstrates how to fetch, insert, update and delete data from MongoDB using AsyncMongo with examples.
Tornado is a Python web framework and asynchronous networking library. It is optimized for non-blocking I/O and can handle a large number of open connections efficiently. Tornado supports features like templates, authentication, and static files. It is well-suited for real-time applications like chat servers that require long-polling connections. Examples of Tornado applications include chat servers and services that count recent Twitter posts.
This document discusses asynchronous programming using Python. It begins with introductions and discusses some of the buzzwords around asynchronous programming like Node.js, Tornado, and event loops. It then provides a brief history of threading, multiprocessing, and asynchronous programming. It defines what an event loop is and discusses concepts like callbacks and deferreds. It notes that asynchronous code is generally harder to write and can be slower than synchronous code. However, asynchronous programming allows for greater scalability by avoiding threads and shared state.
A tornado is a rotating column of air that extends from a thunderstorm to the ground. Most tornadoes have wind speeds between 40-110 mph but the strongest can exceed 300 mph. Tornadoes form from thunderstorms called supercells that contain rotating updrafts. As rain drags down rotating air, a funnel cloud may form and touch down as a tornado. Tornadoes grow strongest as they receive warm air but then weaken as surrounding winds cut off the supply, causing the tornado to dissipate.
Tornados are violently destructive columns of air that form over land in the shape of a funnel. They typically have wind speeds between 64-177 km/h and stretch over 75m across. Different types of tornados include supercell tornados, landspouts, firewhirls, gustnados, and waterspouts. Tornadoes form when warm moist air collides with cold dry air, creating a whirling wind that draws air into its center to form a funnel. Weather services issue tornado watches when conditions are right for tornadoes and tornado warnings when a tornado has been sighted on radar or visually. Tornados can cause significant damage and loss of life.
This document discusses a presentation on advanced uses of generators in Python. It covers context managers, which allow entry and exit actions for code blocks using the 'with' statement. Generators can be used to implement context managers via the yield keyword and decorator contextmanager. This transforms generator functions into objects that support the required __enter__ and __exit__ methods to monitor code block execution. The presentation aims to expand understanding of generators beyond iteration by exploring this technique for simplifying resource management tasks like file handling through context managers.
This document summarizes and compares several popular Python web frameworks - Django, Flask, Tornado, and aiohttp.
Django is the most popular full-stack framework that provides an ORM, template engine, tests, and other features out of the box. Flask is a microframework that requires extensions for features like SQLAlchemy for ORM and Jinja2 for templating. Tornado is both an asynchronous network library and web framework that has been supporting asynchronous features since Python 2. Aiohttp is an HTTP client/server library for asyncio that can be used to build asynchronous web applications and servers in Python 3. The document discusses when each framework would be suitable depending on requirements like asynchronous features or database usage.
Apache Cassandra is a free, distributed, open source, and highly scalable NoSQL database that is designed to handle large amounts of data across many commodity servers. It provides high availability with no single point of failure, linear scalability, and tunable consistency. Cassandra's architecture allows it to spread data across a cluster of servers and replicate across multiple data centers for fault tolerance. It is used by many large companies for applications that require high performance, scalability, and availability.
Network Traffic Analysis at a financial institution with 788 branches for 350...
A leading bank with over 780 branches across the United States had problems with monitoring network traffic across the Enterprise and in finding out the most resource-intensive applications. This Slideshare explains how they solved the challenge with ManageEngine NetFlow Analyzer by monitoring real-time network traffic based on flow data and found out application-wise bandwidth usage.
This document describes new features in NetFlow Analyzer v12.2, an integrated network traffic management and configuration management software. The new version includes enhancements to the user interface, integration with wireless LAN controllers, and tighter integration with network management solutions. It also includes new features like one-click flow export, network configuration management, and auto-refresh for traffic graphs.
This presentation shortly describes key features of Apache Cassandra. It was held at the Apache Cassandra Meetup in Vienna in January 2014. You can access the meetup here: http://www.meetup.com/Vienna-Cassandra-Users/
Eduardo Silva is an open source engineer at Treasure Data working on projects like Fluentd and Fluent Bit. He created the Monkey HTTP server, which is optimized for embedded Linux and has a modular plugin architecture. He also created Duda I/O, a scalable web services stack built on top of Monkey using a friendly C API. Both projects aim to provide lightweight, high performance solutions for collecting and processing data from IoT and embedded devices.
This document provides an overview of network programming in Python. It discusses how Python allows both low-level socket access for building clients and servers as well as higher-level access to application protocols like FTP and HTTP. It then describes socket programming concepts like domains, types, protocols and functions for binding, listening, accepting, connecting, sending and receiving data. Simple client and server code examples are provided to demonstrate creating a basic socket connection between two programs. Finally, commonly used Python network modules for protocols like HTTP, FTP, SMTP and more are listed.
This document provides an overview of Android and how to get started developing Android applications. It discusses Java network programming concepts, the components of an Android application including activities, services and broadcast receivers. It also covers using the Android emulator, configuring projects in Eclipse, and an overview of the APIs provided for the file sharing project including sockets and broadcasting messages.
Original slides from Ryan Dahl's NodeJs intro talk
These are the original slides from the nodejs talk. I was surprised not find them on slideshare so adding them. The video link is here https://www.youtube.com/watch?v=ztspvPYybIY
An unconventional tutorial to basic socket.io features. Socket.io basic features are explained first of all taking a look directly at the browser (hacker approach) and then taking a look at the documentation (and some code examples).
The document discusses network programming and Java sockets. It introduces elements of client-server computing including networking basics like TCP, UDP and ports. It then covers Java sockets, explaining how to implement both a server and client using Java sockets. Code examples are provided of a simple server and client. The conclusion emphasizes that Java makes socket programming easier than other languages like C.
The document provides an overview of asynchronous programming in Python. It discusses how asynchronous programming can improve performance over traditional synchronous and threaded models by keeping resources utilized continuously. It introduces key concepts like callbacks, coroutines, tasks and the event loop. It also covers popular asynchronous frameworks and modules in Python like Twisted, Tornado, gevent and asyncio. Examples are provided to demonstrate asynchronous HTTP requests and concurrent factorial tasks using the asyncio module. Overall, the document serves as an introduction to asynchronous programming in Python.
Talk given at DomCode meetup in Utrecht (August 2014) on different frameworks to do asynchronous I/O y Python, with a strong focus on asyncio (PEP-3156).
This document summarizes and compares Ruby HTTP client libraries. It discusses the sync and async APIs of 16 libraries including Net::HTTP, HTTPClient, and Faraday. It covers their compatibility, supported features like keep-alive connections, and performance based on benchmarks. The document recommends libraries based on priorities like speed, HTML handling, API clients, and SSL support. It encourages readers to check the detailed feature matrix and report any errors found.
The document discusses using Python for ethical hacking and penetration testing. It provides reasons for using Python such as its ease of use, readable syntax, rich libraries, and existing tools. It then covers various Python libraries and frameworks used for tasks like reconnaissance, scanning, exploitation, and packet manipulation. Specific topics covered include file I/O, requests, sockets, scapy, and more.
The document discusses Node.js and asynchronous I/O. It explains that Node.js is an asynchronous event-driven JavaScript runtime that uses a single-threaded model with non-blocking I/O to handle high volumes of simultaneous connections efficiently. It also discusses how Node.js handles asynchronous operations using an event loop and callback functions instead of blocking operations.
The document discusses the future of asynchronous I/O in Python. It introduces PEP 3156 and the new asyncio module in Python 3.4 as a standard library for asynchronous I/O. It describes how asyncio (called Tulip in the presentation) provides primitives like event loops, transports, protocols and coroutines to build asynchronous applications and frameworks in a pluggable, coroutine-friendly way. It provides examples of using Tulip to run asynchronous tasks and build an echo server.
This talk was given at the Dutch PHP Conference 2011 and details the use of Comet (aka reverse ajax or ajax push) technologies and the importance of websockets and server-sent events. More information is available at http://joind.in/3237.
Presentation: Everything you wanted to know about writing async, high-concurr...Baruch Sadogursky
Facing tens of millions of clients continuously downloading binaries from our repositories, we decided to offer an OSS client that natively supports these downloads. In this talk we will share the main challenges in developing a highly-concurrent, resumable, async download library on top of Apache HTTP client. We will cover other libraries we tested and why we decided to reinvent the wheel. We will see important pitfalls we came across when working with HTTP and how using the right combination of techniques can improve performance by a magnitude. We will also see why your initial assumptions may completely change when faced with other players on the network. Consider yourself forewarned: lots of HTTP internals, NIO and concurrency ahead!
As presented at JFokus 2015 (http://www.jfokus.se/jfokus/talks.jsp#Everythingyouwantedt)
Node.js is a server-side JavaScript runtime built on Google's V8 engine. It uses non-blocking I/O and an event loop to handle concurrent connections efficiently without threads. This asynchronous model improves performance compared to traditional blocking I/O and threads. The event loop iterates through callbacks and executes them in order, allowing Node.js to handle many concurrent connections with a single thread.
Everything you wanted to know about writing async, concurrent http apps in java Baruch Sadogursky
As presented at CodeMotion Tel Aviv:
Facing tens of millions of clients continuously downloading binaries from its repositories, JFrog decided to offer an OSS client that natively supports these downloads. This session shares the main challenges of developing a highly concurrent, resumable, async download library on top of an Apache HTTP client. It also covers other libraries JFrog tested and why it decided to reinvent the wheel. Consider yourself forewarned: lots of HTTP internals, NIO, and concurrency ahead!
This document provides an introduction to Node.js, a framework for building scalable server-side applications with asynchronous JavaScript. It discusses what Node.js is, how it uses non-blocking I/O and events to avoid wasting CPU cycles, and how external Node modules help create a full JavaScript stack. Examples are given of using Node modules like Express for building RESTful APIs and Socket.IO for implementing real-time features like chat. Best practices, limitations, debugging techniques and references are also covered.
Node.js is a JavaScript runtime built on Chrome's V8 engine that allows building scalable network applications using JavaScript on the server-side. It uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, suitable for data-intensive real-time applications that run across distributed devices. Common uses of Node.js include building web servers, file upload clients, ad servers, chat servers, and any real-time data applications. The document provides an introduction to Node.js concepts like callbacks, blocking vs non-blocking code, the event loop, streams, events, and modules.
This document provides a complete guide to Node.js, covering installation methods, checking installation, modules, NPM, events, streams, and persisting data. It discusses installing Node.js from nodejs.org, using a version manager like NVM, or compiling from source. It also covers creating a basic web server, reading and writing files, uploading files, and using Socket.IO for real-time applications.
A million connections and beyond - Node.js at scaleTom Croucher
This document discusses benchmarks and performance testing of Node.js. It notes that while Node.js can handle over 1 million connections, benchmarks are not that important as other factors like productivity. It explores how to meaningfully measure Node.js performance, compares Node.js to other frameworks like Erlang and Tornado, and argues that benchmarks should reflect real-world use cases rather than simplistic "hello world" tests. The document questions overreliance on benchmarks and emphasizes picking the right tool based on the task.
This document discusses how Groovy enables clean code through features like native JSON support, builders for JSON and markup, checked exceptions, default imports, AST transformations, extension modules, and scripts. Groovy avoids verbosity through features like built-in reader classes and meta-programming capabilities like registered meta-methods that allow overriding core behaviors.
Reliable Python REST API (by Volodymyr Hotsyk) - Web Back-End Tech Hangout - ...Innovecs
On Saturday, 12 of April, regular quarterly meeting of Tech Hangout Community took place in Creative Space 12, the cultural and educational center based in Kiev! The event was held under the motto «One day of inspiring talks on Web Back-End». This time Python, Ruby and PHP developers gathered to make peace and learn the Force.
*TECH HANGOUT COMMUNITY was found in 2012 by the developers for the developers for knowledge and experience sharing. Such meetings are the part of Innovecs Educational Project that actively develops sphere of internal trainings and knowledge exchange program among professionals. This Initiative was born within the walls of Innovecs and has proved to be extremely popular and high-demand. In a short period of time it gained its own Facebook group with more than 90 members, blog with more than 40 posts and constant quarterly external meeting of Tech hangout community with more than 80 participants. The concept of the event proposes a 30-minute report on the topic previously defined, and the discussion in a roundtable session format.
Join to discuss - https://www.facebook.com/groups/techhangout/
PyCon US 2012 - Web Server Bottlenecks and Performance TuningGraham Dumpleton
The document discusses web server performance bottlenecks and tuning. It notes that the majority of end-user response time is spent on the frontend. It then examines factors that affect web server performance like memory usage, processes vs threads, client impacts, and application requirements. Specific techniques are suggested for improving performance like using processes over threads, isolating slow clients with Nginx, preloading applications, and monitoring servers.
The document discusses using the Tornado web framework to develop RESTful APIs. It provides examples of implementing RESTful APIs in Tornado, including handling HTTP verbs, returning JSON/JSONP responses, handling exceptions, scraping web pages to monitor server status, and notifying subscribers via push notifications when status changes. Other topics mentioned include internationalization, cron jobs, and related resources for Tornado and RESTful APIs.
Tornado is a Python web framework that focuses on speed and handling large amounts of simultaneous traffic. It allows starting multiple sub-domains on different ports with auto-reloading capabilities. Tornado handles requests by routing them to different handlers that can render templates and return responses. It also supports asynchronous delayed responses using asynchronous HTTP clients.
This document discusses several Ruby web frameworks including Sinatra, Rails, Merb, Camping, and others. It then focuses on Sinatra, describing it as a DSL for quickly creating web applications in Ruby with minimal code. Sinatra applications can be single file, run on Rack, and allow the developer to choose their own template engine and JavaScript library. The document proceeds to provide examples of Sinatra features like routes, views, helpers, filters, configuration, and testing.
Crystal is a Rubyists friend (quick anecdote)Forrest Chang
The document discusses using Crystal and the Kemal framework for a Rubyist's project that requires streaming log entries in real-time to a browser. While Roda was initially considered for its small size and streaming support, it lacked built-in websocket support needed for the project. Crystal and Kemal were discovered to be faster and smaller than Ruby and frameworks like Sinatra, with Kemal providing an easy way to add websocket support. The author was able to get their project working with Kemal in just 15 minutes due to its simplicity and an active community.
This document introduces Tornado Web and AsyncMongo for asynchronous access to MongoDB from Tornado applications. It discusses evented I/O web servers and the C10k problem. It provides an overview of Tornado Web and demonstrates basic usage. It introduces AsyncMongo for asynchronous MongoDB access from Tornado. It demonstrates how to fetch, insert, update and delete data from MongoDB using AsyncMongo with examples.
Tornado is a Python web framework and asynchronous networking library. It is optimized for non-blocking I/O and can handle a large number of open connections efficiently. Tornado supports features like templates, authentication, and static files. It is well-suited for real-time applications like chat servers that require long-polling connections. Examples of Tornado applications include chat servers and services that count recent Twitter posts.
This document discusses asynchronous programming using Python. It begins with introductions and discusses some of the buzzwords around asynchronous programming like Node.js, Tornado, and event loops. It then provides a brief history of threading, multiprocessing, and asynchronous programming. It defines what an event loop is and discusses concepts like callbacks and deferreds. It notes that asynchronous code is generally harder to write and can be slower than synchronous code. However, asynchronous programming allows for greater scalability by avoiding threads and shared state.
A tornado is a rotating column of air that extends from a thunderstorm to the ground. Most tornadoes have wind speeds between 40-110 mph but the strongest can exceed 300 mph. Tornadoes form from thunderstorms called supercells that contain rotating updrafts. As rain drags down rotating air, a funnel cloud may form and touch down as a tornado. Tornadoes grow strongest as they receive warm air but then weaken as surrounding winds cut off the supply, causing the tornado to dissipate.
Tornados are violently destructive columns of air that form over land in the shape of a funnel. They typically have wind speeds between 64-177 km/h and stretch over 75m across. Different types of tornados include supercell tornados, landspouts, firewhirls, gustnados, and waterspouts. Tornadoes form when warm moist air collides with cold dry air, creating a whirling wind that draws air into its center to form a funnel. Weather services issue tornado watches when conditions are right for tornadoes and tornado warnings when a tornado has been sighted on radar or visually. Tornados can cause significant damage and loss of life.
This document discusses a presentation on advanced uses of generators in Python. It covers context managers, which allow entry and exit actions for code blocks using the 'with' statement. Generators can be used to implement context managers via the yield keyword and decorator contextmanager. This transforms generator functions into objects that support the required __enter__ and __exit__ methods to monitor code block execution. The presentation aims to expand understanding of generators beyond iteration by exploring this technique for simplifying resource management tasks like file handling through context managers.
This document summarizes and compares several popular Python web frameworks - Django, Flask, Tornado, and aiohttp.
Django is the most popular full-stack framework that provides an ORM, template engine, tests, and other features out of the box. Flask is a microframework that requires extensions for features like SQLAlchemy for ORM and Jinja2 for templating. Tornado is both an asynchronous network library and web framework that has been supporting asynchronous features since Python 2. Aiohttp is an HTTP client/server library for asyncio that can be used to build asynchronous web applications and servers in Python 3. The document discusses when each framework would be suitable depending on requirements like asynchronous features or database usage.
Apache Cassandra is a free, distributed, open source, and highly scalable NoSQL database that is designed to handle large amounts of data across many commodity servers. It provides high availability with no single point of failure, linear scalability, and tunable consistency. Cassandra's architecture allows it to spread data across a cluster of servers and replicate across multiple data centers for fault tolerance. It is used by many large companies for applications that require high performance, scalability, and availability.
A leading bank with over 780 branches across the United States had problems with monitoring network traffic across the Enterprise and in finding out the most resource-intensive applications. This Slideshare explains how they solved the challenge with ManageEngine NetFlow Analyzer by monitoring real-time network traffic based on flow data and found out application-wise bandwidth usage.
This document describes new features in NetFlow Analyzer v12.2, an integrated network traffic management and configuration management software. The new version includes enhancements to the user interface, integration with wireless LAN controllers, and tighter integration with network management solutions. It also includes new features like one-click flow export, network configuration management, and auto-refresh for traffic graphs.
This presentation shortly describes key features of Apache Cassandra. It was held at the Apache Cassandra Meetup in Vienna in January 2014. You can access the meetup here: http://www.meetup.com/Vienna-Cassandra-Users/
Eduardo Silva is an open source engineer at Treasure Data working on projects like Fluentd and Fluent Bit. He created the Monkey HTTP server, which is optimized for embedded Linux and has a modular plugin architecture. He also created Duda I/O, a scalable web services stack built on top of Monkey using a friendly C API. Both projects aim to provide lightweight, high performance solutions for collecting and processing data from IoT and embedded devices.
This document provides an overview of network programming in Python. It discusses how Python allows both low-level socket access for building clients and servers as well as higher-level access to application protocols like FTP and HTTP. It then describes socket programming concepts like domains, types, protocols and functions for binding, listening, accepting, connecting, sending and receiving data. Simple client and server code examples are provided to demonstrate creating a basic socket connection between two programs. Finally, commonly used Python network modules for protocols like HTTP, FTP, SMTP and more are listed.
This document provides an overview of Android and how to get started developing Android applications. It discusses Java network programming concepts, the components of an Android application including activities, services and broadcast receivers. It also covers using the Android emulator, configuring projects in Eclipse, and an overview of the APIs provided for the file sharing project including sockets and broadcasting messages.
Original slides from Ryan Dahl's NodeJs intro talkAarti Parikh
These are the original slides from the nodejs talk. I was surprised not find them on slideshare so adding them. The video link is here https://www.youtube.com/watch?v=ztspvPYybIY
An unconventional tutorial to basic socket.io features. Socket.io basic features are explained first of all taking a look directly at the browser (hacker approach) and then taking a look at the documentation (and some code examples).
The document discusses network programming and Java sockets. It introduces elements of client-server computing including networking basics like TCP, UDP and ports. It then covers Java sockets, explaining how to implement both a server and client using Java sockets. Code examples are provided of a simple server and client. The conclusion emphasizes that Java makes socket programming easier than other languages like C.
Twisted is an event-driven networking engine written in Python. It supports many protocols including web servers, chat clients/servers, mail servers, and more. Twisted uses asynchronous programming to avoid blocking and improve responsiveness for network services. The key components in Twisted are the reactor, which handles events; factories, which create protocol instances; protocols, which handle individual connections; and endpoints, which represent connections. An example asynchronous web proxy server in Twisted is presented to demonstrate its asynchronous programming model.
This document provides an overview of client-server networking concepts in Java. It discusses elements like network basics, ports and sockets. It explains how to implement both TCP and UDP clients and servers in Java using socket classes. Sample code is provided for an echo client-server application using TCP and a quote client-server application using UDP. Exception handling for sockets is also demonstrated.
This document discusses network programming clients. It begins by defining clients and servers, explaining that clients initiate connections by specifying a host and port, while servers listen on a port without specifying a host. It then provides the basic steps for implementing a generic network client in Java: creating a socket, input and output streams, performing I/O, and closing the socket. Additional topics covered include parsing strings with StringTokenizer, an example client that verifies email addresses, and a MailAddress class to parse email addresses.
This document discusses creating network clients in Java. It covers creating sockets, implementing a generic network client, parsing data with StringTokenizer, retrieving files from HTTP servers and documents using URL class. It provides code for a generic network client, parsing strings with StringTokenizer, an address verifier client, and classes to retrieve URIs and URLs. It also briefly discusses talking to servers interactively and using the URL class to write a basic web browser.
Build reliable, traceable, distributed systems with ZeroMQRobin Xiao
ZeroMQ is used to build a distributed system with reliable and traceable communication. It allows exposing code over RPC with minimal modification. Exceptions are properly propagated across services. The system is language agnostic and brokerless. Introspection allows viewing methods and signatures without opening code. Streaming APIs allow continuous updates without timeouts. Tracing helps profile nested calls and identify performance bottlenecks. Security is not implemented but could use SSL or authentication layers.
This document discusses network programming and Java sockets. It begins with an introduction to client-server computing and networking basics like TCP, UDP, and ports. It then covers Java sockets in detail, including how to implement a server that can accept multiple clients by creating a new thread for each, and how to implement a client. Sample code is provided for a simple single-threaded server and client. The document concludes that programming client-server applications in Java using sockets is easier than in other languages like C.
This document provides an overview of a hands-on workshop on the Constrained Application Protocol (CoAP). It outlines the agenda which includes introductions to CoAP, the Californium CoAP framework, and hands-on projects. Attendees will work through example CoAP client and server code using the Californium libraries and test their implementations. Advanced CoAP topics like security, proxies, and resource directories are also discussed.
This document provides an overview and comparison of XML-RPC and SOAP, which are two RPC systems that use open internet standards. XML-RPC implements RPC using open web standards by encoding data in XML and making RPC calls over HTTP. SOAP attempts to overcome limitations of XML-RPC by supporting user-defined data types and object introspection. While SOAP is more full-featured, XML-RPC remains simpler and more lightweight. Examples are provided of making XML-RPC calls from Python.
Choosing a communication platform is an important decision. From simple two-way communication to complex multi-node architectures, ZeroMQ, the embeddable networking library, helps provide a safe, fast and reliable communication medium.
This webinar will give you an overview of the ZeroMQ architecture, explaining the advantages and exploring usage patterns and cross-platform capabilities. We'll also go through examples of the patterns using different languages, including C++, Swift, Python and C.
1. Asynchronous programming allows programs to run tasks concurrently without blocking by using callbacks, tasks, futures/promises, async/await, coroutines, and event loops. This avoids idle waiting time compared to synchronous programs.
2. An event loop handles asynchronous requests by using non-blocking I/O and callbacks to queue tasks. When one task is waiting, like for a network response, the event loop can process other tasks.
3. Async/await and coroutines allow asynchronous code to be written synchronously by yielding control flow between tasks. This makes asynchronous code appear synchronous and easier to read than callbacks or callbacks.
This document provides an overview of server-side JavaScript using Node.js in 3 sentences or less:
Node.js allows for the development of server-side applications using JavaScript and non-blocking I/O. It introduces some theory around event loops and asynchronous programming in JavaScript. The document includes examples of building HTTP and TCP servers in Node.js and connecting to MongoDB, as well as when Node.js may and may not be suitable.
7 Most Powerful Solar Storms in the History of Earth.pdfEnterprise Wired
Solar Storms (Geo Magnetic Storms) are the motion of accelerated charged particles in the solar environment with high velocities due to the coronal mass ejection (CME).
UiPath Community Day Kraków: Devs4Devs ConferenceUiPathCommunity
We are honored to launch and host this event for our UiPath Polish Community, with the help of our partners - Proservartner!
We certainly hope we have managed to spike your interest in the subjects to be presented and the incredible networking opportunities at hand, too!
Check out our proposed agenda below 👇👇
08:30 ☕ Welcome coffee (30')
09:00 Opening note/ Intro to UiPath Community (10')
Cristina Vidu, Global Manager, Marketing Community @UiPath
Dawid Kot, Digital Transformation Lead @Proservartner
09:10 Cloud migration - Proservartner & DOVISTA case study (30')
Marcin Drozdowski, Automation CoE Manager @DOVISTA
Pawel Kamiński, RPA developer @DOVISTA
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
09:40 From bottlenecks to breakthroughs: Citizen Development in action (25')
Pawel Poplawski, Director, Improvement and Automation @McCormick & Company
Michał Cieślak, Senior Manager, Automation Programs @McCormick & Company
10:05 Next-level bots: API integration in UiPath Studio (30')
Mikolaj Zielinski, UiPath MVP, Senior Solutions Engineer @Proservartner
10:35 ☕ Coffee Break (15')
10:50 Document Understanding with my RPA Companion (45')
Ewa Gruszka, Enterprise Sales Specialist, AI & ML @UiPath
11:35 Power up your Robots: GenAI and GPT in REFramework (45')
Krzysztof Karaszewski, Global RPA Product Manager
12:20 🍕 Lunch Break (1hr)
13:20 From Concept to Quality: UiPath Test Suite for AI-powered Knowledge Bots (30')
Kamil Miśko, UiPath MVP, Senior RPA Developer @Zurich Insurance
13:50 Communications Mining - focus on AI capabilities (30')
Thomasz Wierzbicki, Business Analyst @Office Samurai
14:20 Polish MVP panel: Insights on MVP award achievements and career profiling
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Erasmo Purificato
Slide of the tutorial entitled "Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Emerging Trends" held at UMAP'24: 32nd ACM Conference on User Modeling, Adaptation and Personalization (July 1, 2024 | Cagliari, Italy)
Transcript: Details of description part II: Describing images in practice - T...BookNet Canada
This presentation explores the practical application of image description techniques. Familiar guidelines will be demonstrated in practice, and descriptions will be developed “live”! If you have learned a lot about the theory of image description techniques but want to feel more confident putting them into practice, this is the presentation for you. There will be useful, actionable information for everyone, whether you are working with authors, colleagues, alone, or leveraging AI as a collaborator.
Link to presentation recording and slides: https://bnctechforum.ca/sessions/details-of-description-part-ii-describing-images-in-practice/
Presented by BookNet Canada on June 25, 2024, with support from the Department of Canadian Heritage.
Understanding Insider Security Threats: Types, Examples, Effects, and Mitigat...Bert Blevins
Today’s digitally connected world presents a wide range of security challenges for enterprises. Insider security threats are particularly noteworthy because they have the potential to cause significant harm. Unlike external threats, insider risks originate from within the company, making them more subtle and challenging to identify. This blog aims to provide a comprehensive understanding of insider security threats, including their types, examples, effects, and mitigation techniques.
BT & Neo4j: Knowledge Graphs for Critical Enterprise Systems.pptx.pdfNeo4j
Presented at Gartner Data & Analytics, London Maty 2024. BT Group has used the Neo4j Graph Database to enable impressive digital transformation programs over the last 6 years. By re-imagining their operational support systems to adopt self-serve and data lead principles they have substantially reduced the number of applications and complexity of their operations. The result has been a substantial reduction in risk and costs while improving time to value, innovation, and process automation. Join this session to hear their story, the lessons they learned along the way and how their future innovation plans include the exploration of uses of EKG + Generative AI.
Best Programming Language for Civil EngineersAwais Yaseen
The integration of programming into civil engineering is transforming the industry. We can design complex infrastructure projects and analyse large datasets. Imagine revolutionizing the way we build our cities and infrastructure, all by the power of coding. Programming skills are no longer just a bonus—they’re a game changer in this era.
Technology is revolutionizing civil engineering by integrating advanced tools and techniques. Programming allows for the automation of repetitive tasks, enhancing the accuracy of designs, simulations, and analyses. With the advent of artificial intelligence and machine learning, engineers can now predict structural behaviors under various conditions, optimize material usage, and improve project planning.
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc
Six months into 2024, and it is clear the privacy ecosystem takes no days off!! Regulators continue to implement and enforce new regulations, businesses strive to meet requirements, and technology advances like AI have privacy professionals scratching their heads about managing risk.
What can we learn about the first six months of data privacy trends and events in 2024? How should this inform your privacy program management for the rest of the year?
Join TrustArc, Goodwin, and Snyk privacy experts as they discuss the changes we’ve seen in the first half of 2024 and gain insight into the concrete, actionable steps you can take to up-level your privacy program in the second half of the year.
This webinar will review:
- Key changes to privacy regulations in 2024
- Key themes in privacy and data governance in 2024
- How to maximize your privacy program in the second half of 2024
Fluttercon 2024: Showing that you care about security - OpenSSF Scorecards fo...Chris Swan
Have you noticed the OpenSSF Scorecard badges on the official Dart and Flutter repos? It's Google's way of showing that they care about security. Practices such as pinning dependencies, branch protection, required reviews, continuous integration tests etc. are measured to provide a score and accompanying badge.
You can do the same for your projects, and this presentation will show you how, with an emphasis on the unique challenges that come up when working with Dart and Flutter.
The session will provide a walkthrough of the steps involved in securing a first repository, and then what it takes to repeat that process across an organization with multiple repos. It will also look at the ongoing maintenance involved once scorecards have been implemented, and how aspects of that maintenance can be better automated to minimize toil.
Quantum Communications Q&A with Gemini LLM. These are based on Shannon's Noisy channel Theorem and offers how the classical theory applies to the quantum world.
How Social Media Hackers Help You to See Your Wife's Message.pdfHackersList
In the modern digital era, social media platforms have become integral to our daily lives. These platforms, including Facebook, Instagram, WhatsApp, and Snapchat, offer countless ways to connect, share, and communicate.
Comparison Table of DiskWarrior Alternatives.pdfAndrey Yasko
To help you choose the best DiskWarrior alternative, we've compiled a comparison table summarizing the features, pros, cons, and pricing of six alternatives.
An invited talk given by Mark Billinghurst on Research Directions for Cross Reality Interfaces. This was given on July 2nd 2024 as part of the 2024 Summer School on Cross Reality in Hagenberg, Austria (July 1st - 7th)
Kief Morris rethinks the infrastructure code delivery lifecycle, advocating for a shift towards composable infrastructure systems. We should shift to designing around deployable components rather than code modules, use more useful levels of abstraction, and drive design and deployment from applications rather than bottom-up, monolithic architecture and delivery.
Details of description part II: Describing images in practice - Tech Forum 2024BookNet Canada
This presentation explores the practical application of image description techniques. Familiar guidelines will be demonstrated in practice, and descriptions will be developed “live”! If you have learned a lot about the theory of image description techniques but want to feel more confident putting them into practice, this is the presentation for you. There will be useful, actionable information for everyone, whether you are working with authors, colleagues, alone, or leveraging AI as a collaborator.
Link to presentation recording and transcript: https://bnctechforum.ca/sessions/details-of-description-part-ii-describing-images-in-practice/
Presented by BookNet Canada on June 25, 2024, with support from the Department of Canadian Heritage.
4. Tornado
● Tornado - a scalable, non-blocking web server.
● Also a minimal Web Application Framework.
Written in Python. Open source - Apache V2.0 license.
● Originally built by FriendFeed (acquired by Facebook).
"The framework is distinct from most mainstream web server
frameworks (and certainly most Python frameworks) because it is non-
blocking and reasonably fast. Because it is non-blocking and uses epoll
or kqueue, it can handle thousands of simultaneous standing
connections, which means it is ideal for real-time web services." -
Tornado Web Server Home page blurb.
6. Hello World!
from tornado import ioloop
from tornado import web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
app = web.Application([(r"/", MainHandler),])
if __name__ == "__main__":
srv = httpserver.HTTPServer(app)
app.listen(8080)
ioloop.IOLoop.instance().start()
7. Our Mission
● Analyze "Hello World" application and figure
out what happens at every step of the way.
All the way from how the server is setup to
how the entire request-response cycle works
under the hood.
● But first a little bit of background about
sockets and poll.
9. Sockets
● Network protocols are handled through a
programming abstraction known as sockets.
Socket is an object similar to a file that
allows a program to accept incoming
connection, make outgoing connections, and
send and receive data. Before two machines
can communicate, both must create a socket
object. The Python implementation just calls
the system sockets API.
● For more info $ man socket
10. Sockets - Address, Family
and Type
● Address - Combination of IP address and
port
● Address family - controls the OSI network
layer protocol, for example AF_INET for
IPv4 Internet sockets using IPv4.
● Socket type - controls the transport layer
protocol, SOCK_STREAM for TCP.
11. TCP Connection sequence
Server Client
socket() socket()
bind()
listen()
accept()
wait for connection establish connection
connect()
request
read() write()
process
response
write() read()
12. Client Socket Example
#Examples from Socket Programming HOWTO
#create an INET, STREAMing socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#now connect to the web server on port 8080
s.connect(("www.mcmillan-inc.com", 8080))
13. Server Socket Example
#Examples from Socket Programming HOWTO
#create an INET, STREAMing socket
serversocket = socket.socket(socket.AF_INET,
socket.SOCK_STREAM)
#bind the socket to a public host,and a well-known port
serversocket.bind('localhost', 8080))
#become a server socket
serversocket.listen(5)
while True:
#accept connections from outside
(clientsocket, address) = serversocket.accept()
#do something. In this case assume in a different
thread
ct = client_thread(clientsocket)
ct.run()
14. Server Socket explained
“server socket ... doesn’t send any data. It doesn’t receive
any data. It just produces client sockets. Each client socket
is created in response to some other client socket doing a
connect() to the host and port we’re bound to. As soon as
we’ve created that client socket, we go back to listening for
more connections. The two clients are free to chat it up -
they are using some dynamically allocated port which will
be recycled when the conversation ends.”
- Gordon McMillan in Socket Programming HOWTO
15. Server Socket Loop
Three options -
● dispatch a thread to handle client socket
● create a new process to handle client socket
● Use non-blocking sockets, and mulitplex
between our server socket and any active
client sockets using select.
16. Sockets - Blocking vs. Non-
blocking
● Blocking sockets - socket API calls will block
indefinitely until the requested action (send,
recv, connect or accept) has been
performed.
● Non-blocking sockets - send, recv,
connect and accept can return
immediately without having done anything.
● In Python, you can use socket.
setblocking(0) to make a socket non-
blocking.
17. Handling non-blocking
sockets
“You have (of course) a number of
choices. You can check return
code and error codes and
generally drive yourself crazy. If
you don’t believe me, try it
sometime. Your app will grow
large, buggy and suck CPU. So let’
s skip the brain-dead solutions
and do it right. …
Use select.” Gordon McMillan - Author of
Socket Programming HOWTO &
creator of PyInstaller
18. References
● Socket Programming HOWTO by Gordon
McMillan
● Python Module of the Week (PyMOTW) -
Socket by Doug Hellmann
● Python Essential Reference by David Beazley
20. select
● A system call - allows a program to monitor
multiple file descriptors, waiting until one or
more of the file descriptors become "ready"
for some class of I/O operation
● More info $ man select
● Python’s select() function is a direct
interface to the underlying operating system
implementation.
21. poll
● poll() scales better than select().
● poll() - only requires listing the file
descriptors of interest, while select()
builds a bitmap, turns on bits for the fds of
interest, and then afterward the whole
bitmap has to be linearly scanned again.
● select() is O(highest file
descriptor), while poll() is O(number
of file descriptors).
22. poll API
● Create a poll object
p = select.poll()
● Register a fd and the events of interest to be
notified about
p.register(fd, events)
● Start monitoring. You will be notified if there
is an event of interest on any of the
registered fd's.
p.poll([timeout])
23. epoll
● epoll() system call has event notification
facility.
● So epoll is O(active fd's), poll is O
(registered fd's)
● So epoll faster than poll (there is debate
about exactly how much faster, but let's not
get into that ... because I have no idea).
● Provides exactly same API as poll.
● Tornado tries to use epoll or kqueue and
falls back to select if it cannot find them.
24. References
● Python Module of the Week (PyMOTW) -
select by Doug Hellmann
● The C10K problem by Dan Kegel
● poll, epoll, science, superpoll by Zed Shaw
30. srv.listen(8080)
● First it calls bind_sockets() method
which creates non-blocking, listening
server socket (or sockets) bound to the
given address and port (in this case
localhost:8080).
● Then creates an instance of the IOLoop
object
self.io_loop = IOLoop.instance()
31. IOLoop.__init__
● New select.epoll object is created.
self._impl = select.epoll()
● We will register the file descriptors of the
server sockets with this epoll object to
monitor for events on the sockets. (will be
explained shortly).
33. TCPServer listen() continued
● TCPServer keeps track of the sockets in the _sockets
dict - {fd: socket}
● An accept_handler function is created for each socket
and passed to the IOLoop.add_handlers() method.
● accept_handler is a thin wrapper around a callback
function which just accepts the socket (socket.
accept()) and then runs the callback function.
● In this case the callback function is the
_handle_connection method of the TCPServer.
More on this later.
34. Adding handlers to IOLoop
● Updates ioloop._handlers, with {fd:
accept_handler} to keeps track of which
handler function needs to be called when a
client tries to establish a connection.
● Registers the fd (file descriptor) and data
input and error events for the corresponding
socket with IOLoop._impl (the epoll
object).
35. Current status
Read and error events on
fd's registered with _impl
37. IOLoop.instance().start()
● start() method starts the IOLoop. The IOLoop is
the heartbeat and the nerve center of
everything.
● Continually runs any callback functions, callbacks
related to any timeouts, and then runs poll() method
on self._impl the epoll object for any new data
input events on the socket.
● Note: A connect() request from a client is considered
as an input event on a server socket.
● There is logic in here to send signals to wake up the I/O
loop from idle state, ways to run periodic tasks using
timeouts etc. which we won't get into.
39. What happens when a client
connects?
● The client socket connect() is captured by the
poll() method in the IOLoop's start() method.
● The server runs the accept_handler which
accept()'s the connection, then immediately runs the
associated callback function.
● Remember that accept_handler is a closure that
wraps the callback with logic to accept() the
connection, so accept_handler knows which callback
function to run.
● The callback function in this case is
_handle_connection method of TCPServer
40. TCPServer._handle_connection()
● Creates an IOStream object.
● IOStream is a wrapper around non-
blocking sockets which provides utilities to
read from and write to those sockets.
● Then calls HTTPServer.handle_stream
(...)and passes it the IOStream object
and the client socket address.
41. HTTPServer.handle_stream(...)
● handle_stream() method creates a
HTTPConnection object with our app as a
request_callback.
● HTTPConnection handles a connection to
an HTTP client and executes HTTP requests.
Has methods to parse HTTP headers, bodies,
execute callback tasks etc.
42. HTTPConnection.__init__()
● Reads the headers until "rnrn" ...
delegated to the IOStream object.
self.stream.read_until(b("rnrn"),
self._header_callback)
● _header_callback is _on_headers
method of HTTPConnection. (We'll get to
that in a moment).
43. IOStream read
● A bunch of redirections to various _read_* methods.
Finally once the headers are read and parsed, invokes
_run_callback method. Invokes the socket.
recv() methods.
● Call back is not executed right away, but added to the
IOLoop instance to be called in the next cycle of the IO
loop.
self.io_loop.add_callback(wrapper)
● wrapper is just a wrapper around the callback with
some exception handling. Remember, our callback is
_on_headers method of HTTPConnection object
44. HTTPConnection._on_headers
● Creates the appropriate HTTPRequest
object (now that we have parsed the
headers).
● Then calls the request_callback and
passes the HTTPRequest. Remember this?
May be you don't after all this ...
request_callback is the original app we
created.
● Whew! Light at the end of the tunnel. Only a
couple more steps.
45. app.__call__
● Application is a callable object (has the
__call__ method. So you can just call an
application.
● The __call__ method looks at the url in
the HTTPRequest and invokes the
_execute method of appropriate
RequestHandler - the MainHandler in
our example.
46. RequestHandler._execute
● Executes the appropriate HTTP method
getattr(self,self.request.method.lower()
)(*args, **kwargs)
● In our case get method calls write() and
writes the "Hello World" string.
● Then calls finish() method which
prepares response headers and calls
flush() to write the output to the socket
and close it.
47. Writing the output and closing
● RequestHandler.flush() delegates the write() to
the request, which in turn delegates it to the
HTTPConnection which in turn delegates it to the
IOStream.
● IOStream adds this write method to the IOLoop.
_callbacks list and the write is executed in turn
during the next iteration of IOLoop.
● Once everything is done, the socket is closed (unless of
course you specify that it stay open).
48. Points to note ...
● Note that we did fork a process.
● We did not spawn a thread.
● Everything happens in just one thread and is
multiplexed using epoll.poll()
● Callback handlers are run one at a time, in
turn, on a single thread.
● If a callback task (in the RequestHandler)
is long running, for example a database
query that takes too long, the other requests
which are queued behind will suffer.
49. Other things to consider
● You can make your request handler
asynchronous, and keep the connection open
so that other requests do not suffer.
● But you have to close the connection
yourself.
● See the chat example in the source code.
51. Apache - multiple requests
● How multiple requests are handled depends
on Multiprocessing mode (MPM).
● Two modes
○ prefork
○ worker
52. prefork MPM
● Most commonly used. Is the default mode in
2.x and only option in 1.3.
● The main Apache process will at startup
create multiple child processes. When a
request is received by the parent process, it
will be processed by whichever of the child
processes is ready.
53. worker MPM
● Within each child process there will exist a
number of worker threads.
● The request may be processed by a worker
thread within a child process which already
has other worker threads handling other
requests at the same time.
54. Apache vs. Tornado
● Apache has additional memory overhead of
maintaining the other processes which are
essentially idle when the request load is low.
Tornado does not have this overhead.
● Tornado natively allows you to use
websockets. Experimental support in
apache with apache-websocket module.
● Scalability - There are arguments for both
sides. Personally I haven't built anything that
cannot be scaled by Apache. So no idea if one
is better than the other.