Synchronous vs. asynchronous communication: The differences

While asynchronous communications does not wait around for a reply, synchronous execution requires parties or components to work simultaneously in real time.

It's important to understand the differences between synchronous vs. asynchronous communication and how these communication...

types apply to program execution and systems design. Let's start with an easy-to-understand example and then look further into the details.

Synchronous vs. asynchronous communication

In synchronous communication multiple parties are participating at the same time and wait for replies from each other. One way to visualize the concept of synchronous communications is to imagine a real-time online chat session in which you exchange messages with a live customer support specialist to get help for your broken toaster oven.

Before message exchange in this synchronous scenario can begin, the sender and receiver must establish a communications session and agree which party is going to be in control. Once the session is established, the two-way, give-and-take conversation occurs in actual time. When you type and send a chat message, the party at the other end is present and actively waiting to receive or hear your message and then immediately respond to it. Both parties are working together at the same time with their clocks in lockstep (time zone differences notwithstanding) -- in other words, synchronized.

Asynchronous communication is different. For example, it occurs when that toaster oven manufacturer doesn't offer real-time chat, forcing you instead to send an email message to a company's tech support department. The recipient is neither expecting nor waiting for an incoming message and therefore may not get to it right away.

Consequently, a delay -- perhaps a day or two -- can occur before the company gets around to sending a reply. A similar example based on snail mail would likely take even longer: days for the message to be sent and received, more time to create and send a reply, and several more days for that reply to be delivered to you. The two parties are not working together in real time and may even be unaware of each other. Their efforts are not synchronized with each other and are therefore said to be asynchronous.

The same principles apply to execution of program code, although the time span in these cases is generally in milliseconds rather than days.

Synchronous vs. asynchronous execution

As an application runs, it may generate a message or make a call to a function, microservice or API. In a synchronous execution design, that software sits idle and performs no further action until it receives a return message, value or other data. A common example of synchronous execution occurs when using an app to purchase a product online and the system generates a query to determine if adequate inventory is available. The app waits for a response before allowing you place the order.

Conversely, code that continues to run after generating a message or call is in an asynchronous execution mode. Simple examples of asynchronous execution are a printer's embedded software sending out a low-toner alert while continuing to print or a manufacturing application that monitors an industrial furnace and continually sends out messages that report the temperature. In this case, it would be up to other programming logic to take action when reported temperatures fall below or rise above a predefined acceptable range.

Synchronous vs. asynchronous methods each have potential benefits and drawbacks.

Synchronous vs. asynchronous methids

Other issues and challenges

In a research first published in 1992 and updated in 2002, two researchers noted that "clock skew is recognized as a key factor for the performance of synchronous systems." This phenomenon can cause problems in densely designed systems and computer chips when a signal arrives at different components at different times.

Remote synchronous replication dictates that read-and-write operations occur in perfect lockstep.

Consequently, a key challenge in asynchronous execution is ensuring that the clocks of all participants and constituent components or modules remain synchronized. For human interaction, such as a live chat session, such skew is not important. However, in synchronous execution, read-and-write storage operations are likely to occur milliseconds (or less) apart, so proper clock synchronization is essential in guaranteeing that I/O operations occur in the correct order.

Another challenge is the need to correlate multiple data streams that encompass both synchronous and asynchronous collection methods. Especially acute in the area of data mining and streaming analytics, dealing with this issue through the technique of singular value decomposition was examined in research first published in 2002.

With the advent of cloud computing and the ensuing desire to move both primary data storage and backup services off premises, a new challenge has appeared. Remote synchronous replication dictates that read-and-write operations occur in perfect lockstep to the primary data storage location as well the data backup location.

Next Steps

Is asynchronous video a prescription for good health?

Learn how to support asynchronous and synchronous Web services using J2EE

Discover the pros of asynchronous replication

This was last published in October 2016

Dig Deeper on Service-oriented architecture (SOA) orchestration

PRO+

Content

Find more PRO+ content and other member only offers, here.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

In what application-development scenarios did you resort to either synchronous or asynchronous programming logic?
Cancel

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close