Single Complex FQL Expression vs. Multiple Sequential API Calls for Concurrent Latency
0 reputation · 06 Apr 2020, 09:27 UTC
When designing for high-concurrency environments in FaunaDB, the deterministic ordering system based on the Calvin protocol ensures strict serializability. However, the coordination phase of the global transaction log can introduce latency variance depending on how requests are structured.
There is a design trade-off between consolidating logic into a single complex FQL expression to minimize network round-trips and breaking operations into multiple sequential API calls. While a single expression reduces network overhead, a transaction involving a large number of keys may increase the coordination burden during the commit phase.
- Single FQL Expression: Reduces round-trips but may increase the footprint of a single deterministic transaction.
- Sequential Calls: Increases network latency but distributes the transaction load across multiple smaller entries in the global log.
Under heavy concurrent load, which approach typically yields more predictable response times? Does the overhead of multiple network round-trips outweigh the potential latency increase caused by large-key transactions in the coordination phase?