AlgoViz

Synchronous communication

easy 24 min

In synchronous communication the caller sends a request and needs the response before that piece of work can go on.

Remember it

The few things worth knowing cold, and how to make them stick.

Memory hook

SYNC BLOCKS: Send, Yield your turn, No other work, Complete response.

A phone call in the middle of homework. Until the other side answers, you hold the phone and the page stays empty.

Cheat sheet

Chain latency
sum
Parallel latency
slowest
Chain availability
product
Busy threads
arrivals x seconds
Patterns
direct, gateway, chain, aggregator
Good for
login, search, validation, card approval
Not for
email, reports, images, analytics
Protect with
timeout, bulkhead, breaker, fallback

Spot it when you see

  • A person is waiting for the result.
  • The next step needs the answer.
  • Errors must be shown at once.
  • The work is short.

Tricks that stick

  • B is for blocking I/O, L is for latency adds up, O is for one at a time, CKS: check the result, know the error, then success.
  • Need the answer now? Synchronous. If not, consider a queue.
  • Full pool with steady traffic: look downstream.

Do not forget

  • No timeout.
  • Deep chains.
  • Sequential calls that could be parallel.
  • Adding P99 values.
  • Believing two calls are a transaction.