About dividing into subproblems for akka actor model using scala

Chen Chen

I am doing a project involving finding a suffix string given a prefix --for instance, "aaa", so that that its hashed value (SHA256) has a certain pattern -- for example, starting with "123".

My method of finding the required hash key is to generate the suffix string in an ordered way: first try all the string with one character -- basically it goes through the ASCII printable code chart, 95 trials in total. If the required hash key is not found, then try all the string with two characters (95*95 trails)... and so on so forth.

I am also required to use akka actor model to let multiple actors get involved in solving this problem concurrently. (The number of actors is an input)

Any idea about how to efficiently divide the total problem to multiple actors using this pattern? Or anyone has a better solution to this problem?

Zim-Zam O'Pootertoot

You can group your workers under a BalancingPool which will automatically distribute work to idle actors, with the manager and worker actors using work pulling to prevent the mailbox from growing too large.

  1. The manager accepts two message types: work-request and work-complete. Work-request is called by a worker when it has completed X tasks (where X is, say, 10), signalling the manager to add X more tasks to the BalancingPool. Work-complete is called when a worker has found an appropriate string prefix, at which point the manager sends out a stop command to the BalancingPool instructing it to immediately terminate and to also terminate its workers. Aside from this, the manager is responsible for initially filling the BalancingPool with sufficient prefixes for the workers to test (say, 20 * workerCount), and refilling the pool every time it receives a work-request message.
  2. The workers accept one message type: test-prefix, which contains a string prefix for the worker to test. It also needs to maintain a count of messages that it has received and processed, and when this count reaches X then it is zeroed and the worker sends a work-request message to the manager.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Reader Writer Lock using Actor Model in Akka

From Dev

Is Akka real actor model?

From Dev

Canonical Example of how to test Akka Actor using Scala in Play Framework

From Dev

Check if a Scala / Akka actor is terminated

From Dev

Scala/Akka NullPointerException on master actor

From Dev

Scala, library akka.actor

From Dev

Where I can find akka actor model in default scala-lib?

From Dev

Housing the DAO layer inside a Scala Akka Actor

From Dev

How to test that Akka actor was created in Scala

From Dev

Access an immutable member outside of an actor in akka/scala

From Dev

Global variable within akka actor system in Scala

From Dev

How to implement actor model without Akka?

From Dev

scala syntax understanding about loop and receive in actor

From Dev

Akka Actor hotswapping using rest api

From Dev

Akka Actor testing with ScalaTest using Testkit EventListeners

From Dev

Using future callback inside akka actor

From Dev

Using future callback inside akka actor

From Dev

Akka Actor hotswapping using rest api

From Dev

How to run a daemon forever using Akka Actor?

From Dev

What are the dangers of using an object as an AKKA actor?

From Dev

Initializing an akka actor using Akka-IO TCP

From Dev

Initializing an akka actor using Akka-IO TCP

From Dev

Akka Stream and HTTP Scala: How to send Messages to an Actor from a Route

From Dev

Scala, Play, Akka, Websocket: how to pass actor messages through websocket

From Dev

How to initialise a scala/akka Actor in an event driven architecture?

From Dev

Akka Scala actor scheduled message does not appear to fire

From Dev

Akka Can't Create Remote Actor Dynamically: Scala

From Dev

Scala, Akka, Child Actor Why "discarded non-Unit value"?

From Dev

Stop an Akka Actor inside Actor

Related Related

  1. 1

    Reader Writer Lock using Actor Model in Akka

  2. 2

    Is Akka real actor model?

  3. 3

    Canonical Example of how to test Akka Actor using Scala in Play Framework

  4. 4

    Check if a Scala / Akka actor is terminated

  5. 5

    Scala/Akka NullPointerException on master actor

  6. 6

    Scala, library akka.actor

  7. 7

    Where I can find akka actor model in default scala-lib?

  8. 8

    Housing the DAO layer inside a Scala Akka Actor

  9. 9

    How to test that Akka actor was created in Scala

  10. 10

    Access an immutable member outside of an actor in akka/scala

  11. 11

    Global variable within akka actor system in Scala

  12. 12

    How to implement actor model without Akka?

  13. 13

    scala syntax understanding about loop and receive in actor

  14. 14

    Akka Actor hotswapping using rest api

  15. 15

    Akka Actor testing with ScalaTest using Testkit EventListeners

  16. 16

    Using future callback inside akka actor

  17. 17

    Using future callback inside akka actor

  18. 18

    Akka Actor hotswapping using rest api

  19. 19

    How to run a daemon forever using Akka Actor?

  20. 20

    What are the dangers of using an object as an AKKA actor?

  21. 21

    Initializing an akka actor using Akka-IO TCP

  22. 22

    Initializing an akka actor using Akka-IO TCP

  23. 23

    Akka Stream and HTTP Scala: How to send Messages to an Actor from a Route

  24. 24

    Scala, Play, Akka, Websocket: how to pass actor messages through websocket

  25. 25

    How to initialise a scala/akka Actor in an event driven architecture?

  26. 26

    Akka Scala actor scheduled message does not appear to fire

  27. 27

    Akka Can't Create Remote Actor Dynamically: Scala

  28. 28

    Scala, Akka, Child Actor Why "discarded non-Unit value"?

  29. 29

    Stop an Akka Actor inside Actor

HotTag

Archive