402361 (3) [Avatar] Offline
#1
Hi

I read through the whole book and I have the following concern:

Akka scalability and clusters rely heavily on messages between actors. The book, on the other hand, advises to favor streams and Futures whenever possible, but streams don't play well with clusters in terms of backpressure. Moreover, the book carefully selects a problem that works well with reactive streams, while the domain of personal banking doesn't really do.
So how can I gain the goodness of backpressure, functional programming, type and compatibility and leverage Akka clusters to scale the AccountService (for example) over multiple nodes?

In the same context, the use of Future over Actor sounds a sound tradeoff, but Future runs on a single machine, while Actor is location transparent

I hope the author can clarify how pieces fit together to build an elastically scalable system that leverages the power of Akka clusters or something similar without compromising FP principles

Thanks
Mutaz
Debasish Ghosh (111) [Avatar] Offline
#2
Hello Mutaz -

At the very outset let me congratulate you for reading the whole book .. Now to your concern ..

I have mentioned in the book that functional programming principles don't play well with distributed systems at the context boundaries. There are some research works going on, but we don't have any standard stable alternative. So we need to accept that types break down at the context boundaries. And messaging provides the right abstraction there. So while architecting I suggest the following principles ..

1. Within a context boundary assuming no distribution is involved, use FP to the max
2. Within the context boundary assuming no distribution is involved, prefer abstractions like Future / Task since they are algebraic structures.
3. When you cross the boundaries use messages, which can be in the form of actors (think Akka). Because when you have distribution coming into play you need to be asynchronous. This helps you with backpressure management as well.

Let me know if you need more details on this.

Thanks.