Eduardo

Similar documents
Unifying Events & Logs into the Cloud

Fluentd. Open Source Data Collector. Eduardo Jan 23, 2016 Scale14x, Pasadena!

Snapt Accelerator Manual

AWS Lambda. 1.1 What is AWS Lambda?

Flash: an efficient and portable web server

How to Route Internet Traffic between A Mobile Application and IoT Device?

Foundations of Python

AWS Lambda + nodejs Hands-On Training

Project Zygote. Rapid prototyping for the Internet of Things

19: Networking. Networking Hardware. Mark Handley

Etanova Enterprise Solutions

TECHNICAL NOTE. Oracle Protocol Agent Overview. Version 2.5 TECN04_SG2.5_

Think Small to Scale Big

Apple. Massive Scale Deployment / Connectivity. This is not a contribution

ProxySQL's Internals

WHITE PAPER NGINX An Open Source Platform of Choice for Enterprise Website Architectures

Informatica Ultra Messaging Streaming Edition Version Release Notes June Contents. New Features and Enhancements.

FIREFLY ARCHITECTURE: CO-BROWSING AT SCALE FOR THE ENTERPRISE

How to Pick the Right PI Developer Technology for your Project

Libelium Cloud Hive. Technical Guide

Operating Systems Design Exam 3 Review: Spring Paul Krzyzanowski

Internet Technology. 06. Exam 1 Review Paul Krzyzanowski. Rutgers University. Spring 2016

Apica ZebraTester. Advanced Load Testing Tool and Cloud Platform

Internet Technology 3/2/2016

Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios

Assignment 2 Group 5 Simon Gerber Systems Group Dept. Computer Science ETH Zurich - Switzerland

Course: JBoss Training: JBoss AS 7 and JBoss EAP 6 Administration and Clustering Training

Real Life Web Development. Joseph Paul Cohen

Much Faster Networking

Daintree Light Sensor Demo Application Note

IO-Lite: A Unified I/O Buffering and Caching System

Python Twisted. Mahendra

Using the Cisco ACE Application Control Engine Application Switches with the Cisco ACE XML Gateway

JBOSS AS 7 AND JBOSS EAP 6 ADMINISTRATION AND CLUSTERING (4 Days)

Send me up to 5 good questions in your opinion, I ll use top ones Via direct message at slack. Can be a group effort. Try to add some explanation.

Soletta. Closing the IoT Development Gap. OpenIoT & ELC Europe 2016

Scaling DreamFactory

lean enterprise middleware High Volume Web API Management with WSO2 ESB

Networking and Internetworking 1

IoT usecase for Yocto Project

The friendly operating system for the IoT!

User Datagram Protocol

A Library and Proxy for SPDY

System Administration. NFS & Web Servers

CS 470 Spring Distributed Web and File Systems. Mike Lam, Professor. Content taken from the following:

IERG 4080 Building Scalable Internet-based Services

Operating Systems. 17. Sockets. Paul Krzyzanowski. Rutgers University. Spring /6/ Paul Krzyzanowski

Active Endpoints. ActiveVOS Platform Architecture Active Endpoints

SPDY - A Web Protocol. Mike Belshe Velocity, Dec 2009

Network Automation using modern tech. Egor Krivosheev 2degrees

describe the functions of Windows Communication Foundation describe the features of the Windows Workflow Foundation solution

Integrate MATLAB Analytics into Enterprise Applications

Using Node-RED to build the internet of things

MASTERS COURSE IN FULL STACK WEB APPLICATION DEVELOPMENT W W W. W E B S T A C K A C A D E M Y. C O M

CS 470 Spring Distributed Web and File Systems. Mike Lam, Professor. Content taken from the following:

tcpcrypt: real transport-level encryption Andrea Bittau, Mike Hamburg, Mark Handley, David Mazieres, Dan Boneh. UCL and Stanford.

Modernizing Meetings: Delivering Intel Unite App Authentication with RFID

COPYRIGHTED MATERIAL

Elastic Load Balancing. User Guide. Date

Lecture 8: February 19

DCCP (Datagram Congestion Control Protocol)

Experimental Evaluation of Transport Services CoAP, HTTP and SPDY for Internet of Things

The Gearman Cookbook OSCON Eric Day Senior Software Rackspace

Lecture 8: Other IPC Mechanisms. CSC 469H1F Fall 2006 Angela Demke Brown

Topics. Lecture 8: Other IPC Mechanisms. Socket IPC. Unix Communication

The Application Layer HTTP and FTP

COMET, HTML5 WEBSOCKETS OVERVIEW OF WEB BASED SERVER PUSH TECHNOLOGIES. Comet HTML5 WebSockets. Peter R. Egli INDIGOO.COM. indigoo.com. 1/18 Rev. 2.

csdesign Documentation

Cloudamize Agents FAQ

The SMACK Stack: Spark*, Mesos*, Akka, Cassandra*, Kafka* Elizabeth K. Dublin Apache Kafka Meetup, 30 August 2017.

Global Servers. The new masters

Managing & Accelerating Innovation with Open Source at the Edge

Smashing Node.JS: JavaScript Everywhere

Lecture 7: February 10

Distributed Systems 8. Remote Procedure Calls

Digi Connect ME TM. Integration Guide

User Manual. Admin Report Kit for IIS 7 (ARKIIS)

Servlet Performance and Apache JServ

Reading nginx CHANGES together

Congestion Manager. Nick Feamster Computer Networks. M.I.T. Laboratory for Computer Science. October 24, 2001

70-487: Developing Windows Azure and Web Services

Corey Clark PhD Daniel Montgomery

ForeScout CounterACT. Configuration Guide. Version 3.4

Internet Connectivity with

Exam C IBM Cloud Platform Application Development v2 Sample Test

ForeScout Open Integration Module: Data Exchange Plugin

Loadbalancer.org Virtual Appliance quick start guide v6.3

Kaazing Gateway: An Open Source

Writing a Janus plugin in Lua

Bambu API Documentation

Transitioning from C# to Scala Using Apache Thrift. Twitter Finagle

BEAAquaLogic. Service Bus. MQ Transport User Guide

Web as a Distributed System

High Volume Messaging with IBM MessageSight for use in Mobile, Web and M2M solutions

TomcatCon London 2017 Clustering Mark Thomas

Networked Applications: Sockets. End System: Computer on the Net

OCF Specification Overview Core Technology Specification. OCF 2.0 Release June 2018

Web Services in Cincom VisualWorks. WHITE PAPER Cincom In-depth Analysis and Review

Network Implementation

Exam : Implementing Microsoft Azure Infrastructure Solutions

Transcription:

Eduardo Silva @edsiper eduardo@treasure-data.com

About Me Eduardo Silva Github & Twitter Personal Blog @edsiper http://edsiper.linuxchile.cl Treasure Data Open Source Engineer Fluentd / Fluent Bit http://github.com/fluent Projects Monkey HTTP Server Duda I/O http://monkey-project.com http://duda.io

HTTP Everywhere Use cases Home Automation Big Data Data Collection Internet of Things Wearables Automotive basically everywhere...

Monkey HTTP Server

Monkey HTTP Server Highlights Event driven Multi-thread Zero copy strategy Memory optimization Secure Optimized for Linux, but compatible with others. Embedded Linux / Yocto Open Source: Apache License v2.0

Monkey HTTP Server Modular Design mk_core: agnostic runtime for handling of strings, memory, event loop, configuration reader, vectors and utilities within others. mk_server: TCP server, data streams, protocols, plugins manager, scheduler and general runtime setup. plugins: networking layer for I/O operations, stage handlers and content handlers.

Architecture

Monkey HTTP Server Architecture

Monkey HTTP Server Master Process Prepare the environment. Read and process configuration. Load plugins and initialize them. Create a Scheduler instance. All things required before joining the event loop.

Monkey HTTP Server Scheduler Balancing mode / OS check: Fair balancing Shared TCP ports (SO_REUSEPORT) Setup Listeners. Create the event loop for each worker. Handle incoming connections.

Monkey HTTP Server Scheduler mode: Fair balancing One scheduler instance. It accepts all connections. Distribute to the less busy worker. Old fashion mechanism.

Monkey HTTP Server Scheduler mode: Shared TCP ports Scheduler handler, one per worker. Connections are distributed by the Kernel. High performance, less contention. SO_REUSEPORT

Monkey HTTP Server Scheduler: Listeners Bind a network address to listen for connections. TCP port Associate Network I/O layer handler plugin. Associate protocol handler for each connection.

Monkey HTTP Server Workers Each worker have one event loop. Associate Listeners with connections. Handle protocol operations based on events notified. Timeout connections. Cleanup sessions.

Monkey HTTP Server Workers: event loop

Plugins

Monkey HTTP Server Plugins Monkey core provides only basic HTTP processing Plugins provides interfaces for: Network I/O operations Security Content Handling HTTP Stages / Hooks

Monkey Plugins Network Layer: I/O Liana: Basic socket I/O handling, for short plain sockets. TLS: built on top of mbedtls, provides SSL and TLS encryption capabilities when writing/reading data over sockets. Monkey core and content handling plugins are not aware about how the network I/O is being handled, unless they ask for

Monkey Plugins Plugins: stages Each stage represents a phase of an incoming request cycle inside the server: STAGE 10 Connection accepted. STAGE 20 Request have been received. STAGE 30 Content handler. STAGE 40 Response completed. STAGE 50 Connection closed.

Monkey Plugins Plugins: STAGE 10 Every time a connection is accepted by the scheduler, the plugins associated with this stage are triggered. The security plugin mandril, hooks to this stage and provides restrictions by IP.

Monkey Plugins Plugins: STAGE 20 This stage triggers the plugins callbacks every time a request have arrived successfully to the server.

Monkey Plugins Plugins: STAGE 30 Well known as the content handler, owns the request and process a response. Some plugins that works at this level are: FastCGI CGI Directory Listing Duda I/O

Monkey Plugins Plugins: STAGE 40 Once a request have finished like completed successfully or due to an exception, this stage is triggered. The logger plugin makes use of this stage to make sure to register all kind of events.

Monkey Plugins Plugins: STAGE 50 This stage triggers the associated callbacks every time a TCP connection is closed by a protocol, scheduler timeout or due to any network anomaly found.

Monkey HTTP Server Memory Handling Just one memory allocation per TCP connection. Jemalloc memory allocator built-in by default, if desired it can be disabled at build time.

Monkey HTTP Server System calls / Tweaks sendfile(2) writev(2) splice(2) epoll(7) kqueue(2) accept4(2) static content delivery write multiple buffers as an array (headers) move data between file descriptors (logger) I/O event notification on Linux I/O event notification on OSX & BSD accept connection and set option (non block) TCP_CORK send only full packets (on-demand) SO_REUSEPORT shared TCP ports (if available) SOCK_NONBLOCK non-blocking sockets

Monkey HTTP Server Clock thread: cached date The server spawns a thread named clock. It basically update a local memory buffer with a formatted version of the current time. This info is mandatory in the response header. note: if you get 1000 request per second, you don't want to do a string formatting 1000 times for the same time.

Monkey HTTP Server Indented Configuration Force people to use an indented format, avoid a spaghetti configuration. note: it works!, read Python code ;)

Monkey HTTP Server Linux Kernel detection If running on Linux, check the Kernel version and enable some features if they are available, e.g: TCP_FASTOPEN SO_REUSEPORT TCP_AUTOCORKING (currently disabled)

Monkey HTTP Server Embedded Linux Monkey is a Yocto compliant project and available through meta-openembedded. We distribute packages for Raspbian

Monkey HTTP Server General features HTTP/1.1 Virtual Hosts IPv4 / IPv6 TLS/SSL CGI FastCGI Directory Listing Log Writer Basic Authentication

HTTP/2.0

Monkey and HTTP/2.0 Status Internals need some rewrite to start implementing the new version of the protocol: done. Listener must support multiple protocols: done. HTTP/2.0 handshake and further spec: work in process. The goal is to have a functional HTTP/2.0 version before the end of this year. The hard part were to extend the internals to start supporting all requirements.

Monkey Roadmap HTTP/2.0 Proxy reverse Restore library mode Co-routines Logging Layer instead of plugin hooks. URL rewrite support.

Web Services

Web Services What do we usually expect Lightweight? High Performance? Extensible? Scalabale? Secure?

Web Services A short story, facts: Company X was developing an Apnea monitoring product for in-house usage (2011). Target device was a low cost ARM end device. They develop their web service in Java. When they ported the web service to the ARM device, each HTTP request took a few seconds to reply =/.

Web Services Workarounds Use a more expensive ARM device that Java supported better? Pay $Oracle to improve Java for that specific ARM architecture? Build the web service in a better language from scratch?

Web Services Almost write from scratch Monkey was already optimized for ARM, it have an extensible architecture. Write a Monkey extension that provides a flexible and easy C API to implement web services. So a new project was born...

http://duda.io

Duda I/O About Duda is a scalable web services stack (made in C). x86, x86_64 & ARM. Open Source / Apache License v2.0. Target: high end production servers and Embedded Linux.

Duda I/O Features Event driven JSON / MySQL / Redis / SQLite Friendly C API / Objects Packages support Co-routines In-memory Key value store HTTP / HTTPS much more!... WebSockets

Duda I/O Architecture

Duda I/O Performance matters!

Duda I/O Production ready Big Data Real Time Bidding Home Automation Mobile Backends Etc...

Monkey and IoT

Internet of Things Facts IoT will grow to many billions of devices over the next decade. Now it's about device to device connectivity. Different frameworks and protocols are emerging. It needs Logging.

Internet of Things Alliances Vendors formed alliances to join forces and develop generic software layers for their products:

Internet of Things Solutions provided Alliance Framework

IoT and Big Data Analytics IoT requires a generic solution to collect events and data from different sources for further analysis. Data can come from a specific framework, radio device, sensor and others. How do we collect and unify data properly?

http://fluentbit.io

Fluent Bit Open Source data collector It let's you collect data from IoT/Embedded devices and transport It to third party services.

Fluent Bit Targets Services Sensors / Signals / Radios Operating System information Automotive / Telematics

Fluent Bit I/O

Fluent Bit Direct Output

Fluent Bit Architecture

Fluent Bit Core Engine Everything related to initialization. Interface plugins. Abstract network operations. Make the magic happens.

Fluent Bit Input Plugins Collect data. Behave as a network service, built-in metric or generator. It runs at intervals of time (triggered by the Engine) or upon file descriptor events.

Fluent Bit Output Pllugins Take buffered data and enqueue it for delivery. It knows how to send data to X endpoint or service. Usually deal with protocols.

Fluent Bit Stack Providers Fluent Bit have three dependencies which are distributed in the source code and are linked statically. These components are helpers for the Engine and Plugins Manager.

Fluent Bit Monkey / HTTP Stack Provider Monkey is a web server that provides an embeddable HTTP stack and some extra routines to handle configuration files, memory handling, event loops, string manipulation within others.

Fluent Bit Library Mode

Join us! http://monkey-project.com http://duda.io http://fluentbit.io http://github.com/monkey http://github.com/fluent @edsiper Thank you!