February 2018
Intermediate to advanced
552 pages
13h 46m
English
It's not a good practice the sequentialize the Future calls as shown in the following code snippet:
for{ a <- obj1.getSomeThing() b <- obj2.getRest()} yield(a, b)
Here, let's assume that both obj1.getSomeThing() and obj1.getSomeThing() make calls to external systems or remote Rest APIs and then return Futures. If we sequentialize them as shown in the preceding code snippet, we don't get benefits. Then our system will lose performance because we are not making those two calls parallel. To improve our system performance, we should use the following technique:
val aa = obj1.getSomeThing()val bb = obj2.getRest()for{ a <- aa b <- bb} yield(a, b)
Here we are making calls to those two external API parallel so that our ...
Read now
Unlock full access