Comet for Highly- Scalable Applications

Similar documents
Lightstreamer. The Streaming-Ajax Revolution. Product Insight

Scaling Slack. Bing Wei

Large-scale Game Messaging in Erlang at IMVU

Simple Jabber - Divide And Conquer XMPP

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

Which tools should you use to design? DESIGN FUNDAMENTALS

Kaazing Gateway: An Open Source

Building next-gen Web Apps with WebSocket. Copyright Kaazing Corporation. All rights reserved.

CS 160: Interactive Programming

Cloud versus direct with VNC Connect

IsoStack Highly Efficient Network Processing on Dedicated Cores

The API is dead. Long live the protocol.

Kaazing. Connect. Everything. WebSocket The Web Communication Revolution

Building a Data-Friendly Platform for a Data- Driven Future

High performance and scalable architectures

IERG 4080 Building Scalable Internet-based Services

Chapter Outline. Chapter 2 Distributed Information Systems Architecture. Layers of an information system. Design strategies.

Nick Terkay CSCI 7818 Web Services 11/16/2006

Memshare: a Dynamic Multi-tenant Key-value Cache

A Scalable Event Dispatching Library for Linux Network Servers

Processes and Threads. Processes: Review

Performance Case Study

VNC Connect security whitepaper. Cloud versus direct with VNC Connect

Software Requirement Specification

The Future of the Web: HTML 5, WebSockets, Comet and Server Sent Events

Chapter Outline. Chapter 2 Distributed Information Systems Architecture. Distributed transactions (quick refresh) Layers of an information system

In this unit we are going to look at cloud computing. Cloud computing, also known as 'on-demand computing', is a kind of Internet-based computing,

Performance and Scalability with Griddable.io

Developing Enterprise Cloud Solutions with Azure

Module 6 Node.js and Socket.IO

Gustavo Alonso, ETH Zürich. Web services: Concepts, Architectures and Applications - Chapter 1 2

Kernel Korner AEM: A Scalable and Native Event Mechanism for Linux

Deploying Ajax Comet Applications

Fast Track to Java EE

Kony and TIBCO enable fast reliable Websockets Communication. Overview of the integration of WebSockets with TIBCO eftl and the Kony Platform

Brad Drysdale. HTML5 WebSockets - the Web Communication revolution, making the impossible, possible. Main sponsor

Medical practice: diagnostics, treatment and surgery in supercomputing centers

Etanova Enterprise Solutions

Apache BookKeeper. A High Performance and Low Latency Storage Service

Chapter 1: Distributed Information Systems

CS533 Concepts of Operating Systems. Jonathan Walpole

Scaling up: How we made millions of domains happier. Tom Arnfeld, DNS Engineer Pavel Odintsov, DNS Engineer

SEDA: An Architecture for Well-Conditioned, Scalable Internet Services

Conversing in the Cloud. Ryan Kupfer, Scott Wetter, Bryan Welfel, Shekhar Pradhan

QoS-Aware Admission Control in Heterogeneous Datacenters

Diagnosis via monitoring & tracing

COMMUNICATION PROTOCOLS

Simple idea 1: load-time linking. Our main questions. Some terminology. Simple idea 2: base + bound register. Protection mechanics.

CS 498RK FALL RESTFUL APIs

Build the realtime web with XMPP and Wave

Team 5: Fault-Terminators

PRESENTATION TITLE GOES HERE

Designing for Performance: Concurrency and Parallelism

Building a Real-time Notification System

Data Acquisition. The reference Big Data stack

Server execution of JavaScript: What could possibly go wrong?

Java Concurrency in practice Chapter 9 GUI Applications

CSC 539: Operating Systems Structure and Design. Spring 2006

Internet Technology 2/18/2016

Hazard Pointers. Number of threads unbounded time to check hazard pointers also unbounded! difficult dynamic bookkeeping! thread B - hp1 - hp2

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 31 October 2012

S1 Informatic Engineering

System requirements for Qlik Sense. Qlik Sense June 2018 Copyright QlikTech International AB. All rights reserved.

Zing Vision. Answering your toughest production Java performance questions

RFC 003 Event Service October Computer Science Department October 2001 Request for Comments: 0003 Obsoletes: none.

Computer Systems Assignment 4: Scheduling and I/O

Layered UI and Adaptation Policies for Ubiquitous Web Applications

JavaScript CS 4640 Programming Languages for Web Applications

Delivering Real- Time Internet Solutions

Pro2SQL. OpenEdge Replication. for Data Reporting. for Disaster Recovery. March 2017 Greg White Sr. Progress Consultant Progress

SRAMs to Memory. Memory Hierarchy. Locality. Low Power VLSI System Design Lecture 10: Low Power Memory Design

Harnessing the Power of HTML5 WebSocket to Create Scalable Real-time Applications. Brian Albers & Peter Lubbers, Kaazing

Integrate MATLAB Analytics into Enterprise Applications

Optimizing Software-Defined Storage for Flash Memory

How to re-invent your IT Architecture. André Christ, Co-CEO LeanIX

Oracle NoSQL Database at OOW 2017

Cloud platforms T Mobile Systems Programming

Modern app programming

Azure Integration Services

Abstractions and Reality

System requirements for Qlik Sense. Qlik Sense September 2017 Copyright QlikTech International AB. All rights reserved.

Introduction to data centers

Virtual Machine Design

Scaling Up Performance Benchmarking

Essential Features of an Integration Solution

More on Testing and Large Scale Web Apps

Operating Systems Overview

Diffusion TM 5.0 Performance Benchmarks

Distributed Systems. Messaging and JMS Distributed Systems 1. Master of Information System Management

Tutorial 8 Build resilient, responsive and scalable web applications with SocketPro

Lecture 7 More Memory Management Slab Allocator. Slab Allocator

CLUSTERING HIVEMQ. Building highly available, horizontally scalable MQTT Broker Clusters

Beetle. Sharing, flexibility and access control for Bluetooth Low Energy. Amit Levy James Hong Laurynas Riliskis Philip Levis Keith Winstein

Slide 6-1. Processes. Operating Systems: A Modern Perspective, Chapter 6. Copyright 2004 Pearson Education, Inc.

Real-Time Embedded User Interfaces

Servlet Performance and Apache JServ

Cross Bulk Mailer 6.2 User Guide

Software Architecture Patterns

Processes and Threads

ebay Marketplace Architecture

Transcription:

Comet for Highly- Scalable Applications Michael Carter and Arthur Lee diagrams by Jacob Rus 24 October 2007 The Ajax Experience Boston

What is Comet? Comet describes a model of user interaction Pushing real-time updates to web browsers Renkoo Gmail Chat Meebo

Old Method: Polling Otherwise known as hammering the server App (Event Dispatcher (Event Queues inside)

Old Method: Polling Otherwise known as hammering the server App (Event Dispatcher (Event Queues inside)

Old Method: Polling Otherwise known as hammering the server App (Event Dispatcher (Event Queues inside)

Old Method: Polling Otherwise known as hammering the server App (Event Dispatcher (Event Queues inside)

Old Method: Polling Otherwise known as hammering the server App (Event Dispatcher (Event Queues inside)

Old Method: Polling Otherwise known as hammering the server App (Event Dispatcher (Event Queues inside)

Polling Overview Old and busted Pros: Easy to implement Client side Server side Cons: Wasted requests Additional latency

Enter Long-Polling The new hotness Pros: Latency gone! Client side still easy Cons: Difficult to scale server-side Conceptually more complicated

Vertical Scaling: How do you scale comet on a single server? photo by Michael (mx5tx)

Vertical Scaling: How do you scale comet on a single server? Wrong way: Use a threaded server like Apache or IIS Supports a few dozen users CPU usage and latency go through the roof as users are added App Threaded Comet Dispatcher Event Queue Connect Queue

Vertical Scaling: How do you scale comet on a single server? Wrong way: Use a threaded server like Apache or IIS Supports a few dozen users CPU usage and latency go through the roof as users are added App Threaded Comet Dispatcher Event Queue Connect Queue

Vertical Scaling: How do you scale comet on a single server? Wrong way: Use a threaded server like Apache or IIS Supports a few dozen users CPU usage and latency go through the roof as users are added App Threaded Comet Dispatcher Event Queue Connect Queue

Vertical Scaling: How do you scale comet on a single server? Wrong way: Use a threaded server like Apache or IIS Supports a few dozen users CPU usage and latency go through the roof as users are added App Threaded Comet Dispatcher Event Queue Connect Queue

Vertical Scaling: How do you scale comet on a single server? Wrong way: Use a threaded server like Apache or IIS Supports a few dozen users CPU usage and latency go through the roof as users are added App Threaded Comet Dispatcher Event Queue Connect Queue

Vertical Scaling: How do you scale comet on a single server? Wrong way: Use a threaded server like Apache or IIS Compared to polling: Latency reduced for very light load Avg. latency depends on the order of events As much as 7 the CPU for moderate load CPU-bound at moderate load

Vertical Scaling: How do you scale comet on a single server? Right way: Use an event-based architecture Supports as many users as CPU and I/O can handle Event-Based Comet Dispatcher App Event Queue Connect Pool CPU usage scales linearly and latency remains low

Vertical Scaling: How do you scale comet on a single server? Right way: Use an event-based architecture Supports as many users as CPU and I/O can handle Event-Based Comet Dispatcher App Event Queue Connect Pool CPU usage scales linearly and latency remains low

Vertical Scaling: How do you scale comet on a single server? Right way: Use an event-based architecture Supports as many users as CPU and I/O can handle Event-Based Comet Dispatcher App Event Queue Connect Pool CPU usage scales linearly and latency remains low

Vertical Scaling: How do you scale comet on a single server? Right way: Use an event-based architecture Compared to polling: Decreased latency and CPU usage Compared to threaded Comet: Vastly decreased CPU usage Order of events irrelevant Performance degrades gracefully

Horizontal Scaling: How do you scale comet across many servers? photo by ulybug

Horizontal Scaling: How do you scale comet across many servers? Wrong way: Build the whole software stack into the comet server Embed publish-subscribe architecture into comet server Keep application state within comet nodes Allow comet nodes to communicate with each-other

Horizontal Scaling: How do you scale comet across many servers? Wrong way: Build the whole software stack into the comet server Design is inflexible, can t scale for some uses Comet Nodes Application Node Hard to scale to many nodes in the best case A B C D E F

Horizontal Scaling: How do you scale comet across many servers? Wrong way: Build the whole software stack into the comet server Design is inflexible, can t scale for some uses Comet Nodes Application Node A sends message to E Hard to scale to many nodes in the best case A B C D E F

Horizontal Scaling: How do you scale comet across many servers? Wrong way: Build the whole software stack into the comet server Design is inflexible, can t scale for some uses Comet Nodes Application Node E sends response to A Hard to scale to many nodes in the best case A B C D E F

Horizontal Scaling: How do you scale comet across many servers? Right way: Share nothing between nodes No CPU or I/O overhead of sharing state Application Node CPU usage scales linearly and latency remains low Comet Nodes

Horizontal Scaling: How do you scale comet across many servers? Right way: Use Orbited «wink» Distributed hash table Pre-defined hash function Application Nodes Comet Nodes Hash Function Leave authentication to app layer A B C D E F

Horizontal Scaling: How do you scale comet across many servers? Right way: Use Orbited «wink» Distributed hash table Pre-defined hash function Application Nodes Comet Nodes Hash Function B sends message to E Leave authentication to app layer A B C D E F

Horizontal Scaling: How do you scale comet across many servers? Right way: Use Orbited «wink» Distributed hash table Pre-defined hash function Application Nodes Comet Nodes Hash Function E sends response to B Leave authentication to app layer A B C D E F

Publish / Subscribe Pushing published events to groups of browsers What s it good for? Applications for which multiple users need the same live updates

Publish / Subscribe Pushing published events to groups of browsers What s it good for? Applications for which multiple users need the same live updates real-time chat

Publish / Subscribe Pushing published events to groups of browsers What s it good for? Applications for which multiple users need the same live updates stock tickers real-time chat

Scaling Pub/Sub How do you scale publish/subscribe horizontally? If we start with a single comet node, which dispatches events to multiple users in multiple groups then how do we scale up to multiple comet nodes?

Scaling Pub/Sub How do you scale publish/subscribe horizontally? If we start with a single node, which dispatches events to multiple users in multiple groups Application Node Comet Dispatcher Node A single comet node serves all users and all groups

Scaling Pub/Sub How do you scale publish/subscribe horizontally? then how do we scale up to a pair of nodes? Application Node Comet Dispatcher Nodes Either we arrange nodes by group: All of a group s events are sent by one node

Scaling Pub/Sub How do you scale publish/subscribe horizontally? then how do we scale up to a pair of nodes? Application Node Comet Dispatcher Nodes Or we arrange nodes by user: A user receives all events from the same node

Scaling Pub/Sub How do you scale publish/subscribe horizontally? But how, specifically? Split the architecture into layers Publish/Subscribe Cloud Comet Dispatcher Nodes App Do not mix pub/sub layer with comet dispatcher Treat pub/sub layer as a black box

Pub/Sub Options Publish/subscribe already has solutions Don t reinvent the wheel: Many well-understood, scalable publish/subscribe solutions exist Internet Relay Chat: Nearly 20 years old. Scales well for large groups of users. XMPP (Jabber): Flexible protocol. Does presence well, in addition to messaging. Java Message Service: It s enterprise, baby.

Pub/Sub with Orbited Orbited can be easily added to a pub/sub stack Scaling through modularity: Its simplicity makes Orbited easy to add to any web app architecture Orbited handles comet dispatch IRC or Jabber handles publish/ subscribe App servers do everything else Internet Relay Chat Application / Web Server Orbited Pub/Sub Stack IRC Bridge Orbited Browser

Conclusion: Polling latency unacceptable Comet solves this problem Impossible to scale Comet with threaded design Event-based architecture is necessary Horizontal scaling requires share nothing design Publish/subscribe is a difficult problem Scaling pub/sub is easiest with layered architecture

Michael Carter CarterMichael@gmail.com http://www.orbited.org/ 24 September 2007 AJAXWorld