I consider this as probably one of the most difficult and confusing subjects on earth! 😛
When the need arises, I read and understand about synchronous and asynchronous messaging. At the end of the reading, I’m as clear like spring water – I can answer any damn question on this topic. 10-15 days down the line – water starts to get muddier. 1-2 months down the line, I can’t even tell anyone difference between the two!
So, this post is for those, who like me, consider this highly confusing and would like to understand difference between synchronous and asynchronous messaging forever!
Difference Between Synchronous and Asynchronous Messages
Synchronous messaging involves a client that waits for the server to respond to a message. Messages are able to flow in both directions, to and from. Essentially it means that synchronous messaging is a two way communication. i.e. Sender sends a message to receiver and receiver receives this message and gives reply to the sender. Sender will not send another message until it gets a reply from receiver.
Asynchronous messaging involves a client that does not wait for a message from the server. An event is used to trigger a message from a server. So even if the client is down, the messaging will complete successfully. Asynchronous Messaging means that, it is a one way communication and the flow of communication is one way only.
Well, if that is not yet easy to remember, read on..
How to remember the difference between Synchronous and Asynchronous messages
This is how I’ve come to remember the difference between synchronous and asynchronous messages:
Asynchronous: Asynchronous starts with A. A is the first letter of the character set and the only way possible is to go towards Z, which means a one way communication.
Synchronous: Synchronous starts with S. From S, it is possible is to go towards either A or Z, which means a two way communication.
Advantages and Disadvantages of Synchronous vs Asynchronous Messaging
There are some key advantages to asynchronous messaging. They enable flexibility and offer higher availability – There’s less pressure on the system to act on the information or immediately respond in some way. Also, one system being down does not impact the other system. For example, emails – you can send thousands of emails to your friend without her having to revert back to you.
The drawbacks of asynchronous collaboration are that they can lack a sense of immediacy. There’s less immediate interaction. Think about doing a chat with your friend on an instant messenger or over phone – it isn’t a chat or a conversation unless your friend is replying back to you promptly.
Asynchronous message passing allows more parallelism. Since a process does not block, it can do some computation while the message is in transit. In the case of receive, this means a process can express its interest in receving messages on multiple ports simultaneously.
Asynchronous message passing introduces several problems. What happens if a message cannot be delivered? What if the message was lost in the transmission?
Another problem related to asynchronous message passing has to do with buffering. If messages sent asynchronously are buffered in a space managed by the OS, then a process may fill this space by flooding the system with a large number of messages.
Which one is better – Synchronous or Asynchronous?
There isn’t an answer for this question. For many organizations, asynchronous and synchronous messaging will each prove valuable in their own way. There are situations where one will work but the other one won’t. As for PeopleSoft – both synchronous and asynchronous messages are used.