You are responsible for a backend service that processes customer requests, calls several internal APIs, and writes audit events. The team has seen request timeouts, thread exhaustion, and inconsistent latency after adding more parallel work. You need to decide where synchronous execution is still appropriate and where asynchronous execution would reduce risk.
How would you explain the differences between synchronous and asynchronous programming in this system, and how would you choose between them? What trade-offs would you call out around blocking, concurrency, debugging, and failure handling?
You are responsible for a backend service that processes customer requests, calls several internal APIs, and writes audit events. The team has seen request timeouts, thread exhaustion, and inconsistent latency after adding more parallel work. You need to decide where synchronous execution is still appropriate and where asynchronous execution would reduce risk.
How would you explain the differences between synchronous and asynchronous programming in this system, and how would you choose between them? What trade-offs would you call out around blocking, concurrency, debugging, and failure handling?