COMP 310

Synchronous vs. Asynchronous Communications

    Current Home  Java Resources  Eclipse Resources

When communicating between two separated entities, e.g. between machines across a network, there are often two choices on how that communication can be accomplished: 

 

 

Pros

Cons

Synchronous:

  • Simple, intuitive behavior
  • Easy technique for retrieving values from a remote entity.
    • Well-defined behavior: either the value is returned or the system throws an error from excessive waiting.
  • Easy to get transmission status information via the returned value.
  • Relatively easy to maintain state while processing multiple communications operations.
  • Sender and receiver are fundamentally coupled to each other.
    • This coupling reduces the scalability of the system.
    • This reduces the robustness of the system because the performance of one part of the system depends on the performance of another part.
  • Requires blocking of sender's execution thread waiting for remote operation to complete.
    • Can result in degraded system performance on the sender side if the transmission speeds are slow, inconsistent or unreliable.
    • Can effectively be turned into an asynchronous operation by dispatching to another thread to wait for and then finally process the returned value.

Asynchronous:

  • Decouples the sender from the receiver.
    • Communications can be set up as a simple "fire-and-forget" processing.
    • Minimized coupling enables easier scaling of the system.
    • Systems are more robust because the system's separated parts are less dependent on each other.
  • The sender side is unaffected by transmission speed issues.
  • No threading issues on the sender side.
  • Retrieving values from a remote entity requires sending a request message and then setting up a receiving process that the remote entity can use to asynchronously send the requested value back.
    • No guarantee that the requested value will ever be sent.
    • More difficult to get transmission status information because it must be returned via another asynchronous operation and the original message must be referenceable in some manner.
  • Data caching of some sort required to hold state across multiple communications operations.

The choice of communications technique depends on the needs of the system.  For example:

  Typically characterized by: Common communications solution choice:
Small systems
  • High speed communications
  • Lower complexity levels - can tolerate some level of system coupling.
Synchronous
Large systems
  • Low speed communications (relative to small systems)
  • High complexity levels - system decoupling is a high priority.
Asynchronous

 


© 2017 by Stephen Wong