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.
Actors, Microservices…
Rotem Hermon
@margolis20
Can two walk
together?
Actors?
Concurrency
Multithreading
The problem with multi-threaded concurrency
• Shared memory and state
• Race conditions
• Locks and deadlocks
• Blocking c...
The Actor Model
• Formalized in 1973 (Carl Hewitt)
• Concurrency by Message Passing
• Avoids problems of threading and loc...
An Actor
• Lightweight
• Never shares state
• Communicates through asynchronous messages
• Mailbox buffers incoming messag...
An Actor
• Lightweight
• Never shares state
• Communicates through asynchronous messages
• Mailbox buffers incoming messag...
The Actor Model
• Higher abstraction level
• Simpler concurrent programming model
• Write single-threaded code (easier to ...
Distributed
Concurrency
Virtual Actors
• A simplified Actors implementation with a higher abstraction
level
• Introduced by Microsoft Research – P...
Virtual Actors
• Goals:
• Make distributed application programming easier
• Prefer developer productivity and transparent ...
Virtual Actors
• A Virtual Actor:
always exists
and
never fails
Virtual Actors
Actor types:
• Worker
• An auto-scaling processing unit – multiple instances created by
framework as needed
Virtual Actors
Actor types:
• Single Activation
• Guaranteed to have a single active instance in the cluster
Virtual Actors
Actor types:
• Single Activation
• Guaranteed to have a single active instance in the cluster
• A Stateful ...
A Short Example…
URL Shortener Service
• Shorten (URI)
• Expand (ShortURI)
A Short Example…
URL Shortener Service
The Classic way
shrt.uri
Stateless
Service
DB
Cache
Fetch from DB
Set in Cache
Expa...
A Short Example…
URL Shortener Service
The Virtual Actor way
shrt.uri
Expand
Return URL
Virtual Actors Service
Worker URLA...
A Short Example…
URL Shortener Service
The Virtual Actor way
shrt.uri
Expand
Return URL
Virtual Actors Service
Worker URLA...
A Short Example…
URL Shortener Service
The Virtual Actor way
shrt.uri
Expand
Return URL
Virtual Actors Service
Worker URLA...
Virtual Actor Framework
• A runtime providing virtual “actor space”, analogues to
virtual memory
• Handles Actor placement...
Simplified Programming Model
• An Actor is a class, implementing an interface with
asynchronous methods
• The caller of an...
Simplified Programming Model
Simplified Programming Model
(Actors are actually
Nanoservices)
A single Actors universe?
Back to microservices
Actor based microservices
Service A
Service B
ServiceB
Interface
Actor
IMyServiceB
Actor based microservices
Service A
Service B
ServiceB
Interface
Actor
IMyServiceB
ServiceB
HTTP
Listener
Actor based microservices
Service A
Service B
ServiceB
Interface
Actor
IMyServiceB
ServiceB
Client
ServiceB
HTTP
Listener
...
Thank You!
Rotem Hermon
@margolis20
VP Architecture @ Gigya
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
Upcoming SlideShare
Loading in …5
×

of

Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 1 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 2 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 3 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 4 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 5 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 6 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 7 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 8 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 9 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 10 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 11 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 12 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 13 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 14 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 15 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 16 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 17 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 18 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 19 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 20 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 21 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 22 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 23 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 24 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 25 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 26 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 27 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 28 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 29 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 30 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 31 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 32 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 33 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 34 Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya Slide 35
Upcoming SlideShare
What to Upload to SlideShare
Next
Download to read offline and view in fullscreen.

2 Likes

Share

Download to read offline

Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya

Download to read offline

As presented in Codemotion Tel Aviv 2017
http://telaviv2017.codemotionworld.com

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya

  1. 1. Actors, Microservices… Rotem Hermon @margolis20 Can two walk together?
  2. 2. Actors?
  3. 3. Concurrency
  4. 4. Multithreading
  5. 5. The problem with multi-threaded concurrency • Shared memory and state • Race conditions • Locks and deadlocks • Blocking calls • Hard to understand and maintain • Not easily distributed
  6. 6. The Actor Model • Formalized in 1973 (Carl Hewitt) • Concurrency by Message Passing • Avoids problems of threading and locking
  7. 7. An Actor • Lightweight • Never shares state • Communicates through asynchronous messages • Mailbox buffers incoming messages • Processes one message at a time
  8. 8. An Actor • Lightweight • Never shares state • Communicates through asynchronous messages • Mailbox buffers incoming messages • Processes one message at a time • Single threaded
  9. 9. The Actor Model • Higher abstraction level • Simpler concurrent programming model • Write single-threaded code (easier to understand) • Concurrency and scale via actor instances • Maximizes CPU utilization • Easy to distribute
  10. 10. Distributed Concurrency
  11. 11. Virtual Actors • A simplified Actors implementation with a higher abstraction level • Introduced by Microsoft Research – Project Orleans • A port to Java – Orbit (by EA)
  12. 12. Virtual Actors • Goals: • Make distributed application programming easier • Prefer developer productivity and transparent scalability • “A programming model and runtime for building cloud native services”
  13. 13. Virtual Actors • A Virtual Actor: always exists and never fails
  14. 14. Virtual Actors Actor types: • Worker • An auto-scaling processing unit – multiple instances created by framework as needed
  15. 15. Virtual Actors Actor types: • Single Activation • Guaranteed to have a single active instance in the cluster
  16. 16. Virtual Actors Actor types: • Single Activation • Guaranteed to have a single active instance in the cluster • A Stateful application middle-tier!
  17. 17. A Short Example… URL Shortener Service • Shorten (URI) • Expand (ShortURI)
  18. 18. A Short Example… URL Shortener Service The Classic way shrt.uri Stateless Service DB Cache Fetch from DB Set in Cache Expand Return URL Get From Cache
  19. 19. A Short Example… URL Shortener Service The Virtual Actor way shrt.uri Expand Return URL Virtual Actors Service Worker URLActor (“shrt.uri”) “URL” DB Fetch from DB
  20. 20. A Short Example… URL Shortener Service The Virtual Actor way shrt.uri Expand Return URL Virtual Actors Service Worker URLActor (“shrt.uri”) “URL”
  21. 21. A Short Example… URL Shortener Service The Virtual Actor way shrt.uri Expand Return URL Virtual Actors Service Worker URLActor (“shrt.uri”) “URL” And logic!
  22. 22. Virtual Actor Framework • A runtime providing virtual “actor space”, analogues to virtual memory • Handles Actor placement, activation and GC when needed • Balances resources across the cluster, provides elastic scalability
  23. 23. Simplified Programming Model • An Actor is a class, implementing an interface with asynchronous methods • The caller of an Actor uses the actor interface via a proxy • Messaging is transparent and handled by the runtime. Programmers deal with interfaces and methods
  24. 24. Simplified Programming Model
  25. 25. Simplified Programming Model
  26. 26. (Actors are actually Nanoservices)
  27. 27. A single Actors universe?
  28. 28. Back to microservices
  29. 29. Actor based microservices Service A Service B ServiceB Interface Actor IMyServiceB
  30. 30. Actor based microservices Service A Service B ServiceB Interface Actor IMyServiceB ServiceB HTTP Listener
  31. 31. Actor based microservices Service A Service B ServiceB Interface Actor IMyServiceB ServiceB Client ServiceB HTTP Listener JSON over HTTP
  32. 32. Thank You! Rotem Hermon @margolis20 VP Architecture @ Gigya
  • veribir

    Nov. 21, 2017
  • kimhyunseung16

    May. 22, 2017

As presented in Codemotion Tel Aviv 2017 http://telaviv2017.codemotionworld.com

Views

Total views

243

On Slideshare

0

From embeds

0

Number of embeds

1

Actions

Downloads

6

Shares

0

Comments

0

Likes

2

×