Introduction to Akka

3,646 views

Published on

The topconf 2013 introduction to actors with Akka

0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,646
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
146
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Introduction to Akka

  1. 1. An introduction to Actors Akka with Johan Andrén johan.andren@mejsla.se | @apnylle
  2. 2. Moores law 2,6 billions 1 million 2300 1971 1990 today
  3. 3. Oh, No Problems!
  4. 4. Oh No, Problems! • • • • • • Race conditions Data corruption Deadlocks Thread contention Livelocks Priority Inversion
  5. 5. Concurrency is HARD • • • • To write To test To debug To reason about We need a better model!
  6. 6. B C D A F E
  7. 7. event driven systems with ACTORS
  8. 8. State Inbox The only way to interact from outside Behaviour
  9. 9. • • • • • Single execution flow model No shared _mutable_ state Lightweight Loose coupling Easy to test
  10. 10. Actor A Actor B
  11. 11. One way communication Actor A Actor B
  12. 12. React, don’t wait Actor A Actor B
  13. 13. Load balancing Actor A Actor B1 router Actor B2
  14. 14. Pipe/Filter Actor A Actor F (filter) Actor B
  15. 15. Parallellize Actor C1 Actor A Actor B (chef) Actor C2 Actor C2
  16. 16. • • • No work, no thread used! Async - never actively wait Loose coupling
  17. 17. JVM B C D A F E
  18. 18. JVM 1 B C JVM 2 D A F E
  19. 19. The same same • • • Two actors on one core Two actors on separate cores Two actors on separate servers
  20. 20. Error handling in Actor systems
  21. 21. Traditional model • • • Leaking information between tiers Impossible to detect simultaneous errors The receiver does not know how to handle the errors!
  22. 22. Error handling with Actors (parent) Actor A Actor X Actor Z
  23. 23. Error handling with Actors (parent) Actor A Actor X Actor Z
  24. 24. Error handling with Actors Actor A Actor X Actor Z
  25. 25. ”Supervision” • • • • Compartmentilization What goes back is explicit Separating error handling and business logic Can detect simultaneous errors
  26. 26. But Wait, there is more! • • • • • STM Remoting Clustring with no SPoF MQs integration Eventbus Website: akka.io
  27. 27. Try it out! Typesafe Activator typesafe.com
  28. 28. Recap • • • • Simple but powerful model Lightweight and fast Loose coupling Resiliency Johan Andrén johan.andren@mejsla.se | @apnylle
  29. 29. Questions? Johan Andrén johan.andren@mejsla.se | @apnylle

×