richardimaoka / akka-learn

1 stars 0 forks source link

BackOff Supervisor #5

Open richardimaoka opened 7 years ago

richardimaoka commented 7 years ago

Break down to multiple issues / articles

richardimaoka commented 7 years ago

Summary:

Write these at the end? (as it will be giving too much info to beginners)

Note: implementation details can change so don't go in too much

BackoffSupervisor - companion obj with different factory methods

Note that these factory methods accepts childProps i.e. child actor definition as a parameter.

Also this companion object defines...:

HandleBackoff - trait having message-sending implementation with Backoff algorithm


BackoffOptions - a companion to create Backoff "Options" to be passed to BackoffSupervisor factory metods (i.e. def props)

Note that these factory methods accepts childProps i.e. child actor definition as a parameter.


BackoffSupervisor actually has two concrete classes - it's confusing but in two separate files:

These two classes are instantiated as follows, when creating backoff options:

Then, BackoffOptionsImpl -> def props = { backoffType match { ... } } (this is too much implementation detail, so you might not want to go into this in the article)

richardimaoka commented 7 years ago

What is...

Pic to illustrate restart with back off Link to actor lifecycle Pic to illustrate exponential interval

why

Normal situation, ask and reply -> vine to illustrate

When target fails, DB down, web server down

Retry ... sometimes it works ok (slow target), sometimes not

Typical configuration, or hard coding ... pseudo code to specify reply

Problem ... slowness could be resolved by quicker retries However, 1000s of clients doing quick retries... target slowed down by retries

Conclusion, retry interval to change over time