Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Akka dotnet presentation ndc 2017

232 views

Published on

The slides for my presentation at NDC Oslo 2017 about building a near real time system with Akka.NET, React and Redux.

Published in: Software
  • Be the first to comment

Akka dotnet presentation ndc 2017

  1. 1. GETTING REAL(TIME) WITH AKKA.NET, REACT AND REDUX Francis Paulin paulinfrancis@gmail.com @paulin_francis github.com/paulinfrancis
  2. 2. SOME STATEMENTS • Distributed systems are hard • Writing applications that can scale on demand is hard • Threading and shared state can be a total nightmare
  3. 3. http://getakka.net/
  4. 4. THE REACTIVE MANIFESTO http://www.reactivemanifesto.org/ Responsive (React to users) Message-driven (React to messages) Elastic (React to load) Resilient (React to failures)
  5. 5. WHAT IS THE ACTOR MODEL? • A conceptual model to deal with concurrent computation • A method of concurrency in which the universal primitive is an actor
  6. 6. WHAT IS AN ACTOR • «Anything» can be an actor • An actor is persistent (not like a thread) • Actors can have internal state • Has an address • An actor has a mailbox
  7. 7. WHAT CAN ACTORS DO? • Actors react to messages sent to the mailbox • An actor can send messages to other actors (and itself) • Create new actors • Decide what to do with the next message (behaviours)
  8. 8. SOME VERY IMPORTANT PRINCIPLES • Observe single responsibility principle • Only interact with an actor through messages • Exactly one message is processed at once • Messages must be immutable
  9. 9. ACTOR HIERARCHY • All actors have a parent that supervises them • An actor can send a message to any actor, independent of the hierarchy • Let children do dangerous things
  10. 10. ACTOR SUPERVISION / ERROR KERNEL http://getakka.net/docs/images/ErrorKernel.png
  11. 11. CREATING AN ACTOR SYSTEM
  12. 12. NON-ACTOR CODE THAT IS NOT SAFE
  13. 13. NON-ACTOR CODE WITH LOCK
  14. 14. ACTOR CODE WITHOUT LOCKS
  15. 15. CREATING ACTORS
  16. 16. ACTOR ADDRESSES • May be to a specific actor • Could also be to a load balancer/proxy • akka://DemoActorSystem/user/ClientBridge • Provides us with location transparency
  17. 17. SENDING MESSAGES • Tell vs. Ask
  18. 18. PARENTS KNOW ABOUT CHILDREN Parent Child 2Child 1
  19. 19. LIMIT KNOWLEDGE BETWEEN COUSINS Parent Child 2Child 1 Cousin 2Cousin 1
  20. 20. ACTOR LIFECYCLE HOOKS http://getakka.net/docs/working-with-actors/Actor%20lifecycle
  21. 21. SWITCHABLE BEHAVIOUR
  22. 22. REMOTING • Actor selection by address of actor on remote machine • TLS in akka 1.2 • Serializable messages • Clustering
  23. 23. Demo
  24. 24. WHEN TO USE ACTORS & WHAT HAVE WE LEARNED? • Processing pipelines • Multi-user concurrency (actor per user) • Systems with requirements to stay available • Systems designed to scale horisontally
  25. 25. RESOURCES • https://gitter.im/akkadotnet/akka.net • https://petabridge.com/bootcamp/ • http://bartoszsypytkowski.com/ • https://github.com/paulinfrancis/akka-ndc-2017 (code for the demo) • Pluralsight courses

×