member login

WebServices dot org

Todays Featured Content:

Active Endpoints Announces ActiveVOS 6.0

Latest Release of Visual Orchestration System Delivers All-In-One Capabilities that Enable the Next Generation of Business Process Applications

Active Endpoints To Sponsor BriefingsDirect Analyst Insights Podcast Series

Bi-monthly Podcast Series Featuring Noted Industry Analysts to Deliver Insights to Users of Enterprise and Middleware Software

Fastenal to Improve Customer Service, Expand Globally with ActiveVOS

New SOA applications created with visual orchestration system key to international growth

Case Study: Synovus Financial Corp

6 vendor consultants to 1 internal architect. Months to days. See how Synovus Financial Corp. uses ActiveVOS to quickly complete their orchestration project.

Synovus Financial Wins SOA Case Study Competition

"Yesterday, the SOA Consortium announced that long-time Active Endpoints customer Synovus Financial won its prestigious case study competition . Everyone here at Active Endpoints wants to congratulate the Synovus team for their impressive achievement. And we also want to thank them for being a long-time customer and using ActiveVOS as the foundation for the web services used in their winning entry."...

The R.O.I. of Composite Applications

SOA and composite applications hold out the promise for ease of use and lower training costs, lower cost of deployment, faster time to market, improved business requirement matching and better multi-channel deployment.
Learn more in this white paper.

Featured Content provided by Active Endpoints

Async

8th May 05:

There are well-known trade-offs between synchronous and asynchronous messaging. The trade-offs roughly mean a choice between coupling in time versus coupling in space.

In synchronous messaging, resources are dedicated in one party while the other party and/or network are processing the message. The classic is obviously request-response where the client keeps a connection open, and probably a thread for the connection, while waiting for the response. These two systems are coupled in time.

Asynchrony relaxes the coupling in time but adds a coupling in space. In asynchronous messaging, the message sender devotes fewer resources to the message exchange pattern. The simplest is a one-way message, where the sender puts the message into the transport and continues. Request-response is often layered onto asynchronous messaging by using of a "callback", sometimes called asynchronous request-response. A request contains an address for the receiver to send a message to.

There is further coupling in space because the state of the system is spread across two machines. To re-use the resources on the sender, the "state" of the sender must somehow be passivated, so that it can be reified when the response comes back. The correct instance of state on the server, often called correlation, must also be identifiable from the response message. The protocol between the two systems must necessarily be more complicated for asynchrony, because it requires the correlation between messages and/or instances to be in the messages. FWIW, these correlations are why WS-Addressing has MessageIds, RelatesTo and Reference Parameters.

The trade-off between coupling in space and time is that the resources that are used for synchronous communications, such as socket connections, program and cpu threads, may be inefficiently allocated. Asynch allows the sender to free up these resources for other tasks. While there are resources that must be allocated for waiting for the callback (such as waiting for an inbound connection) and there is an increase in the complexity of the protocol (adding in correlation) and sender machinery (passivating and reifining state), these are often less than the synchronous resources. In situations where the resources are not effectively used, asynchrony increases the scalability and performance of applications.

When Asynch

The next question is when to use Asychronous versus Synchronous communications. As with all trade-offs, there are no hard and fast rules. Clearly communications that will take hours or days to answer are strong candidates for asynchrony. But how many minutes or seconds would suggest using asynch? Most web sites have a guideline that a web page must respond within 30 seconds. Perhaps this is a good guideline for the line between synchronous and asynchronous.

Callback specs

If you believe that Asynchrony is a vital component in building scalable distributable systems and you are using Web services, then SOAP and a few other WS-* specs provide the prerequisite infrastructure. WS-Addressing is probably the core specification for asynchrony, it's likely to be very widely deployed. BEA poineered and shipped a couple of predecessors in SOAP-Conversation and WS-Callback , and WS-I specified a basic Callback scenario . Additional specifications that layer on top are WS-Eventing (PDF) and WS-Notification . I don't want to get into the obviousness of the political nature of why there isn't a single notification spec that has publish,subscribe,renew, terminate and pause/continue messages.

Polling

Another style of asynch uses "polling" rather than "callbacks". This avoids the opening up of the sender's address space, but causes increased complexity on both sender and receiver, inefficient message flow (as polls are often wasted) and potentially tardy responses. We have few WS-* specs in this area. I think a very intriguing possibility for polling is the use of blogging or RSS/Atom. Imagine using blogging for publish and subscribe.

Who specifies

A final aspect of Asynch worth speaking about is who decides whether a request is synchronous or asynchronous. There are only 2 choices: either the sender decides or the receiver decides. There is no clear answer.. In cases where the sender can't do asynch, it would obviously prefer to do synchronous comm. And in the same manner, if the receiver knows that the communication will take a long time, it will prefer async. WS-Addressing using a model where a receiver allows sender-specified. The sender will specify a callback by the presence of a non-anonymous value in the ReplyTo field.

Conlusion

Asynchrony is a powerful tool in building distributed systems. This article has provided some technical explanation of the tradeoffs between synchronous and asynchronous, when async can be applied, comparison of the callback and polling styles, and the specifications like WS-Addressing that can be used for asynch.


Trackback URL for this post: http://www.webservices.org/trackback/id/5763

Comments

That State Thing

Hi Dave,

Just wanted to ask about the statefulness of the sender in respect of processing a "callback".

If I arrange for the state necessary to do the work against the response to be in the response itself, does that hinder or help?

If I do put the state into the response, does the problem then reduce to just needing an endpoint to push the response to? Or was the need for an endpoint the thing you saw exerting the requirement for statefulness at the sender?