Above the Clouds: Introducing Akka

Similar documents
Scaling Up & Out with Actors: Introducing Akka

Monitoring Hadoop with Akka. Clint Combs Senior Software Engineer at Collective

Wisdom from Crowds of Machines

Deployment Topologies

Glassfish Architecture.

Reactive Applications: What if Your Internet of Things has 1000s of Things?

Elastic Application Platform for Market Data Real-Time Analytics. for E-Commerce

Clustering/HA. Introduction, Helium Capabilities, and Potential Lithium Enhancements.

Clustering with Tomcat. Introduction. O'Reilly Network: Clustering with Tomcat. by Shyam Kumar Doddavula 07/17/2002

Apache Tomcat. Load-balancing and Clustering. Mark Thomas, 20 November Pivotal Software, Inc. All rights reserved.

Configuring HAproxy as a SwiftStack Load Balancer

Akka Streams. Dr. Roland Typesafe

Routing Security Server failure detection and recovery Protocol support Redundancy

CSci 8980 Mobile Cloud Computing. Mobile Cloud Programming

LOAD BALANCING TECHNIQUES FOR RELEASE 11i AND RELEASE 12 E-BUSINESS ENVIRONMENTS

Intro to Load-Balancing Tomcat with httpd and mod_jk

Chapter 2 TOPOLOGY SELECTION. SYS-ED/ Computer Education Techniques, Inc.

Oracle WebLogic Server 11g Administration

Spark Job Server. Evan Chan and Kelvin Chu. Date

Alcatel-Lucent IMS Application Server

FioranoMQ 9. High Availability Guide

Advanced LCR (Least Cost Router) With SIP Proxy Server

High Availability with Elixir

Building Scalable Messaging Systems with Qpid. Lessons Learned from PayPal

Request Routing, Load-Balancing and Fault- Tolerance Solution - MediaDNS

CHAPTER 1 - JAVA EE OVERVIEW FOR ADMINISTRATORS

Building Heavy Load Messaging System

Windows Azure and private cloud

Exploring Oracle E-Business Suite Load Balancing Options. Venkat Perumal IT Convergence

Configuring Nex-Gen Web Load Balancer

OpenSER the open SIP Server. Bogdan-Andrei Iancu CEO Voice System Co-Founder OpenSER Project

Apache Tomcat Clustering

Building Scalable Big Data Infrastructure Using Open Source Software. Sam William

BASHO DATA PLATFORM SIMPLIFIES BIG DATA, IOT, AND HYBRID CLOUD APPS

High Performance Cluster Support for NLB on Window

Building a Highly Available and Scalable Web Farm

Ecomm Enterprise High Availability Solution. Ecomm Enterprise High Availability Solution (EEHAS) Page 1 of 7

Sentinet for Windows Azure SENTINET

IP Phone Presence Setup

VMware vrealize Automation

Providing Load Balancing and Fault Tolerance in the OSGi Service Platform

EBA Procurement Procedure for the Supply of Website Services 2016: Annex 1 System Architecture Document SYSTEM ARCHITECTURE DOCUMENT

Apache Tomcat. Tomcat Clustering: Part 2 Load balancing. Mark Thomas, 15 April Pivotal Software, Inc. All rights reserved.

Redundancy Doesn't Always Mean "HA" or "Cluster"

Server Traffic Management. Jeff Chase Duke University, Department of Computer Science CPS 212: Distributed Information Systems

Chapter 1 - Web Server Management and Cluster Topology

XAP 10 Global HTTP Session Sharing

BSC vision on Big Data and extreme scale computing

VMware vcloud Automation Center 6.1

MailMarshal SMTP in a Load Balanced Array of Servers Technical White Paper September 29, 2003

Load Balancing McAfee Web Gateway. Deployment Guide

Deploying Windows Streaming Media Servers NLB Cluster and metasan

WEBAPP PATTERN FOR APACHE TOMCAT - USER GUIDE

BlackBerry Enterprise Service 10. Version: Configuration Guide

FIVE SIGNS YOU NEED HTML5 WEBSOCKETS

Optimizing High-Performance Trading Solutions: An Engineering Perspective

White Paper. ThinRDP Load Balancing

Amazon Elastic Beanstalk

Red Hat Cluster Suite

Disaster Recovery Design Ehab Ashary University of Colorado at Colorado Springs

WHITE PAPER. Enhancing Application Delivery and Load Balancing on Amazon Web Services with Brocade Virtual Traffic Manager

Couchbase Server Technical Overview. Key concepts, system architecture and subsystem design

Sentinet for BizTalk Server SENTINET

Contents. Overview 1 SENTINET

VMware vrealize Automation

Load Balancing using Pramati Web Load Balancer

LinuxWorld Conference & Expo Server Farms and XML Web Services

MuL SDN Controller HOWTO for pre-packaged VM

Developing Windows Azure and Web Services

Deploying complex applications to Google Cloud. Olia Kerzhner

Data Management in the Cloud

JoramMQ, a distributed MQTT broker for the Internet of Things

Responsive, resilient, elastic and message driven system

Availability Digest. Redundant Load Balancing for High Availability July 2013

Application Note. Active Directory Federation Services deployment guide

Load Balancing Web Proxies Load Balancing Web Filters Load Balancing Web Gateways. Deployment Guide

DB2 Connect for NT and the Microsoft Windows NT Load Balancing Service

Code:1Z Titre: Oracle WebLogic. Version: Demo. Server 12c Essentials.

ViSION Status Update. Dan Savu Stefan Stancu. D. Savu - CERN openlab

PLUMgrid Toolbox: Tools to Install, Operate and Monitor Your Virtual Network Infrastructure

Technical White Paper: Clustering QlikView Servers

Disaster Recovery White Paper

Load balancing MySQL with HaProxy. Peter Boros Percona 4/23/13 Santa Clara, CA

Monitoring Infrastructure (MIS) Software Architecture Document. Version 1.1

KillTest. 半 年 免 费 更 新 服 务

Radware AppDirector and Juniper Networks Secure Access SSL VPN Solution Implementation Guide

JBoss & Infinispan open source data grids for the cloud era

High-Availability, Fault Tolerance, and Resource Oriented Computing

Transcription:

Above the Clouds: Introducing Akka Jonas Bonér CTO Typesafe Email: jonas@typesafe.com Twitter: @jboner

The problem It is way too hard to build: 1. correct highly concurrent systems 2. truly scalable systems 3. fault-tolerant systems that self-heals...using state-of-the-art tools

Introducing akka

Vision Simpler Concurrency Scalability Fault-tolerance

Vision...with a single unified Programming model Runtime service Open Source platform

Manage system overload

Scale up & Scale out

Replicate and distribute for fault-tolerance

Transparent load balancing

ARCHITECTURE CORE SERVICES

ARCHITECTURE ADD-ON MODULES

ARCHITECTURE CLOUDY AKKA

WHERE IS AKKA USED? SOME EXAMPLES: FINANCE Stock trend Analysis & Simulation Event-driven messaging systems BETTING & GAMING Massive multiplayer online gaming High throughput and transactional betting TELECOM Streaming media network gateways SIMULATION 3D simulation engines E-COMMERCE Social media community sites

What is an Actor?

Actor Behavior State

Event-driven Thread Actor Behavior State

Event-driven Thread Actor Behavior State

Event-driven Thread Actor Behavior State

Event-driven Thread Actor Behavior State

Event-driven Thread Actor Behavior State

Actor Behavior State

Event-driven Thread Actor Behavior State

Akka Actors one tool in the toolbox

Actors case object Tick class Counter extends Actor { var counter = 0 } def receive = { case Tick => counter += 1 println(counter) }

Create Actors val counter = actorof[counter] counter is an ActorRef

Start actors val counter = actorof[counter].start

Stop actors val counter = actorof[counter].start counter.stop

Send:! counter! Tick fire-forget

Send:? // returns a future val future = actor? Message future oncomplete { f => f.value } returns the Future directly

Future val future1, future2, future3 = Future.empty[String] future1.await future2 oncomplete { f =>... } future3 onresult {... } onexception {... } ontimeout {... } future1 foreach {... } future1 map {... } future1 flatmap {... } future1 filter {... }

Future val f0 = Future {... } Future.firstCompletedOf(futures) Future.reduce(futures)((x, y) =>..) Future.fold(zero)(futures)((x, y) =>...) Future.find {... } Future.sequence {... } Future.traverse {... }

Promise promise1.completewithresult(...) promise2.completewithexception(...) promise3.completewith(promise2) Promise is he write side of the Future Future is the read side

Reply class SomeActor extends Actor { def receive = { case User(name) => // use reply self.reply( Hi + name) } }

HotSwap become { // new body case NewMessage =>... }

HotSwap unbecome()

Set dispatcher class MyActor extends Actor { self.dispatcher = Dispatchers.newPinnedDispatcher(self) }...

Remote Actors

Remote Server // use host & port in config Actor.remote.start() Actor.remote.start("localhost", 2552) Scalable implementation based on NIO (Netty) & Protobuf

Register and manage actor on server client gets dumb proxy handle import Actor._ remote.register( service:id, actorof[myservice]) server part

val service = remote.actorfor( service:id, darkstar, 9999) service! message client part

Remoting in Akka 1.2 Problem Deployment (local vs remote) is a dev decision We get a fixed and hard-coded topology Can t change it dynamically and adaptively Needs to be a deployment & runtime decision

Clustered Actors (in development for upcoming Akka 2.x)

Address val actor = actorof[myactor]( my-service ) Bind the actor to a virtual address

Deployment Actor address is virtual and decoupled from how it is deployed If no deployment configuration exists then actor is deployed as local The same system can be configured as distributed without code change (even change at runtime) Write as local but deploy as distributed in the cloud without code change Allows runtime to dynamically and adaptively change topology

Deployment configuration akka { actor { deployment { my-service { router = "least-cpu" failure-detector = "accrual" clustered { nr-of-instances = 3 } } } } } replication { storage = "transaction-log" strategy = "write-through" }

The runtime provides Subscription-based cluster membership service Highly available cluster registry for actors Automatic cluster-wide deployment Highly available centralized configuration service Automatic replication with automatic fail-over upon node crash Transparent and user-configurable load-balancing Transparent adaptive cluster rebalancing Leader election Durable mailboxes - guaranteed delivery

Akka Node

Akka Node val ping = actorof[ping]( ping ) val pong = actorof[pong]( pong ) ping! Ball(pong)

Akka Node val ping = actorof[ping]( ping ) val pong = actorof[pong]( pong ) ping! Ball(pong) Ping Pong

Akka Node Akka Cluster Node Ping Pong

Akka Cluster Node Akka Node Akka Cluster Node Akka Cluster Node Ping Pong Akka Cluster Node Akka Cluster Node

Akka Cluster Node Akka Cluster Node Akka Cluster Node Ping Pong Akka Cluster Node Akka Cluster Node

Akka Cluster Node Akka Cluster Node Ping akka { actor { deployment { ping {} pong { router = "round-robin" clustered { nr-of-instances = 3 } } } Pong } } Akka Cluster Node Akka Cluster Node Akka Cluster Node

Akka Cluster Node Akka Ping Cluster Node akka { actor { deployment { ping {} pong { router = "round-robin" clustered { nr-of-instances = 3 } } } Pong } } Akka Cluster Node Akka Cluster Node Akka Cluster Node

Akka Pong Cluster Node Akka Ping Cluster Node akka { actor { deployment { ping {} pong { router = "round-robin" clustered { nr-of-instances = 3 } } } } } Akka Pong Cluster Node Akka Pong Cluster Node Akka Cluster Node

Let it crash fault-tolerance

The Erlang model

9 nines

...let s take a standard OO application

Which components have critically important state and explicit error handling?

Classification of State Scratch data Static data Supplied at boot time Supplied by other components Dynamic data Data possible to recompute Input from other sources; data that is impossible to recompute

Classification of State Scratch data Static data Supplied at boot time Supplied by other components Dynamic data Data possible to recompute Input from other sources; data that is impossible to recompute

Classification of State Scratch data Static datamust be Supplied at boot time protected Supplied by other components Dynamic by datany means Data possible to recompute Input from other sources; data that is impossible to recompute

Fault-tolerant onion-layered Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Error Kernel

Node 1 Node 2

Linking link(actor) unlink(actor) startlink(actor) spawnlink[myactor]

Fault handlers AllForOneStrategy( errors, maxnrofretries, withintimerange) OneForOneStrategy( errors, maxnrofretries, withintimerange)

Supervision class Supervisor extends Actor { faulthandler = AllForOneStrategy( List(classOf[IllegalStateException]) 5, 5000)) } def receive = { } case Register(actor) => link(actor)

Manage failure class FaultTolerantService extends Actor {... override def prerestart(reason: Throwable) = {... // clean up before restart } override def postrestart(reason: Throwable) = {... // init after restart } }

...and much much more HTTP STM Camel FSM Java API ZeroMQ Microkernel Dataflow NIO AMQP scalaz Spring Security

Get it and learn more http://akka.io http://typesafe.com

EOF