Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Effective Akka
Preface
Who This Book Is For
What Problems Are We Solving with Akka?
Distributed
Asynchronous
High Performance
Reactive Applications
Use Case for This Book: Banking Service for Account Data
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
1. Actor Application Types
Domain-driven
Domain-driven Messages Are “Facts”
Work Distribution
Routers and Routees
Random
Round robin
Smallest mailbox
Broadcast
ScatterGatherFirstCompletedOf
Consistent hash routing
BalancingDispatcher Will Be Deprecated Soon!
Work Distribution Messages Are “Commands”
2. Patterns of Actor Usage
The Extra Pattern
The Problem
Avoiding Ask
Capturing Context
Sending Yourself a Timeout Message
Why not use a promise?
How to test this logic
The Cameo Pattern
The Companion Object Factory Method
How to Test This Logic
3. Best Practices
Actors Should Do Only One Thing
Single Responsibility Principle
Create Specific Supervisors
Keep the Error Kernel Simple
Failure Zones
Avoid Blocking
Futures Delegation Example
Java futures are blocking!
Pre-defining Parallel Futures
Parallel Futures with the zip() Method
Sequential Futures
Callbacks versus Monadic Handling
Futures and ExecutionContext
Push, Don’t Pull
When You Must Block
Managed Blocking in Scala
Avoid Premature Optimization
Start Simple
Deterministic
Declarative
Immutable
Functional
Layer in Complexity via Indeterminism
Optimize with Mutability
Add mutability with compare and swap (CAS)
Compose CAS with Software Transactional Memory
Add locks as a last resort
Prepare for Race Conditions
Avoid coding in a way where timing matters
Tell, don’t ask
Be Explicit
Name Actors and ActorSystem Instances
Create Specialized Messages
Create Specialized Exceptions
Beware the “Thundering Herd”
Dampen message overload
Use circuit breakers for failure overload
Don’t Expose Actors
Avoid Using this
The Companion Object Factory Method
Never Use Direct References
Don’t Close Over Variables
Use Immutable Messages with Immutable Data
Help Yourself in Production
Make Debugging Easier
Add Metrics
Externalize Business Logic
Use Semantically Useful Logging
Aggregate Your Logs with a Tool Like Flume
Use Unique IDs for Messages
Tune Akka Applications with the Typesafe Console
Fixing Starvation
How do you fix it?
Does PinnedDispatcher help?
Failure zones
Routers
Sizing Dispatchers
The Parallelism-Factor Setting
Actor Mailbox Size
Throughput Setting
Edge Cases
About the Author
Colophon
Copyright
← Prev
Back
Next →
← Prev
Back
Next →