SlideShare una empresa de Scribd logo
1 de 192
Descargar para leer sin conexión
Konrad `ktoso` Malawski @ Scala Days CPH 2017
State of Akka @ 2017
The best is yet to come
Konrad `ktoso` Malawski @ Scala Days CPH 2017
Disclaimer:
Parts of this talk is about
under-development “experimental” APIs
which may change slightly.
This is not a strict roadmap,
it is a general outline where we’re headed.
Konrad `ktoso` Malawski
Akka Team,
Reactive Streams TCK,
Scala SLIP Committee member
Konrad `@ktosopl` Malawski
work: akka.io lightbend.com
personal blog: http://kto.so
communities: geecon.org Java.pl / KrakowScala.pl sckrk.com GDGKrakow.pl lambdakrk.pl
The underlying motto of all our development
“Can we do better than that?”
The underlying motto of all our development
“Can we do better than that?”
and sometimes…
“Been there, done that.”
A Journey
From Past,
through Current,
to the Future…!
https://www.lightbend.com/akka-five-year-anniversary
Past
starting 2009
https://www.lightbend.com/akka-five-year-anniversary
”The actor model in computer science is a
mathematical model of concurrent
computation that treats actors as the universal
primitives of concurrent computation. ”
Wikipedia
The Actor Model
and acts on them by:
• Sending messages
• Changing its state / behaviour
• Creating more actors
receives messages
An Actor
A concurrency and distribution construct.
an addressable, location-transparent, entity.
An Actor
Actors talk directly to each other.
An ActorSystem is truly peer-to-peer, not client-server.
An Actor
(current 2.x API, not the ancient one :-))
An Actor
Java API “feels native”, Java8 Lambdas, no Scala “leaking”
A simple Actor interaction
Could be different threads
or different nodes in cluster.
API remains the same - and always async.
Why does it matter?
Could be different threads
or different nodes in cluster.
API remains the same - and always async.
http://www.anandtech.com/show/11464/intel-announces-skylakex-bringing-18core-hcc-silicon-to-consumers-for-1999
Actors are never “exposed”, ActorRefs are.
Get “introduced”, interact directly.
Binary > Textual Protocols
“The Internet is running in debug mode.”
— Rüdiger Möller
http://java-is-the-new-c.blogspot.de/2014/10/why-protocols-are-messy-concept.html
MediaContent {
media = Media {
uri = “http://conference.com/key.mpg"
title = "Keynote"
width = 640
height = 480
format = "video/mpg4"
duration = 18000000
size = 58982400
bitrate = 262144
persons = ["Bill Gates", "Steve Jobs"]
player = JAVA
copyright = null
}
}
images = [
Image {
uri = “http://conference.com/key_large.jpg"
title = "Keynote"
width = 1024
height = 768
size = LARGE
}
Image {
uri = “http://conference.com/key_small.jpg"
title = "Keynote"
width = 320
height = 240
size = SMALL
}
]
Not only JSON: Example data
create ser deser total size
protostuff 68 433 634 1067ns 239bytes
protobuf 121 1173 719 1891 239
kryo-serializer 53 1480 1331 2810 286
thrift 95 1455 731 2186 349
. . .
json/jackson/manual 52 1039 1228 2267 468
json/jackson/databind 54 1164 1866 3030 485
json/gson/databind 56 4667 4403 9070 486
xml/xstream+c-aalto 54 3310 6732 10042 525
xml/JAXB 54 4354 141333 145686 719
java-built-in 53 5046 23279 28325 889
Why Binary?
Slide only to illustrate order-of-magniture differences. Don’t over-focus on numbers.
All details here: https://github.com/eishay/jvm-serializers/wiki
create ser deser total size
protostuff 68 433 634 1067ns 239bytes
protobuf 121 1173 719 1891 239
kryo-serializer 53 1480 1331 2810 286
thrift 95 1455 731 2186 349
. . .
json/jackson/manual 52 1039 1228 2267 468
json/jackson/databind 54 1164 1866 3030 485
json/gson/databind 56 4667 4403 9070 486
xml/xstream+c-aalto 54 3310 6732 10042 525
xml/JAXB 54 4354 141333 145686 719
java-built-in 53 5046 23279 28325 889
Why Binary?
Slide only to illustrate order-of-magniture differences. Don’t over-focus on numbers.
All details here: https://github.com/eishay/jvm-serializers/wiki
create ser deser total size
protostuff 68 433 634 1067ns 239bytes
protobuf 121 1173 719 1891 239
kryo-serializer 53 1480 1331 2810 286
thrift 95 1455 731 2186 349
. . .
json/jackson/manual 52 1039 1228 2267 468
json/jackson/databind 54 1164 1866 3030 485
json/gson/databind 56 4667 4403 9070 486
xml/xstream+c-aalto 54 3310 6732 10042 525
xml/JAXB 54 4354 141333 145686 719
java-built-in 53 5046 23279 28325 889
Why Binary?
Slide only to illustrate order-of-magniture differences. Don’t over-focus on numbers.
All details here: https://github.com/eishay/jvm-serializers/wiki
Avoid Java Serialization
----sr--model.Order----h#-----J--idL--customert--Lmodel/Customer;L--descriptiont--Ljava/lang/String;L--
orderLinest--Ljava/util/List;L--totalCostt--Ljava/math/BigDecimal;xp--------ppsr--java.util.ArrayListx-----
a----I--sizexp----w-----sr--model.OrderLine--&-1-S----I--lineNumberL--costq-~--L--descriptionq-~--L--ordert--
Lmodel/Order;xp----sr--java.math.BigDecimalT--W--(O---I--scaleL--intValt--Ljava/math/BigInteger;xr--
java.lang.Number-----------xp----sr--java.math.BigInteger-----;-----I--bitCountI--bitLengthI--
firstNonzeroByteNumI--lowestSetBitI--signum[--magnitudet--[Bxq-~----------------------ur--[B------T----xp----
xxpq-~--xq-~--
Java Serialization
final case class Order(id: Long, description: String, totalCost: BigDecimal,
orderLines: ArrayList[OrderLines], customer: Customer)
<order id="0" totalCost="0"><orderLines lineNumber="1" cost="0"><order>0</order></orderLines></order>XML…!
{"order":{"id":0,"totalCost":0,"orderLines":[{"lineNumber":1,"cost":0,"order":0}]}}JSON…!
------java-util-ArrayLis-----model-OrderLin----java-math-BigDecima---------model-Orde-----Kryo…!
Excellent post by James Sutherland @
http://java-persistence-performance.blogspot.com/2013/08/optimizing-java-serialization-java-vs.html
Avoid Java Serialization
Akka uses ProtocolBuffers
for (most*) it’s messages by default.
To completely disable Java Serialization do:
akka.actor.allow-java-serialization = false
(which switches Akka to protobuf completely)
User messages you define your own serializers.
most* – due to wire compatibility some messages, where
some messages did use JavSer in the past
Avoid Java Serialization
Good serializers include (but are not limited to):
Kryo, Google Protocol Buffers, SBE,Thrift, JSON if you really want
// dependencies
"com.github.romix.akka" %% "akka-kryo-serialization" % "0.4.0"
// application.conf
extensions = [“com.romix.akka.serialization.kryo.KryoSerializationExtension$"]


serializers { 

java = "akka.serialization.JavaSerializer"
kryo = "com.romix.akka.serialization.kryo.KryoSerializer" 

}
akka.actor.serialization-bindings {
“com.mycompany.Example”: kryo
. . .
}
[info] ForkJoinActorBenchmark.pingPong java avgt 10 25.464 ± 1.175 us/op
[info] ForkJoinActorBenchmark.pingPong kryo avgt 10 4.348 ± 4.346 us/op
[info] ForkJoinActorBenchmark.pingPong off avgt 10 0.967 ± 0.657 us/op
Sidenote:
Akka + Binary Compatibility?
Our binary compatibility story
http://doc.akka.io/docs/akka/current/scala/common/binary-compatibility-rules.html
Our binary compatibility story
http://doc.akka.io/docs/akka/current/scala/common/binary-compatibility-rules.html
2.3.1x [2015-09] ->
2.4.x [2015-08] ->
2.5.x [2017-04] -> ...
2.7.x [???] ->
2.8.x [???] ->
3.x [far out still, no need to break APIs]
Our binary compatibility story
http://doc.akka.io/docs/akka/current/scala/common/binary-compatibility-rules.html
Binary compatibility != Wire compatibility
/* but we’ll get to that! (hint: Artery) */
History of Futures
In Days before Futures got standardised in Scala (~2012).
Their design was heavily influenced by: Akka, Finagle & Scalaz & more…
Archival version @ 2012
http://doc.akka.io/docs/akka/2.0/scala/futures.html
SIP-14 - Futures and Promises
By: Philipp Haller, Aleksandar Prokopec, Heather Miller, Viktor Klang, Roland Kuhn, and Vojin Jovanovic

http://docs.scala-lang.org/sips/completed/futures-promises.html
“Best practices are solutions
to yesterdays problems.”
https://twitter.com/FrankBuytendijk/status/795555578592555008
Circuit breaking as substitute of flow-control
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
HTTP/1.1 503 Service Unavailable
HTTP/1.1 503 Service Unavailable
Throttling as represented by 503 responses. Client will back-off… but how?
What if most of the fleet is throttling?
http://doc.akka.io/docs/akka/2.4/common/circuitbreaker.html
HTTP/1.1 503 Service Unavailable
HTTP/1.1 503 Service Unavailable
http://doc.akka.io/docs/akka/2.4/common/circuitbreaker.html
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
“slamming the breaks”
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
“slamming the breaks”
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
“slamming the breaks”
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
“slamming the breaks”
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
“slamming the breaks”
See also, Nitesh Kant, Netflix @ Reactive Summit
https://www.youtube.com/watch?v=5FE6xnH5Lak
We’ll re-visit this specific case in a bit :-)
“slamming the breaks”
Are absolutely useful!
Still… “Can do better than that?”
Circuit Breakers
This will lead to the creation
of Akka Streams and Reactive Streams!
We can do better.
The heart of Distributed Systems,
built using Akka.
Akka Cluster
Akka cluster provides membership
and fault-tolerance for distributed Actors.
- Membership is implemented as epidemic gossip.
- No single point of failure, “Leader” can move to 

any of the nodes (deterministically)
- Battle hardened since many years
- Known to scale to 2400 nodes.
Akka Cluster
https://cloudplatform.googleblog.com/2014/01/large-akka-cluster-on-google-compute.html
Cluster Sharding
Cluster Sharding
Failure detection using simple heartbeats
often not good enough for production. You can:
- Use Akka Split Brain Resolver (commercial), 

multiple split brain scenario resolution strategies
- “Keep majority”, “Keep oldest”, “Static Quorum”
- Perform manual downing 

(a safe bet, good if OPS or automated via Nagios etc)
- Roll your own, all required APIs are public
Failure detection is pluggable
https://cloudplatform.googleblog.com/2014/01/large-akka-cluster-on-google-compute.html
bit.ly/why-reactive
How to think about these techniques?
Back then known as “Spray”,
we joined up and started working
on a streaming-first HTTP server.
Akka HTTP
- Fully Typed HTTP model
- So good, other projects use it instead of rolling their own!
(http4s uses Spray’s model.)

- Streaming-focused HTTP server
- Built from the ground up on Akka Streams
- Full Java API (unlike Spray)
- Streaming with WebSockets!
Key features of Akka HTTP
Streaming in Akka HTTP
http://doc.akka.io/docs/akka/2.4/scala/stream/stream-customize.html#graphstage-scala
“Framed entity streaming”
http://doc.akka.io/docs/akka/2.4/java/http/routing-dsl/source-streaming-support.html
HttpServer as a:
Flow[HttpRequest, HttpResponse]
Streaming in Akka HTTP
HttpServer as a:
Flow[HttpRequest, HttpResponse]
HTTP Entity as a:
Source[ByteString, _]
http://doc.akka.io/docs/akka/2.4/scala/stream/stream-customize.html#graphstage-scala
“Framed entity streaming”
http://doc.akka.io/docs/akka/2.4/java/http/routing-dsl/source-streaming-support.html
Streaming in Akka HTTP
HttpServer as a:
Flow[HttpRequest, HttpResponse]
HTTP Entity as a:
Source[ByteString, _]
Websocket connection as a:
Flow[ws.Message, ws.Message]
http://doc.akka.io/docs/akka/2.4/scala/stream/stream-customize.html#graphstage-scala
“Framed entity streaming”
http://doc.akka.io/docs/akka/2.4/java/http/routing-dsl/source-streaming-support.html
High level Routing API:
Key features of Akka HTTP
Low-level API (e.g. what Play uses):
Key features of Akka HTTP
Akka Persistence
EventSourcing your Actors
Event sourcing your Actors
Receive commands.
Store events.
Optional: Create queries / views
Event sourcing your Actors
Event sourcing your Actors
Event sourcing your Actors
Present & near Future
2016~2017+
Distributed Data
Conflict-Free Data-Types
CAP theorem reminder
Akka Persistence Akka DData
CAP theorem reminder
Akka DDataAkka Persistence
Using Distributed Data
The focus is on “spreading the data”,
not on the “single entity” like it is in Persistence.
Distributed Data visualised
You supply a write consistency level which has the following meaning:
	•	WriteLocal the value will immediately only be written to the local replica, and
later disseminated with gossip
	•	WriteTo(n) the value will immediately be written to at least n replicas, including
the local replica
	•	WriteMajority the value will immediately be written to a majority of replicas, i.e.
at least N/2 + 1 replicas, where N is the number of nodes in the cluster (or cluster
role group)
	•	WriteAll the value will immediately be written to all nodes in the cluster (or all
nodes in the cluster role group)
CRDTs spread using Gossip
CRDTs spread using Gossip
CRDTs spread using Gossip
CRDTs spread using Gossip
Summary of CRDTs
• Counters: GCounter, PNCounter
• Sets: GSet, ORSet
• Maps: ORMap, ORMultiMap, LWWMap, PNCounterMap
• Registers: LWWRegister, Flag
“Stream”
Suddenly everyone jumped on the word “Stream”.
Akka Streams / Reactive Streams started end-of-2013.
“Streams”
* when put in “” the word does not appear in project name, but is present in examples / style of APIs / wording.
Suddenly everyone jumped on the word “Stream”.
Akka Streams / Reactive Streams started end-of-2013.
The word “Stream” is used in many contexts/meanings
Akka Streams
Reactive Streams
RxJava “streams”*
Spark Streaming
Apache Storm “streams”*
Java Steams (JDK8)
Reactor “streams”*
Kafka Streams
ztellman / Manifold (Clojure)
* when put in “” the word does not appear in project name, but is present in examples / style of APIs / wording.
Apache GearPump “streams”
Apache [I] Streams (!)
Apache [I] Beam “streams”
Apache [I] Quarks “streams”
Apache [I] Airflow “streams” (dead?)
Apache [I] Samza
Scala Stream
Scalaz Streams, now known as FS2
Swave.io
Java InputStream / OutputStream / … :-)
2017年: 安定版。リアクティブストリーム付きの JDK9。
“Stream”
What does it mean?!
• Possibly infinite datasets (“streams”)
• “Streams are NOT collections.”
• Processed element-by-element
• Element could mean “byte”
• More usefully though it means a specific type “T”
• Asynchronous processing
• Asynchronous boundaries (between threads)
• Network boundaries (between machines)
2017年: 安定版。リアクティブストリーム付きの JDK9。
Where does Akka Stream fit?
Akka Streams specifically fits,
if you answer yes to any of these:
• Should it take on public traffic?
• Processing in hot path for requests?
• Integrate various technologies?
• Protect services from over-load?
• Introspection, debugging, excellent Akka integration?
• (vs. other reactive-stream impls.)
How do I pick which “streaming” I need?
Kafka serves best as a transport
for pub-sub across services.
• Note that Kafka Streams (db ops are on the node
is rather, different than the Reactive Kafka client
• Great for cross-service communication 

instead of HTTP Request / Reply
Kafka はサービス間の pub-sub 通信に向いている

HTTP の代わりにサービス間の通信に使う
How do I pick which “streaming” I need?
Spark has vast libraries for ML or join etc ops.
• It’s the “hadoop replacement”.
• Spark Streaming is windowed-batches
• Latency anywhere up from 0.5~1second
• Great for cross-service communication 

instead of HTTP Req/Reply
Spark は機械学習系が充実している
Oh yeah, there’s JDK8 “Stream” too!
Terrible naming decision IMHO, since Java’s .stream()
• Geared for collections
• Best for finite and known-up-front data
• Lazy, sync/async (async rarely used)
• Very (!) hard to extend
It’s the opposite what we talk about in Streaming
systems!
It’s more:“bulk collection operations”
Also known as… Scala collections API (i.e. Iterator
JDK8 の Stream はイテレータ的なもの
What about JDK9 “Flow”?
JDK9 introduces java.util.concurrent.Flow
• Is a 1:1 copy of the Reactive Streams interfaces
• On purpose, for people to be able to impl. it
• Does not provide useful implementations
• Is only the inter-op interfaces
• Libraries like Akka Streams implement RS,

and expose useful APIs for you to use.
JDK9 の Flow はリアクティブ・ストリーム
A fundamental building block.
Not end-user API by itself.
reactive-streams.org
Reactive Streams
Reactive Streams
More of an SPI (Service Provider Interface),
than API.
reactive-streams.org
The specification.
Reactive Streams
Origins of
Reactive Streams - story: 2013’s impls
2014–2015:
Reactive Streams Spec & TCK
development, and implementations.
1.0 released on April 28th 2015,
with 5+ accompanying implementations.
2015
Included in JDK9 via JEP-266 “More Concurrency Updates”
download.java.net/java/jdk9/docs/api/java/util/concurrent/Flow.html
But what does it do!?
Reactive Streams
Fast Publisher[T] Slow Subscriber[T]
Push model
Subscriber usually has some kind of buffer.
Push model
What if the buffer overflows?
Push model
Kernel does this!
Routers do this!
(TCP)
Use bounded buffer,
drop messages + require re-sending
Push model
Reactive Streams explained
Reactive Streams
explained in 1 slide
Fast Publisher will send at-most 3
elements. This is pull-based-
backpressure.
Reactive Streams: “dynamic push/pull”
JEP-266 – soon…!
public final class Flow {
private Flow() {} // uninstantiable
@FunctionalInterface
public static interface Publisher<T> {
public void subscribe(Subscriber<? super T> subscriber);
}
public static interface Subscriber<T> {
public void onSubscribe(Subscription subscription);
public void onNext(T item);
public void onError(Throwable throwable);
public void onComplete();
}
public static interface Subscription {
public void request(long n);
public void cancel();
}
public static interface Processor<T,R> extends Subscriber<T>, Publisher<R> {
}
}
Reactive Streams: goals
1) Avoiding unbounded buffering across async boundaries
2) Inter-op interfaces between various libraries
Reactive Streams: goals
1) Avoiding unbounded buffering across async boundaries
2) Inter-op interfaces between various libraries
Argh, implementing a correct
RS Publisher or Subscriber is so hard!
1) Avoiding unbounded buffering across async boundaries
2) Inter-op interfaces between various libraries
Reactive Streams: goals
Argh, implementing a correct RS Publisher
or Subscriber is so hard!
Reactive Streams: goals
Argh, implementing a correct
RS Publisher or Subscriber is so hard!
You should be using
Akka Streams instead!
1) Avoiding unbounded buffering across async boundaries
2) Inter-op interfaces between various libraries
Akka Streams in 20 seconds:
val firstString: Future[String] =

Source.single(1)

.map(_.toString())

.runWith(Sink.head)

Source.single(1).map(i => i.toString).runWith(Sink.head())
// types: _
Source[Int, NotUsed]
Flow[Int, String, NotUsed]
Sink[String, Future[String]]
Akka Streams in 20 seconds:
// types: _
Source[Int, NotUsed]
Flow[Int, String, NotUsed]
Sink[String, Future[String]]
Source.single(1).map(i => i.toString).runWith(Sink.head())
Akka Streams in 20 seconds:
natively in Akka HTTP/2
HTTP/2
HTTP/2
1.9M May 15 08:02 bigimage.jpg
995K May 15 08:16 bigimage2.jpg
HTTPS - the usual waterfall
HTTPS - the usual waterfall
HTTPS - the usual waterfall
HTTP/2
HTTP/2
HTTP/2
HTTP(S)/1.1
HTTP/2
(before performance optimisations (sic))
Play + Akka HTTP => HTTP/2
+ TLS configuration
https://github.com/playframework/play-scala-tls-example/pull/30
http/2HTTP+ =
Akka HTTP as default backend for Play
Goal is not to “beat Netty*”
but to keep perf
while adding features.
Future:
- Shared Typed HTTP Model
- Shared Monitoring
- Shared performance work
TL;DR; == Shared efforts
* We <3 Netty.
http://playframework.github.io/prune/
Ofc: Netty backend remains available.
Sub-journey to Akka Typed
The journey to Akka Typed
The journey to Akka Typed
Ancient API, deprecated“Typed Actor” API
Goal was to expose what Java developers knew.
The journey to Akka Typed
Old “TypedActor” experimental in 2.3, removed
Upsides:
- Easily bridge to “non-Akka” / “non-Reactive” apps
- type-safe
- “easy” (not necessarily a good thing)
Downsides:
- Reflection, 10x slow-down compared to UntypedActor
- “RPC”-ish, not true to the core messaging
- Not true to Akka’s core principle: Messaging
The journey to Akka Typed
The journey to Akka Typed
“Typed Channels” experimental in 2.3, removed
The journey to Akka Typed
“Typed Channels” experimental in 2.3, removed
Upsides:
- completely type-safe
- very expressive
Downsides:
- Too complex, many new operators
- Had to rely on scala macros
- “sender” difficult to solve
The journey to Akka Typed
The journey to Akka Typed
http://axel22.github.io/resources/docs/reactors.pdf
The journey to Akka Typed
Akka Typed
try it now, 2.5.2
from repo.akka.io/snapshots
2 styles, 100% awesome.
Full Java & Scala API, as usual.
Actor.mutable – similar to current Actors, Behavior is a class
Actor.immutable – more functional style, recommended
Akka Typed
Main user-facing changes:
ActorRef[T] typed ActorRefs.
Core concept is Behavior[T]
which can be freely composed.
You always “become(Behavior)”, by returning Behavior.
sender() is gone,
not possible to type it well.
sender was trouble anyway, so that’s good!
Akka Typed
Untyped
=>
Actor.mutable
Akka Typed
Untyped
Akka Typed
Actor.immutable
Akka Typed
Actor.immutable (Scala)
Akka Typed
Actor.immutable (Scala)
Don’t worry, Java will eventually get pattern matching:
http://mail.openjdk.java.net/pipermail/amber-spec-experts/2017-April/000033.html
Java adopting Scala features confirms Scala’s design.
…but, until then we provide you with helpers and DSLs:
Akka Typed
Actor.immutable (Scala)
Actor.immutable (Java)
Akka Typed
try it now, 2.5.99-TYPED-M1
from repo.akka.io/snapshots
Learn more:
from the docs:
http://doc.akka.io/docs/akka/snapshot/scala/typed.html
and the blog:
1. Akka Typed: Hello World in the new API
2. Akka Typed: Coexistence
3. Akka Typed: Mutable vs. Immutable
4. Akka Typed: Protocols
5. Akka Typed: Supervision
6. Akka Typed: Lifecycle and Watch
7. Akka Typed: Timers
A community for Streams connectors
Alpakka – a community for Stream connectors
Alp
Alpakka – a community for Stream connectors
http://developer.lightbend.com/docs/alpakka/current/
Alpakka – a community for Stream connectors
http://developer.lightbend.com/docs/alpakka/current/
Alpakka – a community for Stream connectors
http://developer.lightbend.com/docs/alpakka/current/
Akka Streams in 20 seconds:
Akka Streams in 20 seconds:
Akka Streams core principles:
Akka Streams core principles:
Ecosystem that solves problems
> (is greater than)
solving all the problems ourselves
Way more than just “we changed the transport.”
New Remoting:
Artery
Artery
Next generation remoting layer for Akka.
• Aeron (UDP) based instead of TCP,
• Advanced automatic ActorRef Compression
• Dedicated “lanes” for certain messages / destinations
• Almost alloc-free in steady-state (except deserialization)
Remoting feature matrix
Remoting “classic” Artery Remoting
Protocol
TCP
TLS+TCP
UDP
(Aeron)
Large messages Troublesome Dedicated lanes
Heartbeat and
System Messages
Prioritised Dedicated lanes
Benchmarked*
throughput
70k msg/s
700k+ msg/s
(up to 1m msg/s)
* benchmark setup: 5-to-5 actors, 100byte payload message
(excluding envelope size),Amazon EC2 M4-X2Large instances
How to use Artery?
single option,
no new artifacts
“Steady state” operation almost alloc-free
Serialize Deserialize
compression compression
package readpackage write
AkkaStreams
(allocationfree)
Pooled envelopes
Pooled ByteBuffers
Deserialize allocates
Pooled ByteBuffers
no allocations
Caches for ActorRefs etc
no allocations in steady state
Artery: ActorRef Compression
Compression triggered for “heavy hitters”,
so “most chatty” Actors to maximise benefit.
Triggers automatically & transparently.
Artery: ActorRef / Manifest Compression
Artery: ActorRef / Manifest Compression
In this case ActorRef compression reduced the size of a small
envelope size by 74% - from 162 to 42 bytes (sic!).
Multi Data Center
Customers increasingly have global-scale apps,
so we’re looking into advanced Multi-DataCenter scenarios.
Multi Data Center
These are just ideas.
Talk to me, we’re gathering use cases.
- Active + Active ???
- Locality aware Cluster Sharding ???
- Entity “owner” Datacenter ???
- Talk to us about your use cases :)
- …?
Wait, there’s more!
(things I couldn’t fit on the map)
New docs engine
New QuickStart, ScalaFiddle…
Lightbend Paradox - docs engine
We know, we know:“Yet another docs engine”
Built-in scala-fiddle support
Akka.js => run Akka docs examples in browser
Lightbend Paradox - docs engine
Much much easier to contribute now.
Zero dependencies just type “paradox”
Markdown instead of restructured text!
Built in capabilities to link github / scaladoc
Simple way to build multi-prog-lang docs @scala/@java
Lightbend “kickstart”
Replacing Activator
developer.lightbend.com
Tracing & Monitoring
distributed systems
Monitoring Akka
developer.lightbend.com/docs/monitoring/latest/home.html
+
DataDog || StatsD || Graphite || …anything!
Monitoring Akka
e.g.
DataDog || StatsD || Graphite || …anything!
Monitoring Akka
Remember where Artery Compression kicks in?
(“Top senders” / “Top receivers”)
Tracing Akka with Jaeger or Zipkin
Uber Jaeger
Twitter Zipkin
Tracing Akka with Jaeger or Zipkin
Lightbend Monitoring
https://developer.lightbend.com/docs/cinnamon/latest/extensions/opentracing.html
Tracing across nodes
Lightbend Monitoring
https://developer.lightbend.com/docs/cinnamon/latest/extensions/opentracing.html
Already tracing across network transparently,
Akka HTTP coming soon, as will Futures.
Monitoring Akka
“What is failing in the system?”
Lightbend OpsClarity
External initiatives
IntelliJ support for Akka!
Ports to other platforms
Not supported by Lightbend, community projects.
http://getakka.net/ http://akka-js.org/
A sign that Akka is interesting and worth porting:
Open Source projects using Akka
index.scala-lang.org
Summing up…
Summing up
With all the foundational building blocks prepared…
“The best is yet to come.”
Happy hAkking!
Thanks everyone
Thanks everyone
Committers from the Community!
Jan Pustelnik
Krzysiek Ciesielski,
Alexey Romanchuk,
Heiko Seeberger,
Josep Prat,
Jan Ypma,
André Rüdiger,
Jonas Fonseca
…
and hundreds of contributors
Thanks!
We <3 contributions
•Easy to contribute:
• https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3Aeasy-to-contribute
• https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3A%22nice-to-have+%28low-prio%29%22
•Akka: akka.io && github.com/akka
•Reactive Streams: reactive-streams.org
•Reactive Socket: reactivesocket.io
• Mailing list:
• https://groups.google.com/group/akka-user
•Public chat rooms:
•http://gitter.im/akka/dev developing Akka
• http://gitter.im/akka/akka using Akka
Free e-book and printed report.
bit.ly/why-reactive
Covers what reactive actually is.
Implementing in existing architectures.
Thoughts from the team that’s building
reactive apps since more than 6 years.
Obligatory “read my book!” slide :-)
Metal Gear Solid illustrations
by Lap Pun Cheung
http://www.lpcheung.com/metal-gear-solid/
Hand drawn illustrations:
by myself, CC-BY-NC
Artwork links
Thanks!
Questions?
ktoso @ lightbend.com
twitter: ktosopl
github: ktoso
team blog: blog.akka.io
home: akka.io
myself: kto.so

Más contenido relacionado

La actualidad más candente

Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldAkka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldKonrad Malawski
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Konrad Malawski
 
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in't
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in'tScalaSwarm 2017 Keynote: Tough this be madness yet theres method in't
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in'tKonrad Malawski
 
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...Konrad Malawski
 
How Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM EcosystemHow Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM EcosystemKonrad Malawski
 
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)Konrad Malawski
 
End to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to SocketEnd to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to SocketKonrad Malawski
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaKonrad Malawski
 
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsFresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsKonrad Malawski
 
2014 akka-streams-tokyo-japanese
2014 akka-streams-tokyo-japanese2014 akka-streams-tokyo-japanese
2014 akka-streams-tokyo-japaneseKonrad Malawski
 
Building reactive distributed systems with Akka
Building reactive distributed systems with Akka Building reactive distributed systems with Akka
Building reactive distributed systems with Akka Johan Andrén
 
Reactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka StreamsReactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka StreamsKonrad Malawski
 
Reactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysReactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysManuel Bernhardt
 
System Integration with Akka and Apache Camel
System Integration with Akka and Apache CamelSystem Integration with Akka and Apache Camel
System Integration with Akka and Apache Camelkrasserm
 
Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Jonas Bonér
 
Asynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsAsynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsJohan Andrén
 
Reactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive WayReactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive WayRoland Kuhn
 
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesUnderstanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesLightbend
 

La actualidad más candente (20)

Akka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming WorldAkka-chan's Survival Guide for the Streaming World
Akka-chan's Survival Guide for the Streaming World
 
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018Networks and Types - the Future of Akka @ ScalaDays NYC 2018
Networks and Types - the Future of Akka @ ScalaDays NYC 2018
 
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in't
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in'tScalaSwarm 2017 Keynote: Tough this be madness yet theres method in't
ScalaSwarm 2017 Keynote: Tough this be madness yet theres method in't
 
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
[Japanese] How Reactive Streams and Akka Streams change the JVM Ecosystem @ R...
 
How Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM EcosystemHow Reactive Streams & Akka Streams change the JVM Ecosystem
How Reactive Streams & Akka Streams change the JVM Ecosystem
 
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
[Tokyo Scala User Group] Akka Streams & Reactive Streams (0.7)
 
End to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to SocketEnd to End Akka Streams / Reactive Streams - from Business to Socket
End to End Akka Streams / Reactive Streams - from Business to Socket
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
 
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka StreamsFresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
Fresh from the Oven (04.2015): Experimental Akka Typed and Akka Streams
 
2014 akka-streams-tokyo-japanese
2014 akka-streams-tokyo-japanese2014 akka-streams-tokyo-japanese
2014 akka-streams-tokyo-japanese
 
Building reactive distributed systems with Akka
Building reactive distributed systems with Akka Building reactive distributed systems with Akka
Building reactive distributed systems with Akka
 
Reactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka StreamsReactive Stream Processing with Akka Streams
Reactive Stream Processing with Akka Streams
 
Reactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDaysReactive Web-Applications @ LambdaDays
Reactive Web-Applications @ LambdaDays
 
System Integration with Akka and Apache Camel
System Integration with Akka and Apache CamelSystem Integration with Akka and Apache Camel
System Integration with Akka and Apache Camel
 
Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)Building Reactive Systems with Akka (in Java 8 or Scala)
Building Reactive Systems with Akka (in Java 8 or Scala)
 
Asynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsAsynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka Streams
 
Reactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive WayReactive Streams: Handling Data-Flow the Reactive Way
Reactive Streams: Handling Data-Flow the Reactive Way
 
Introducing Akka
Introducing AkkaIntroducing Akka
Introducing Akka
 
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous ArchitecturesUnderstanding Akka Streams, Back Pressure, and Asynchronous Architectures
Understanding Akka Streams, Back Pressure, and Asynchronous Architectures
 
Actor Model Akka Framework
Actor Model Akka FrameworkActor Model Akka Framework
Actor Model Akka Framework
 

Similar a State of Akka 2017 - The best is yet to come

It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考えるIt is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考えるSadaaki HIRAI
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Claus Ibsen
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - CopenhagenClaus Ibsen
 
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONMicroservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONAdrian Cockcroft
 
apachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdfapachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdfssuserbb9f511
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...Aman Kohli
 
The Server Side of Responsive Web Design
The Server Side of Responsive Web DesignThe Server Side of Responsive Web Design
The Server Side of Responsive Web DesignDave Olsen
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Edward Burns
 
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integrationSouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integrationClaus Ibsen
 
2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language ViewerStian Soiland-Reyes
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Sadaaki HIRAI
 
Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020Timothy Spann
 
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31Timothy Spann
 
Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.John Dalziel
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Codemotion
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesHiroshi SHIBATA
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
Why Sun for Drupal?
Why Sun for Drupal?Why Sun for Drupal?
Why Sun for Drupal?smattoon
 

Similar a State of Akka 2017 - The best is yet to come (20)

It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考えるIt is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
 
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen v2
 
Apache Camel K - Copenhagen
Apache Camel K - CopenhagenApache Camel K - Copenhagen
Apache Camel K - Copenhagen
 
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONMicroservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
 
apachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdfapachecamelk-april2019-190409093034.pdf
apachecamelk-april2019-190409093034.pdf
 
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
DSLing your System For Scalability Testing Using Gatling - Dublin Scala User ...
 
The Server Side of Responsive Web Design
The Server Side of Responsive Web DesignThe Server Side of Responsive Web Design
The Server Side of Responsive Web Design
 
CQ5 and Sling overview
CQ5 and Sling overviewCQ5 and Sling overview
CQ5 and Sling overview
 
Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.Ed presents JSF 2.2 and WebSocket to Gameduell.
Ed presents JSF 2.2 and WebSocket to Gameduell.
 
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integrationSouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
 
2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer
 
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
Familiar HTML5 - 事例とサンプルコードから学ぶ 身近で普通に使わているHTML5
 
Origins of Serverless
Origins of ServerlessOrigins of Serverless
Origins of Serverless
 
Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020Learning the basics of Apache NiFi for iot OSS Europe 2020
Learning the basics of Apache NiFi for iot OSS Europe 2020
 
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
Apache Deep Learning 101 - ApacheCon Montreal 2018 v0.31
 
Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.Fast Slim Correct: The History and Evolution of JavaScript.
Fast Slim Correct: The History and Evolution of JavaScript.
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 
Advanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutesAdvanced technic for OS upgrading in 3 minutes
Advanced technic for OS upgrading in 3 minutes
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Why Sun for Drupal?
Why Sun for Drupal?Why Sun for Drupal?
Why Sun for Drupal?
 

Más de Konrad Malawski

Akka Typed (quick talk) - JFokus 2018
Akka Typed (quick talk) - JFokus 2018Akka Typed (quick talk) - JFokus 2018
Akka Typed (quick talk) - JFokus 2018Konrad Malawski
 
Krakow communities @ 2016
Krakow communities @ 2016Krakow communities @ 2016
Krakow communities @ 2016Konrad Malawski
 
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRKKonrad Malawski
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Konrad Malawski
 
Distributed Consensus A.K.A. "What do we eat for lunch?"
Distributed Consensus A.K.A. "What do we eat for lunch?"Distributed Consensus A.K.A. "What do we eat for lunch?"
Distributed Consensus A.K.A. "What do we eat for lunch?"Konrad Malawski
 
Open soucerers - jak zacząć swoją przygodę z open source
Open soucerers - jak zacząć swoją przygodę z open sourceOpen soucerers - jak zacząć swoją przygodę z open source
Open soucerers - jak zacząć swoją przygodę z open sourceKonrad Malawski
 
HBase RowKey design for Akka Persistence
HBase RowKey design for Akka PersistenceHBase RowKey design for Akka Persistence
HBase RowKey design for Akka PersistenceKonrad Malawski
 
Scalding - the not-so-basics @ ScalaDays 2014
Scalding - the not-so-basics @ ScalaDays 2014Scalding - the not-so-basics @ ScalaDays 2014
Scalding - the not-so-basics @ ScalaDays 2014Konrad Malawski
 
DDDing Tools = Akka Persistence
DDDing Tools = Akka PersistenceDDDing Tools = Akka Persistence
DDDing Tools = Akka PersistenceKonrad Malawski
 
Akka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutesAkka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutesKonrad Malawski
 

Más de Konrad Malawski (11)

Akka Typed (quick talk) - JFokus 2018
Akka Typed (quick talk) - JFokus 2018Akka Typed (quick talk) - JFokus 2018
Akka Typed (quick talk) - JFokus 2018
 
Krakow communities @ 2016
Krakow communities @ 2016Krakow communities @ 2016
Krakow communities @ 2016
 
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK
100th SCKRK Meeting - best software engineering papers of 5 years of SCKRK
 
Zen of Akka
Zen of AkkaZen of Akka
Zen of Akka
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014
 
Distributed Consensus A.K.A. "What do we eat for lunch?"
Distributed Consensus A.K.A. "What do we eat for lunch?"Distributed Consensus A.K.A. "What do we eat for lunch?"
Distributed Consensus A.K.A. "What do we eat for lunch?"
 
Open soucerers - jak zacząć swoją przygodę z open source
Open soucerers - jak zacząć swoją przygodę z open sourceOpen soucerers - jak zacząć swoją przygodę z open source
Open soucerers - jak zacząć swoją przygodę z open source
 
HBase RowKey design for Akka Persistence
HBase RowKey design for Akka PersistenceHBase RowKey design for Akka Persistence
HBase RowKey design for Akka Persistence
 
Scalding - the not-so-basics @ ScalaDays 2014
Scalding - the not-so-basics @ ScalaDays 2014Scalding - the not-so-basics @ ScalaDays 2014
Scalding - the not-so-basics @ ScalaDays 2014
 
DDDing Tools = Akka Persistence
DDDing Tools = Akka PersistenceDDDing Tools = Akka Persistence
DDDing Tools = Akka Persistence
 
Akka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutesAkka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutes
 

Último

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 

Último (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 

State of Akka 2017 - The best is yet to come

  • 1. Konrad `ktoso` Malawski @ Scala Days CPH 2017 State of Akka @ 2017 The best is yet to come
  • 2. Konrad `ktoso` Malawski @ Scala Days CPH 2017 Disclaimer: Parts of this talk is about under-development “experimental” APIs which may change slightly. This is not a strict roadmap, it is a general outline where we’re headed.
  • 3. Konrad `ktoso` Malawski Akka Team, Reactive Streams TCK, Scala SLIP Committee member
  • 4. Konrad `@ktosopl` Malawski work: akka.io lightbend.com personal blog: http://kto.so communities: geecon.org Java.pl / KrakowScala.pl sckrk.com GDGKrakow.pl lambdakrk.pl
  • 5.
  • 6. The underlying motto of all our development “Can we do better than that?”
  • 7. The underlying motto of all our development “Can we do better than that?” and sometimes… “Been there, done that.”
  • 8. A Journey From Past, through Current, to the Future…!
  • 10.
  • 12. ”The actor model in computer science is a mathematical model of concurrent computation that treats actors as the universal primitives of concurrent computation. ” Wikipedia The Actor Model
  • 13. and acts on them by: • Sending messages • Changing its state / behaviour • Creating more actors receives messages An Actor
  • 14. A concurrency and distribution construct. an addressable, location-transparent, entity. An Actor Actors talk directly to each other. An ActorSystem is truly peer-to-peer, not client-server.
  • 15. An Actor (current 2.x API, not the ancient one :-))
  • 16. An Actor Java API “feels native”, Java8 Lambdas, no Scala “leaking”
  • 17. A simple Actor interaction Could be different threads or different nodes in cluster. API remains the same - and always async.
  • 18. Why does it matter? Could be different threads or different nodes in cluster. API remains the same - and always async. http://www.anandtech.com/show/11464/intel-announces-skylakex-bringing-18core-hcc-silicon-to-consumers-for-1999
  • 19. Actors are never “exposed”, ActorRefs are.
  • 21. Binary > Textual Protocols “The Internet is running in debug mode.” — Rüdiger Möller http://java-is-the-new-c.blogspot.de/2014/10/why-protocols-are-messy-concept.html
  • 22. MediaContent { media = Media { uri = “http://conference.com/key.mpg" title = "Keynote" width = 640 height = 480 format = "video/mpg4" duration = 18000000 size = 58982400 bitrate = 262144 persons = ["Bill Gates", "Steve Jobs"] player = JAVA copyright = null } } images = [ Image { uri = “http://conference.com/key_large.jpg" title = "Keynote" width = 1024 height = 768 size = LARGE } Image { uri = “http://conference.com/key_small.jpg" title = "Keynote" width = 320 height = 240 size = SMALL } ] Not only JSON: Example data
  • 23. create ser deser total size protostuff 68 433 634 1067ns 239bytes protobuf 121 1173 719 1891 239 kryo-serializer 53 1480 1331 2810 286 thrift 95 1455 731 2186 349 . . . json/jackson/manual 52 1039 1228 2267 468 json/jackson/databind 54 1164 1866 3030 485 json/gson/databind 56 4667 4403 9070 486 xml/xstream+c-aalto 54 3310 6732 10042 525 xml/JAXB 54 4354 141333 145686 719 java-built-in 53 5046 23279 28325 889 Why Binary? Slide only to illustrate order-of-magniture differences. Don’t over-focus on numbers. All details here: https://github.com/eishay/jvm-serializers/wiki
  • 24. create ser deser total size protostuff 68 433 634 1067ns 239bytes protobuf 121 1173 719 1891 239 kryo-serializer 53 1480 1331 2810 286 thrift 95 1455 731 2186 349 . . . json/jackson/manual 52 1039 1228 2267 468 json/jackson/databind 54 1164 1866 3030 485 json/gson/databind 56 4667 4403 9070 486 xml/xstream+c-aalto 54 3310 6732 10042 525 xml/JAXB 54 4354 141333 145686 719 java-built-in 53 5046 23279 28325 889 Why Binary? Slide only to illustrate order-of-magniture differences. Don’t over-focus on numbers. All details here: https://github.com/eishay/jvm-serializers/wiki
  • 25. create ser deser total size protostuff 68 433 634 1067ns 239bytes protobuf 121 1173 719 1891 239 kryo-serializer 53 1480 1331 2810 286 thrift 95 1455 731 2186 349 . . . json/jackson/manual 52 1039 1228 2267 468 json/jackson/databind 54 1164 1866 3030 485 json/gson/databind 56 4667 4403 9070 486 xml/xstream+c-aalto 54 3310 6732 10042 525 xml/JAXB 54 4354 141333 145686 719 java-built-in 53 5046 23279 28325 889 Why Binary? Slide only to illustrate order-of-magniture differences. Don’t over-focus on numbers. All details here: https://github.com/eishay/jvm-serializers/wiki
  • 26. Avoid Java Serialization ----sr--model.Order----h#-----J--idL--customert--Lmodel/Customer;L--descriptiont--Ljava/lang/String;L-- orderLinest--Ljava/util/List;L--totalCostt--Ljava/math/BigDecimal;xp--------ppsr--java.util.ArrayListx----- a----I--sizexp----w-----sr--model.OrderLine--&-1-S----I--lineNumberL--costq-~--L--descriptionq-~--L--ordert-- Lmodel/Order;xp----sr--java.math.BigDecimalT--W--(O---I--scaleL--intValt--Ljava/math/BigInteger;xr-- java.lang.Number-----------xp----sr--java.math.BigInteger-----;-----I--bitCountI--bitLengthI-- firstNonzeroByteNumI--lowestSetBitI--signum[--magnitudet--[Bxq-~----------------------ur--[B------T----xp---- xxpq-~--xq-~-- Java Serialization final case class Order(id: Long, description: String, totalCost: BigDecimal, orderLines: ArrayList[OrderLines], customer: Customer) <order id="0" totalCost="0"><orderLines lineNumber="1" cost="0"><order>0</order></orderLines></order>XML…! {"order":{"id":0,"totalCost":0,"orderLines":[{"lineNumber":1,"cost":0,"order":0}]}}JSON…! ------java-util-ArrayLis-----model-OrderLin----java-math-BigDecima---------model-Orde-----Kryo…! Excellent post by James Sutherland @ http://java-persistence-performance.blogspot.com/2013/08/optimizing-java-serialization-java-vs.html
  • 27. Avoid Java Serialization Akka uses ProtocolBuffers for (most*) it’s messages by default. To completely disable Java Serialization do: akka.actor.allow-java-serialization = false (which switches Akka to protobuf completely) User messages you define your own serializers. most* – due to wire compatibility some messages, where some messages did use JavSer in the past
  • 28. Avoid Java Serialization Good serializers include (but are not limited to): Kryo, Google Protocol Buffers, SBE,Thrift, JSON if you really want // dependencies "com.github.romix.akka" %% "akka-kryo-serialization" % "0.4.0" // application.conf extensions = [“com.romix.akka.serialization.kryo.KryoSerializationExtension$"] 
 serializers { 
 java = "akka.serialization.JavaSerializer" kryo = "com.romix.akka.serialization.kryo.KryoSerializer" 
 } akka.actor.serialization-bindings { “com.mycompany.Example”: kryo . . . } [info] ForkJoinActorBenchmark.pingPong java avgt 10 25.464 ± 1.175 us/op [info] ForkJoinActorBenchmark.pingPong kryo avgt 10 4.348 ± 4.346 us/op [info] ForkJoinActorBenchmark.pingPong off avgt 10 0.967 ± 0.657 us/op
  • 29. Sidenote: Akka + Binary Compatibility?
  • 30. Our binary compatibility story http://doc.akka.io/docs/akka/current/scala/common/binary-compatibility-rules.html
  • 31. Our binary compatibility story http://doc.akka.io/docs/akka/current/scala/common/binary-compatibility-rules.html 2.3.1x [2015-09] -> 2.4.x [2015-08] -> 2.5.x [2017-04] -> ... 2.7.x [???] -> 2.8.x [???] -> 3.x [far out still, no need to break APIs]
  • 32. Our binary compatibility story http://doc.akka.io/docs/akka/current/scala/common/binary-compatibility-rules.html Binary compatibility != Wire compatibility /* but we’ll get to that! (hint: Artery) */
  • 33.
  • 34. History of Futures In Days before Futures got standardised in Scala (~2012). Their design was heavily influenced by: Akka, Finagle & Scalaz & more… Archival version @ 2012 http://doc.akka.io/docs/akka/2.0/scala/futures.html SIP-14 - Futures and Promises By: Philipp Haller, Aleksandar Prokopec, Heather Miller, Viktor Klang, Roland Kuhn, and Vojin Jovanovic http://docs.scala-lang.org/sips/completed/futures-promises.html
  • 35.
  • 36. “Best practices are solutions to yesterdays problems.” https://twitter.com/FrankBuytendijk/status/795555578592555008 Circuit breaking as substitute of flow-control
  • 37. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak
  • 38. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak
  • 39. HTTP/1.1 503 Service Unavailable HTTP/1.1 503 Service Unavailable Throttling as represented by 503 responses. Client will back-off… but how? What if most of the fleet is throttling?
  • 42. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak “slamming the breaks”
  • 43. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak “slamming the breaks”
  • 44. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak “slamming the breaks”
  • 45. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak “slamming the breaks”
  • 46. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak “slamming the breaks”
  • 47. See also, Nitesh Kant, Netflix @ Reactive Summit https://www.youtube.com/watch?v=5FE6xnH5Lak We’ll re-visit this specific case in a bit :-) “slamming the breaks”
  • 48. Are absolutely useful! Still… “Can do better than that?” Circuit Breakers
  • 49.
  • 50. This will lead to the creation of Akka Streams and Reactive Streams! We can do better.
  • 51.
  • 52. The heart of Distributed Systems, built using Akka. Akka Cluster
  • 53. Akka cluster provides membership and fault-tolerance for distributed Actors. - Membership is implemented as epidemic gossip. - No single point of failure, “Leader” can move to 
 any of the nodes (deterministically) - Battle hardened since many years - Known to scale to 2400 nodes. Akka Cluster https://cloudplatform.googleblog.com/2014/01/large-akka-cluster-on-google-compute.html
  • 56. Failure detection using simple heartbeats often not good enough for production. You can: - Use Akka Split Brain Resolver (commercial), 
 multiple split brain scenario resolution strategies - “Keep majority”, “Keep oldest”, “Static Quorum” - Perform manual downing 
 (a safe bet, good if OPS or automated via Nagios etc) - Roll your own, all required APIs are public Failure detection is pluggable https://cloudplatform.googleblog.com/2014/01/large-akka-cluster-on-google-compute.html
  • 57.
  • 58. bit.ly/why-reactive How to think about these techniques?
  • 59. Back then known as “Spray”, we joined up and started working on a streaming-first HTTP server. Akka HTTP
  • 60. - Fully Typed HTTP model - So good, other projects use it instead of rolling their own! (http4s uses Spray’s model.)
 - Streaming-focused HTTP server - Built from the ground up on Akka Streams - Full Java API (unlike Spray) - Streaming with WebSockets! Key features of Akka HTTP
  • 61. Streaming in Akka HTTP http://doc.akka.io/docs/akka/2.4/scala/stream/stream-customize.html#graphstage-scala “Framed entity streaming” http://doc.akka.io/docs/akka/2.4/java/http/routing-dsl/source-streaming-support.html HttpServer as a: Flow[HttpRequest, HttpResponse]
  • 62. Streaming in Akka HTTP HttpServer as a: Flow[HttpRequest, HttpResponse] HTTP Entity as a: Source[ByteString, _] http://doc.akka.io/docs/akka/2.4/scala/stream/stream-customize.html#graphstage-scala “Framed entity streaming” http://doc.akka.io/docs/akka/2.4/java/http/routing-dsl/source-streaming-support.html
  • 63. Streaming in Akka HTTP HttpServer as a: Flow[HttpRequest, HttpResponse] HTTP Entity as a: Source[ByteString, _] Websocket connection as a: Flow[ws.Message, ws.Message] http://doc.akka.io/docs/akka/2.4/scala/stream/stream-customize.html#graphstage-scala “Framed entity streaming” http://doc.akka.io/docs/akka/2.4/java/http/routing-dsl/source-streaming-support.html
  • 64. High level Routing API: Key features of Akka HTTP
  • 65. Low-level API (e.g. what Play uses): Key features of Akka HTTP
  • 66.
  • 68. Event sourcing your Actors Receive commands. Store events. Optional: Create queries / views
  • 72. Present & near Future 2016~2017+
  • 73.
  • 75. CAP theorem reminder Akka Persistence Akka DData
  • 76. CAP theorem reminder Akka DDataAkka Persistence
  • 77. Using Distributed Data The focus is on “spreading the data”, not on the “single entity” like it is in Persistence.
  • 78. Distributed Data visualised You supply a write consistency level which has the following meaning: • WriteLocal the value will immediately only be written to the local replica, and later disseminated with gossip • WriteTo(n) the value will immediately be written to at least n replicas, including the local replica • WriteMajority the value will immediately be written to a majority of replicas, i.e. at least N/2 + 1 replicas, where N is the number of nodes in the cluster (or cluster role group) • WriteAll the value will immediately be written to all nodes in the cluster (or all nodes in the cluster role group)
  • 83. Summary of CRDTs • Counters: GCounter, PNCounter • Sets: GSet, ORSet • Maps: ORMap, ORMultiMap, LWWMap, PNCounterMap • Registers: LWWRegister, Flag
  • 84.
  • 86. Suddenly everyone jumped on the word “Stream”. Akka Streams / Reactive Streams started end-of-2013. “Streams” * when put in “” the word does not appear in project name, but is present in examples / style of APIs / wording.
  • 87. Suddenly everyone jumped on the word “Stream”. Akka Streams / Reactive Streams started end-of-2013. The word “Stream” is used in many contexts/meanings Akka Streams Reactive Streams RxJava “streams”* Spark Streaming Apache Storm “streams”* Java Steams (JDK8) Reactor “streams”* Kafka Streams ztellman / Manifold (Clojure) * when put in “” the word does not appear in project name, but is present in examples / style of APIs / wording. Apache GearPump “streams” Apache [I] Streams (!) Apache [I] Beam “streams” Apache [I] Quarks “streams” Apache [I] Airflow “streams” (dead?) Apache [I] Samza Scala Stream Scalaz Streams, now known as FS2 Swave.io Java InputStream / OutputStream / … :-) 2017年: 安定版。リアクティブストリーム付きの JDK9。
  • 88. “Stream” What does it mean?! • Possibly infinite datasets (“streams”) • “Streams are NOT collections.” • Processed element-by-element • Element could mean “byte” • More usefully though it means a specific type “T” • Asynchronous processing • Asynchronous boundaries (between threads) • Network boundaries (between machines) 2017年: 安定版。リアクティブストリーム付きの JDK9。
  • 89. Where does Akka Stream fit? Akka Streams specifically fits, if you answer yes to any of these: • Should it take on public traffic? • Processing in hot path for requests? • Integrate various technologies? • Protect services from over-load? • Introspection, debugging, excellent Akka integration? • (vs. other reactive-stream impls.)
  • 90. How do I pick which “streaming” I need? Kafka serves best as a transport for pub-sub across services. • Note that Kafka Streams (db ops are on the node is rather, different than the Reactive Kafka client • Great for cross-service communication 
 instead of HTTP Request / Reply Kafka はサービス間の pub-sub 通信に向いている HTTP の代わりにサービス間の通信に使う
  • 91. How do I pick which “streaming” I need? Spark has vast libraries for ML or join etc ops. • It’s the “hadoop replacement”. • Spark Streaming is windowed-batches • Latency anywhere up from 0.5~1second • Great for cross-service communication 
 instead of HTTP Req/Reply Spark は機械学習系が充実している
  • 92. Oh yeah, there’s JDK8 “Stream” too! Terrible naming decision IMHO, since Java’s .stream() • Geared for collections • Best for finite and known-up-front data • Lazy, sync/async (async rarely used) • Very (!) hard to extend It’s the opposite what we talk about in Streaming systems! It’s more:“bulk collection operations” Also known as… Scala collections API (i.e. Iterator JDK8 の Stream はイテレータ的なもの
  • 93. What about JDK9 “Flow”? JDK9 introduces java.util.concurrent.Flow • Is a 1:1 copy of the Reactive Streams interfaces • On purpose, for people to be able to impl. it • Does not provide useful implementations • Is only the inter-op interfaces • Libraries like Akka Streams implement RS,
 and expose useful APIs for you to use. JDK9 の Flow はリアクティブ・ストリーム
  • 94. A fundamental building block. Not end-user API by itself. reactive-streams.org Reactive Streams
  • 95. Reactive Streams More of an SPI (Service Provider Interface), than API. reactive-streams.org
  • 97. Reactive Streams - story: 2013’s impls 2014–2015: Reactive Streams Spec & TCK development, and implementations. 1.0 released on April 28th 2015, with 5+ accompanying implementations. 2015 Included in JDK9 via JEP-266 “More Concurrency Updates” download.java.net/java/jdk9/docs/api/java/util/concurrent/Flow.html
  • 98. But what does it do!? Reactive Streams
  • 99. Fast Publisher[T] Slow Subscriber[T] Push model
  • 100. Subscriber usually has some kind of buffer. Push model
  • 101. What if the buffer overflows? Push model
  • 102. Kernel does this! Routers do this! (TCP) Use bounded buffer, drop messages + require re-sending Push model
  • 103. Reactive Streams explained Reactive Streams explained in 1 slide
  • 104. Fast Publisher will send at-most 3 elements. This is pull-based- backpressure. Reactive Streams: “dynamic push/pull”
  • 105. JEP-266 – soon…! public final class Flow { private Flow() {} // uninstantiable @FunctionalInterface public static interface Publisher<T> { public void subscribe(Subscriber<? super T> subscriber); } public static interface Subscriber<T> { public void onSubscribe(Subscription subscription); public void onNext(T item); public void onError(Throwable throwable); public void onComplete(); } public static interface Subscription { public void request(long n); public void cancel(); } public static interface Processor<T,R> extends Subscriber<T>, Publisher<R> { } }
  • 106. Reactive Streams: goals 1) Avoiding unbounded buffering across async boundaries 2) Inter-op interfaces between various libraries
  • 107. Reactive Streams: goals 1) Avoiding unbounded buffering across async boundaries 2) Inter-op interfaces between various libraries Argh, implementing a correct RS Publisher or Subscriber is so hard!
  • 108. 1) Avoiding unbounded buffering across async boundaries 2) Inter-op interfaces between various libraries Reactive Streams: goals Argh, implementing a correct RS Publisher or Subscriber is so hard!
  • 109. Reactive Streams: goals Argh, implementing a correct RS Publisher or Subscriber is so hard! You should be using Akka Streams instead! 1) Avoiding unbounded buffering across async boundaries 2) Inter-op interfaces between various libraries
  • 110. Akka Streams in 20 seconds: val firstString: Future[String] =
 Source.single(1)
 .map(_.toString())
 .runWith(Sink.head)

  • 111. Source.single(1).map(i => i.toString).runWith(Sink.head()) // types: _ Source[Int, NotUsed] Flow[Int, String, NotUsed] Sink[String, Future[String]] Akka Streams in 20 seconds:
  • 112. // types: _ Source[Int, NotUsed] Flow[Int, String, NotUsed] Sink[String, Future[String]] Source.single(1).map(i => i.toString).runWith(Sink.head()) Akka Streams in 20 seconds:
  • 113.
  • 114. natively in Akka HTTP/2 HTTP/2
  • 115. HTTP/2 1.9M May 15 08:02 bigimage.jpg 995K May 15 08:16 bigimage2.jpg
  • 116. HTTPS - the usual waterfall
  • 117. HTTPS - the usual waterfall
  • 118. HTTPS - the usual waterfall
  • 119. HTTP/2
  • 120. HTTP/2
  • 122. Play + Akka HTTP => HTTP/2 + TLS configuration https://github.com/playframework/play-scala-tls-example/pull/30 http/2HTTP+ =
  • 123. Akka HTTP as default backend for Play Goal is not to “beat Netty*” but to keep perf while adding features. Future: - Shared Typed HTTP Model - Shared Monitoring - Shared performance work TL;DR; == Shared efforts * We <3 Netty. http://playframework.github.io/prune/ Ofc: Netty backend remains available.
  • 124.
  • 126. The journey to Akka Typed
  • 127. The journey to Akka Typed Ancient API, deprecated“Typed Actor” API Goal was to expose what Java developers knew.
  • 128. The journey to Akka Typed Old “TypedActor” experimental in 2.3, removed Upsides: - Easily bridge to “non-Akka” / “non-Reactive” apps - type-safe - “easy” (not necessarily a good thing) Downsides: - Reflection, 10x slow-down compared to UntypedActor - “RPC”-ish, not true to the core messaging - Not true to Akka’s core principle: Messaging
  • 129. The journey to Akka Typed
  • 130. The journey to Akka Typed “Typed Channels” experimental in 2.3, removed
  • 131. The journey to Akka Typed “Typed Channels” experimental in 2.3, removed Upsides: - completely type-safe - very expressive Downsides: - Too complex, many new operators - Had to rely on scala macros - “sender” difficult to solve
  • 132. The journey to Akka Typed
  • 133. The journey to Akka Typed http://axel22.github.io/resources/docs/reactors.pdf
  • 134. The journey to Akka Typed
  • 135. Akka Typed try it now, 2.5.2 from repo.akka.io/snapshots 2 styles, 100% awesome. Full Java & Scala API, as usual. Actor.mutable – similar to current Actors, Behavior is a class Actor.immutable – more functional style, recommended
  • 136. Akka Typed Main user-facing changes: ActorRef[T] typed ActorRefs. Core concept is Behavior[T] which can be freely composed. You always “become(Behavior)”, by returning Behavior. sender() is gone, not possible to type it well. sender was trouble anyway, so that’s good!
  • 141. Akka Typed Actor.immutable (Scala) Don’t worry, Java will eventually get pattern matching: http://mail.openjdk.java.net/pipermail/amber-spec-experts/2017-April/000033.html Java adopting Scala features confirms Scala’s design. …but, until then we provide you with helpers and DSLs:
  • 143. Akka Typed try it now, 2.5.99-TYPED-M1 from repo.akka.io/snapshots Learn more: from the docs: http://doc.akka.io/docs/akka/snapshot/scala/typed.html and the blog: 1. Akka Typed: Hello World in the new API 2. Akka Typed: Coexistence 3. Akka Typed: Mutable vs. Immutable 4. Akka Typed: Protocols 5. Akka Typed: Supervision 6. Akka Typed: Lifecycle and Watch 7. Akka Typed: Timers
  • 144.
  • 145. A community for Streams connectors Alpakka – a community for Stream connectors Alp
  • 146. Alpakka – a community for Stream connectors http://developer.lightbend.com/docs/alpakka/current/
  • 147. Alpakka – a community for Stream connectors http://developer.lightbend.com/docs/alpakka/current/
  • 148. Alpakka – a community for Stream connectors http://developer.lightbend.com/docs/alpakka/current/
  • 149. Akka Streams in 20 seconds:
  • 150. Akka Streams in 20 seconds:
  • 151. Akka Streams core principles:
  • 152. Akka Streams core principles:
  • 153. Ecosystem that solves problems > (is greater than) solving all the problems ourselves
  • 154.
  • 155. Way more than just “we changed the transport.” New Remoting: Artery
  • 156. Artery Next generation remoting layer for Akka. • Aeron (UDP) based instead of TCP, • Advanced automatic ActorRef Compression • Dedicated “lanes” for certain messages / destinations • Almost alloc-free in steady-state (except deserialization)
  • 157. Remoting feature matrix Remoting “classic” Artery Remoting Protocol TCP TLS+TCP UDP (Aeron) Large messages Troublesome Dedicated lanes Heartbeat and System Messages Prioritised Dedicated lanes Benchmarked* throughput 70k msg/s 700k+ msg/s (up to 1m msg/s) * benchmark setup: 5-to-5 actors, 100byte payload message (excluding envelope size),Amazon EC2 M4-X2Large instances
  • 158. How to use Artery? single option, no new artifacts
  • 159. “Steady state” operation almost alloc-free Serialize Deserialize compression compression package readpackage write AkkaStreams (allocationfree) Pooled envelopes Pooled ByteBuffers Deserialize allocates Pooled ByteBuffers no allocations Caches for ActorRefs etc no allocations in steady state
  • 160. Artery: ActorRef Compression Compression triggered for “heavy hitters”, so “most chatty” Actors to maximise benefit. Triggers automatically & transparently.
  • 161. Artery: ActorRef / Manifest Compression
  • 162. Artery: ActorRef / Manifest Compression In this case ActorRef compression reduced the size of a small envelope size by 74% - from 162 to 42 bytes (sic!).
  • 163.
  • 164. Multi Data Center Customers increasingly have global-scale apps, so we’re looking into advanced Multi-DataCenter scenarios.
  • 165. Multi Data Center These are just ideas. Talk to me, we’re gathering use cases. - Active + Active ??? - Locality aware Cluster Sharding ??? - Entity “owner” Datacenter ??? - Talk to us about your use cases :) - …?
  • 166. Wait, there’s more! (things I couldn’t fit on the map)
  • 167. New docs engine New QuickStart, ScalaFiddle…
  • 168. Lightbend Paradox - docs engine We know, we know:“Yet another docs engine” Built-in scala-fiddle support Akka.js => run Akka docs examples in browser
  • 169. Lightbend Paradox - docs engine Much much easier to contribute now. Zero dependencies just type “paradox” Markdown instead of restructured text! Built in capabilities to link github / scaladoc Simple way to build multi-prog-lang docs @scala/@java
  • 174. Monitoring Akka e.g. DataDog || StatsD || Graphite || …anything!
  • 175. Monitoring Akka Remember where Artery Compression kicks in? (“Top senders” / “Top receivers”)
  • 176. Tracing Akka with Jaeger or Zipkin Uber Jaeger Twitter Zipkin
  • 177. Tracing Akka with Jaeger or Zipkin Lightbend Monitoring https://developer.lightbend.com/docs/cinnamon/latest/extensions/opentracing.html
  • 178. Tracing across nodes Lightbend Monitoring https://developer.lightbend.com/docs/cinnamon/latest/extensions/opentracing.html Already tracing across network transparently, Akka HTTP coming soon, as will Futures.
  • 179. Monitoring Akka “What is failing in the system?” Lightbend OpsClarity
  • 182. Ports to other platforms Not supported by Lightbend, community projects. http://getakka.net/ http://akka-js.org/ A sign that Akka is interesting and worth porting:
  • 183. Open Source projects using Akka index.scala-lang.org
  • 185. Summing up With all the foundational building blocks prepared… “The best is yet to come.”
  • 188. Thanks everyone Committers from the Community! Jan Pustelnik Krzysiek Ciesielski, Alexey Romanchuk, Heiko Seeberger, Josep Prat, Jan Ypma, André Rüdiger, Jonas Fonseca … and hundreds of contributors Thanks!
  • 189. We <3 contributions •Easy to contribute: • https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3Aeasy-to-contribute • https://github.com/akka/akka/issues?q=is%3Aissue+is%3Aopen+label%3A%22nice-to-have+%28low-prio%29%22 •Akka: akka.io && github.com/akka •Reactive Streams: reactive-streams.org •Reactive Socket: reactivesocket.io • Mailing list: • https://groups.google.com/group/akka-user •Public chat rooms: •http://gitter.im/akka/dev developing Akka • http://gitter.im/akka/akka using Akka
  • 190. Free e-book and printed report. bit.ly/why-reactive Covers what reactive actually is. Implementing in existing architectures. Thoughts from the team that’s building reactive apps since more than 6 years. Obligatory “read my book!” slide :-)
  • 191. Metal Gear Solid illustrations by Lap Pun Cheung http://www.lpcheung.com/metal-gear-solid/ Hand drawn illustrations: by myself, CC-BY-NC Artwork links
  • 192. Thanks! Questions? ktoso @ lightbend.com twitter: ktosopl github: ktoso team blog: blog.akka.io home: akka.io myself: kto.so