Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
Reactive Systems Toolkit - Akka
• Microservice Systems
• Clusters within clusters
• System Orchestration
Clustering
Stream...
Akka History
Akka - Initially developed by Jonas Bonér in 2009
First public release 2009
Inspired by Carl Hewitt’s early 7...
Reactive Systems Toolkit - Akka
• Microservice Systems
• Clusters within clusters
• System Orchestration
Clustering
Stream...
Actors
Actor Model
Actor Model - breaking free from
imperative, synchronous, thread heavy
systems development
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Messaging
Actors
Actor Model
Actors
Actor Model
Actors
Actor Model
Actors
Actor Model
Actors
Actor Model
Failure is NOT unexpected or unwanted.
It’s just a fact of life.
Failure handing is an architectural fe...
Actors
Supervision
Actors
Supervision
Actors
Supervision
Actors
Supervision
Actors
Supervision
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Routing & Concurrency
Actors
Summary
• Actors are message driven, stateful building blocks
• Messages are passed asynchronously
• Actors may cre...
Reactive Systems Toolkit - Akka
• Microservice Systems
• Clusters within clusters
• System Orchestration
Clustering
Stream...
Streams
Reactive Streams
Reactive Streams - standard for
asynchronous stream processing
with non-blocking back pressure
Streams
Reactive Streams
Java 9 Reactive Streams
Streams
Akka Streams
Streams
Akka Streams
Streams
Akka Streams
!= drop log scan
## dropWhile map scanAsync
+ dropWithin mapAsync shape
++ ensuring mapAsyncUnordered...
Streams
Akka Streams
import GraphDSL.Implicits._
RunnableGraph.fromGraph(GraphDSL.create() { implicit builder =>
val A: Ou...
Streams
Akka Streams
RunnableGraph.fromGraph(
GraphDSL.create(builder -> {
final Outlet<Integer> A = builder.add(Source.si...
Streams
Akka HTTP
Streams
Akka HTTP
Streams
Alpakka
Connectors
• AMQP
• Apache Geode
• AWS DynamoDB
• AWS Kinesis
• AWS Lambda
• AWS S3
• AWS SNS
• AWS SQS
• ...
Streams
Alpakka
// Read huge file with Wikipedia content
Source<WikipediaEntry,
CompletionStage<IOResult>> wikipediaEntrie...
Streams
Summary
• Akka Streams is a Reactive Streams implementation
• Flow control of data via demand based back-pressure
...
Reactive Systems Toolkit - Akka
• Microservice Systems
• Clusters within clusters
• System Orchestration
Clustering
Stream...
Cluster Features
Cluster Features - actor systems that span
clusters of multiple JVMs
Cluster Features
Cluster Membership
Cluster Features
Cluster Membership
State Diagram of Akka Cluster Member States
Cluster Features
Cluster Sharding
Send messages to actors
distributed across a cluster
via logical identifiers
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Cluster Sharding
Cluster Features
Event Sourcing & CQRS
Akka Persistence
Akka Persistence Query
Cluster Sharding
Actor implementation of
Ev...
Cluster Features
Event Sourcing & CQRS
Akka Persistence
Akka Persistence Query
Cluster Sharding
Cluster Features
Event Sourcing & CQRS
Akka Persistence
Akka Persistence Query
Cluster Sharding
Cluster Features
Event Sourcing & CQRS
Akka Persistence
Akka Persistence Query
Cluster Sharding
Cluster Features
Event Sourcing & CQRS
Akka Persistence
Akka Persistence Query
Cluster Sharding
Cluster Features
Publish and Subscribe
Distributed
Publish & Subscribe
Cluster Features
Publish and Subscribe
Cluster Features
Publish and Subscribe
Cluster Features
Publish and Subscribe
Cluster Features
Distributed Data
Share data between nodes in an Akka Cluster
Conflict Free Replicated Data Types (CRDTs)
Cluster Features
Distributed Data
Cluster Features
Distributed Data
Cluster Features
Distributed Data
Cluster Features
Distributed Data
Cluster Features
Distributed Data
Cluster Features
Distributed Data
Cluster Features
Summary
• Groups of collaborating actors abstract functionality
• Cluster aware actors react to cluster s...
Reactive Systems Toolkit - Akka
• Microservice Systems
• Clusters within clusters
• System Orchestration
Clustering
Stream...
Clustering
Clustering - strength in numbers
Clustering
Reactive Services
Clustering
Akka & Play Services
Clustering
Lagom Microservices
Clustering
Lagom Microservices
Clustering
Lagom Microservices
Microservice
Microservice
Microservice
Clustering
Summary
• Clusters dynamically react to node topology changes
• Reactive microservices with Akka, Play, and Lag...
Reactive Systems Toolkit - Akka
• Microservice Systems
• Clusters within clusters
• System Orchestration
Clustering
Stream...
Reactive Systems
Application landscape is now a city of services
Reactive Systems
Monoliths, Microliths,
Microservices,
and Lambdas
Built with Akka and
Java or Scala
Reactive Systems
Clusters within
a cluster
Towns within
a city
Reactive Systems
System Orchestration
Application Management
Network Partition
Split Brain Resolution
Reactive Systems
System Orchestration
Application Management
Network Partition
Split Brain Resolution
Reactive Systems
System Orchestration
Akka Telemetry
and Monitoring
Diagnostic RecorderConfiguration Checker
Reactive Systems
Reactive, Cognitive,
and
Real-time Data-driven
Applications
Fast Data Platform
Reactive Systems
Reactive, Cognitive,
and
Real-time Data-driven
Applications
Fast Data Platform
Reactive Systems
Reactive, Cognitive,
and
Real-time Data-driven
Applications
Fast Data Platform
Reactive Systems
Reactive, Cognitive,
and
Real-time Data-driven
Applications
Fast Data Platform
Reactive Systems
Summary
Akka is a toolkit for building highly concurrent,
distributed, and resilient message-driven appli...
Reactive Systems Toolkit - Akka
• Microservice Systems
• Clusters within clusters
• System Orchestration
Clustering
Stream...
Akka Customers
Reactive Systems Toolkit
Reactive Programming Toolkit
Upgrade your grey matter!

Get the free O’Reilly book by Hugh McKee, 

Developer Advocate at Lightbend
https://www.lightbe...
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Clusters
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Clusters
Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Clusters
Próxima SlideShare
Cargando en…5
×

Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Clusters

9.678 visualizaciones

Publicado el

By now, you’ve probably heard of Akka, the JVM toolkit for building scalable, resilient and resource efficient applications in Java or Scala. With over 12 open-source and commercial modules in the toolkit, Akka takes developers from actors on a single JVM, all the way out to network partition healing and clusters of servers distributed across fleets of JVMs. But with such a broad range of features, how can Architects and Developers grok Akka from a high-level perspective?

In this technical webinar by Hugh McKee, O’Reilly author and Developer Advocate at Lightbend, we introduce Akka from A to Z, starting with a tour from the humble actor and finishing all the way at the clustered systems level. Specifically, we will review:

*How Akka Actors behave, create systems, and manage supervision and routing
*The way Akka embraces Reactive Streams with Akka Streams and Alpakka
*How various components of the Akka toolkit provide out-of-the-box solutions for distributed data, distributed persistence, pub-sub, and ES/CQRS
*How Akka works with microservices, and brings this functionality into Lagom and Play Frameworks
*Looking at Akka clusters, how Akka is used to build distributed clustered systems incorporate clusters within clusters
*What’s needed to orchestrate and deploy complete Reactive Systems

Publicado en: Software
  • Hello! Get Your Professional Job-Winning Resume Here - Check our website! https://vk.cc/818RFv
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí

Akka Revealed: A JVM Architect's Journey From Resilient Actors To Scalable Clusters

  1. 1. Reactive Systems Toolkit - Akka • Microservice Systems • Clusters within clusters • System Orchestration Clustering Streams Actors Cluster Features • Reactive Services • Akka & Play Services • Lagom Microservices • Membership • Sharding • Event Sourcing & CQRS • Publish & Subscribe • Distributed Data • Reactive Streams • Akka Streams • Alpakka • Actor Model • Supervision • Routing
  2. 2. Akka History Akka - Initially developed by Jonas Bonér in 2009 First public release 2009 Inspired by Carl Hewitt’s early 70’s work and the Erlang runtime system A distributed, highly concurrent, and event driven implementation of the Actor Model on the JVM - Java & Scala
  3. 3. Reactive Systems Toolkit - Akka • Microservice Systems • Clusters within clusters • System Orchestration Clustering Streams Actors Cluster Features • Reactive Services • Akka & Play Services • Lagom Microservices • Membership • Sharding • Event Sourcing & CQRS • Publish & Subscribe • Distributed Data • Reactive Streams • Akka Streams • Alpakka • Actor Model • Supervision • Routing
  4. 4. Actors Actor Model Actor Model - breaking free from imperative, synchronous, thread heavy systems development
  5. 5. Actors Actor Messaging
  6. 6. Actors Actor Messaging
  7. 7. Actors Actor Messaging
  8. 8. Actors Actor Messaging
  9. 9. Actors Actor Messaging
  10. 10. Actors Actor Messaging
  11. 11. Actors Actor Messaging
  12. 12. Actors Actor Messaging
  13. 13. Actors Actor Messaging
  14. 14. Actors Actor Model
  15. 15. Actors Actor Model
  16. 16. Actors Actor Model
  17. 17. Actors Actor Model
  18. 18. Actors Actor Model Failure is NOT unexpected or unwanted. It’s just a fact of life. Failure handing is an architectural feature not an afterthought.
  19. 19. Actors Supervision
  20. 20. Actors Supervision
  21. 21. Actors Supervision
  22. 22. Actors Supervision
  23. 23. Actors Supervision
  24. 24. Actors Routing & Concurrency
  25. 25. Actors Routing & Concurrency
  26. 26. Actors Routing & Concurrency
  27. 27. Actors Routing & Concurrency
  28. 28. Actors Routing & Concurrency
  29. 29. Actors Routing & Concurrency
  30. 30. Actors Routing & Concurrency
  31. 31. Actors Routing & Concurrency
  32. 32. Actors Routing & Concurrency
  33. 33. Actors Summary • Actors are message driven, stateful building blocks • Messages are passed asynchronously • Actors may create other actors • Actors form supervision hierarchies • Actors are lightweight and do not hold threads
  34. 34. Reactive Systems Toolkit - Akka • Microservice Systems • Clusters within clusters • System Orchestration Clustering Streams Actors Cluster Features • Reactive Services • Akka & Play Services • Lagom Microservices • Membership • Sharding • Event Sourcing & CQRS • Publish & Subscribe • Distributed Data • Reactive Streams • Akka Streams • Alpakka • Actor Model • Supervision • Routing
  35. 35. Streams Reactive Streams Reactive Streams - standard for asynchronous stream processing with non-blocking back pressure
  36. 36. Streams Reactive Streams Java 9 Reactive Streams
  37. 37. Streams Akka Streams
  38. 38. Streams Akka Streams
  39. 39. Streams Akka Streams != drop log scan ## dropWhile map scanAsync + dropWithin mapAsync shape ++ ensuring mapAsyncUnordered sliding -> eq mapConcat splitAfter == equals mapError splitWhen Closed expand mapMaterializedValue statefulMapConcat ClosedMat filter merge synchronized Repr filterNot mergeMat take ReprMat flatMapConcat mergeSorted takeWhile Shape flatMapMerge mergeSortedMat takeWithin addAttributes fold monitor throttle alsoTo foldAsync named to alsoToMat formatted ne toMat asInstanceOf getClass notify toString asJava groupBy notifyAll traversalBuilder async grouped orElse via backpressureTimeout groupedWeightedWithin orElseMat viaMat batch groupedWithin prefixAndTail wait batchWeighted hashCode prepend watchTermination buffer idleTimeout prependMat withAttributes collect initialDelay recover zip combine initialTimeout recoverWith zipMat completionTimeout interleave recoverWithRetries zipWith concat interleaveMat reduce zipWithIndex concatMat intersperse runFold zipWithMat conflate isInstanceOf runFoldAsync ! conflateWithSeed keepAlive runForeach delay limit runReduce detach limitWeighted runWith Rich set of flow processing functions
  40. 40. Streams Akka Streams import GraphDSL.Implicits._ RunnableGraph.fromGraph(GraphDSL.create() { implicit builder => val A: Outlet[Int] = builder.add(Source.single(0)).out val B: UniformFanOutShape[Int, Int] = builder.add(Broadcast[Int](2)) val C: UniformFanInShape[Int, Int] = builder.add(Merge[Int](2)) val D: FlowShape[Int, Int] = builder.add(Flow[Int].map(_ + 1)) val E: UniformFanOutShape[Int, Int] = builder.add(Balance[Int](2)) val F: UniformFanInShape[Int, Int] = builder.add(Merge[Int](2)) val G: Inlet[Any] = builder.add(Sink.foreach(println)).in C <~ F A ~> B ~> C ~> F B ~> D ~> E ~> F E ~> G ClosedShape })
  41. 41. Streams Akka Streams RunnableGraph.fromGraph( GraphDSL.create(builder -> { final Outlet<Integer> A = builder.add(Source.single(0)).out(); final UniformFanOutShape<Integer, Integer> B = builder.add(Broadcast.create(2)); final UniformFanInShape<Integer, Integer> C = builder.add(Merge.create(2)); final FlowShape<Integer, Integer> D = builder.add(Flow.of(Integer.class).map(i -> i + 1)); final UniformFanOutShape<Integer, Integer> E = builder.add(Balance.create(2)); final UniformFanInShape<Integer, Integer> F = builder.add(Merge.create(2)); final Inlet<Integer> G = builder.add(Sink.<Integer> foreach(System.out::println)).in(); builder.from(F).toFanIn(C); builder.from(A).viaFanOut(B).viaFanIn(C).toFanIn(F); builder.from(B).via(D).viaFanOut(E).toFanIn(F); builder.from(E).toInlet(G); return ClosedShape.getInstance(); }));
  42. 42. Streams Akka HTTP
  43. 43. Streams Akka HTTP
  44. 44. Streams Alpakka Connectors • AMQP • Apache Geode • AWS DynamoDB • AWS Kinesis • AWS Lambda • AWS S3 • AWS SNS • AWS SQS • Azure Storage Queue • Cassandra • File • FTP • Google Cloud Pub/Sub • HBbase • IronMq • JMS • MQTT • Server-sent Events (SSE) Alpakka - Akka Streams alternative to Apache Camel
  45. 45. Streams Alpakka // Read huge file with Wikipedia content Source<WikipediaEntry, CompletionStage<IOResult>> wikipediaEntries = FileIO.fromPath(Paths.get("/tmp", "wiki")) .via(parseWikiEntries()); // Enrich the data by fetching matching image from a // web service with HTTP Source<RichWikipediaEntry, CompletionStage<IOResult>> enrichedData = wikipediaEntries .via(enrichWithImageData); // Store content in Kafka // and corresponding image in AWS S3 enrichedData .alsoTo(s3ImageStorage()) .to(kafkaTopic) .run(materializer);
  46. 46. Streams Summary • Akka Streams is a Reactive Streams implementation • Flow control of data via demand based back-pressure • Provides a rich set of flow processing transformations
  47. 47. Reactive Systems Toolkit - Akka • Microservice Systems • Clusters within clusters • System Orchestration Clustering Streams Actors Cluster Features • Reactive Services • Akka & Play Services • Lagom Microservices • Membership • Sharding • Event Sourcing & CQRS • Publish & Subscribe • Distributed Data • Reactive Streams • Akka Streams • Alpakka • Actor Model • Supervision • Routing
  48. 48. Cluster Features Cluster Features - actor systems that span clusters of multiple JVMs
  49. 49. Cluster Features Cluster Membership
  50. 50. Cluster Features Cluster Membership State Diagram of Akka Cluster Member States
  51. 51. Cluster Features Cluster Sharding Send messages to actors distributed across a cluster via logical identifiers
  52. 52. Cluster Features Cluster Sharding
  53. 53. Cluster Features Cluster Sharding
  54. 54. Cluster Features Cluster Sharding
  55. 55. Cluster Features Cluster Sharding
  56. 56. Cluster Features Cluster Sharding
  57. 57. Cluster Features Cluster Sharding
  58. 58. Cluster Features Cluster Sharding
  59. 59. Cluster Features Cluster Sharding
  60. 60. Cluster Features Cluster Sharding
  61. 61. Cluster Features Cluster Sharding
  62. 62. Cluster Features Cluster Sharding
  63. 63. Cluster Features Event Sourcing & CQRS Akka Persistence Akka Persistence Query Cluster Sharding Actor implementation of Event Sourcing & CQRS (Command Query Responsibility Segregation)
  64. 64. Cluster Features Event Sourcing & CQRS Akka Persistence Akka Persistence Query Cluster Sharding
  65. 65. Cluster Features Event Sourcing & CQRS Akka Persistence Akka Persistence Query Cluster Sharding
  66. 66. Cluster Features Event Sourcing & CQRS Akka Persistence Akka Persistence Query Cluster Sharding
  67. 67. Cluster Features Event Sourcing & CQRS Akka Persistence Akka Persistence Query Cluster Sharding
  68. 68. Cluster Features Publish and Subscribe Distributed Publish & Subscribe
  69. 69. Cluster Features Publish and Subscribe
  70. 70. Cluster Features Publish and Subscribe
  71. 71. Cluster Features Publish and Subscribe
  72. 72. Cluster Features Distributed Data Share data between nodes in an Akka Cluster Conflict Free Replicated Data Types (CRDTs)
  73. 73. Cluster Features Distributed Data
  74. 74. Cluster Features Distributed Data
  75. 75. Cluster Features Distributed Data
  76. 76. Cluster Features Distributed Data
  77. 77. Cluster Features Distributed Data
  78. 78. Cluster Features Distributed Data
  79. 79. Cluster Features Summary • Groups of collaborating actors abstract functionality • Cluster aware actors react to cluster state changes • Use out-of-the-box features or create custom features
  80. 80. Reactive Systems Toolkit - Akka • Microservice Systems • Clusters within clusters • System Orchestration Clustering Streams Actors Cluster Features • Reactive Services • Akka & Play Services • Lagom Microservices • Membership • Sharding • Event Sourcing & CQRS • Publish & Subscribe • Distributed Data • Reactive Streams • Akka Streams • Alpakka • Actor Model • Supervision • Routing
  81. 81. Clustering Clustering - strength in numbers
  82. 82. Clustering Reactive Services
  83. 83. Clustering Akka & Play Services
  84. 84. Clustering Lagom Microservices
  85. 85. Clustering Lagom Microservices
  86. 86. Clustering Lagom Microservices Microservice Microservice Microservice
  87. 87. Clustering Summary • Clusters dynamically react to node topology changes • Reactive microservices with Akka, Play, and Lagom
  88. 88. Reactive Systems Toolkit - Akka • Microservice Systems • Clusters within clusters • System Orchestration Clustering Streams Actors Cluster Features • Reactive Services • Akka & Play Services • Lagom Microservices • Membership • Sharding • Event Sourcing & CQRS • Publish & Subscribe • Distributed Data • Reactive Streams • Akka Streams • Alpakka • Actor Model • Supervision • Routing
  89. 89. Reactive Systems Application landscape is now a city of services
  90. 90. Reactive Systems Monoliths, Microliths, Microservices, and Lambdas Built with Akka and Java or Scala
  91. 91. Reactive Systems Clusters within a cluster Towns within a city
  92. 92. Reactive Systems System Orchestration Application Management Network Partition Split Brain Resolution
  93. 93. Reactive Systems System Orchestration Application Management Network Partition Split Brain Resolution
  94. 94. Reactive Systems System Orchestration Akka Telemetry and Monitoring Diagnostic RecorderConfiguration Checker
  95. 95. Reactive Systems Reactive, Cognitive, and Real-time Data-driven Applications Fast Data Platform
  96. 96. Reactive Systems Reactive, Cognitive, and Real-time Data-driven Applications Fast Data Platform
  97. 97. Reactive Systems Reactive, Cognitive, and Real-time Data-driven Applications Fast Data Platform
  98. 98. Reactive Systems Reactive, Cognitive, and Real-time Data-driven Applications Fast Data Platform
  99. 99. Reactive Systems Summary Akka is a toolkit for building highly concurrent, distributed, and resilient message-driven applications for Java and Scala
  100. 100. Reactive Systems Toolkit - Akka • Microservice Systems • Clusters within clusters • System Orchestration Clustering Streams Actors Cluster Features • Reactive Services • Akka & Play Services • Lagom Microservices • Membership • Sharding • Event Sourcing & CQRS • Publish & Subscribe • Distributed Data • Reactive Streams • Akka Streams • Alpakka • Actor Model • Supervision • Routing
  101. 101. Akka Customers
  102. 102. Reactive Systems Toolkit Reactive Programming Toolkit
  103. 103. Upgrade your grey matter!
 Get the free O’Reilly book by Hugh McKee, 
 Developer Advocate at Lightbend https://www.lightbend.com/resources/e-books

×