Consensus and inter-canister calls

The interesting scenario for me is: user calls canister A, which calls (passes a message and awaits a reply from) canister B1 and B2 and B3, each of which in turn calls canister C1, C2, C3. Maybe layer B is structured storage and C is an underlying database. The pattern is not uncommon in internet apps and the 2 layers with 3x fanout in this example is small.

Assume they’re all update calls so require consensus. The overall user-facing transaction is not complete until all these call-and-responses have completed.

To make the math easy assume blocks complete in 3s. (Although that number seems optimistic to me, for subnet-wide consensus across multiple DCs, running arbitrary user code, with all the apparent sources of variability.)

Now does this take:

  • Also in 3s, because everything happens inside a single block?
  • In 9s, because the messages from A to B are processed inside the next block, so 3 rounds total?
  • Actually in 18s because there are 6 layers of messages counting the replies?
  • Actually even more than 18s because some messages might miss out on being processed in the immediately next block and so have to wait longer, with compounding effects?

Even at 3s I agree with ohmi that this is going to be unacceptable for many applications, and extremely uncompetitive with alternative infrastructure. And at 18s it’s obviously ridiculous.

I understand this to mean you’re aiming to complete all of A, B123 and C123 within a single input batch, but it’s not required. Any messages that you run out of time or space to process will wait for the next block. So it seems like in the best case, it will be 3s, but probably variability in the system will commonly cause end-to-end latency to be much higher. If the message to B2 is late, then you’re at 6s. If in addition the message to C2 is late, 9s. If the reply from B2 to A is also delayed, 12s…

Dominic has written elsewhere that people have already written high-performance scaled out systems on the IC, but all the examples/demos I see are pretty simple and almost-stateless. Are there any benchmarks or demonstrations showing low latency for multi-tier systems?

1 Like