Here is another SOA pattern from the list of patterns I am publishing.


One of the core goals of going with SOA is to enable loose coupling. The request-reply communication pattern, which is very prevalent, inhibits this decoupling. The problem is for the caller or consumer of the service - the consumer service is dependant on the timely response of the called service for its normal operations. To help elevate the consequences of this dependency the service that is consumed should maintain QOS (Quality of Service) as part of its contract (it doesn't have to be part of the machine-readable contract but it needs to be defined and adhered to). Consider for example an on-line music store. On a normal business day that can have few thousands of purchases nicely distributed around the clock. And then when a new <name your favorite band here> album debuts they can have much higher peaks than their usual requests load. They still need to be able to handle all coming requests or the (potential) buyers will take their business elsewhere.

 

How can I maintain a level of QOS, handle peaks and high-loads without my service failing?

 

One option is to estimate the peak loads and get enough computation power to ensure you can handle them – this causes problems. One is a problem of waste you can have machines just sitting there twiddling their thumbs so to speak. However the idle computers have purchase, maintenance and operational costs. The other problem is unexpected loads (e.g. Harry Potter craze for an Amazon-like site) – the estimated load might not be enough.

 

Ensuring QOS gets even more problematic when some of the actions performed in the service access resources/services that are not in the under the service control (- e.g. taking to a credit card clearing in the e-commerce example mentioned earlier).

 

Another issue that needs to be take care of is prioritizing requests – a Service most likely handles several types of requests – not all of them need the same level of QOS. You can set the QOS for according to the most demanding request type – but then you may need more resources.

 

Decouple the invocation- separate the reply from the request: Acknowledge receipt in the edge, pass incoming request to a queue, load-balance and  prioritize behind the queue.

 

 

Making the Edge acknowledge the receipt of the request (for our e-commerce example this can translate to "Your order has been received and is being processed, you would get confirmation email when the transaction completes") allows hiding operations that take long time from the service consumers (be that other services or end-users).

 

Writing requests to the Queue is a relatively low-cost operation that can be performed fast thus allowing handling request peaks. The actual handling of the incoming requests can be performed more slowly according to the available resources of the service. The load balancing can be done by setting different number of readers working against the queue.

 

Making the Queue a Priority Queue (or having several queues according to priority) allows for maintaining different levels of QOS for different message types.

Decoupled Invocation can be combined with the Gateway pattern to allow scaling out the service.

 

Decoupled Invocation is enhanced by the use of Correlated Messages pattern which helps relate the request and the reactions.

 

Acknowledge in the Service

Sometimes the initial response needs to involve some business logic and is not just an acknowledgment. In this case the Edge doesn't respond, it just passes the request to the service, the service sends both the initial reaction and the reaction.

 

 


 
Wednesday, May 10, 2006 4:50:24 PM (GMT Standard Time, UTC+00:00)
Hi Arnon,
Few questions:
I heard that queues are slow.
Have you had any such experience.
Do you know of any site where we could get some bechmarks using queues so it is easy for us to prove to others the advantages of this architecture.
Also would you consider this kind of architecture for
any application, i mean web(intranet/internet)/Client-Server
architectures or is it meant for only specific applications.
Thanks,
Sailu

Sailu
Wednesday, May 10, 2006 9:32:35 PM (GMT Standard Time, UTC+00:00)
Hi Sailu,

When you say queues are slow - compared to what? on what hardware ? Queues are slower than UDP - but what are your needs? Last year I've benchmarked Tibco EMS with 1000 1K messages per second (COM+ transactions) on a 2-way server attached to a SAN and similar results for SQL Server 2005 Service Broker (with SQL transactions) on a 4-way machine. You can probably do better on a better hardware. If you don't need transactable messages you can get much better results with most queue systems. (By the way, I have MSMQ statistics somewhere, drop me an email and I'll send them to you (though you should be able to find it on the Microsoft site).

I think messaging is a very good communication medium for distributed systems (SOA or not) and I would consider it first - there are situations where they don't fit though. As for the architectural pattern above - it's specifically for SOA (you will probably not have an Edge and a business service components in other architectures) 0 but it might be applicable elsewhere.

Arnon
Wednesday, May 10, 2006 9:36:10 PM (GMT Standard Time, UTC+00:00)
Thanks Arnon. I appreciate your input.
Sailu
Sailu
Friday, May 12, 2006 2:09:00 PM (GMT Standard Time, UTC+00:00)
Hi Arnon,
Did you use any commercial .Net Queued components or have you written everything from scratch for queuing needs. If you have any suggestions about any products please let me know.
Also please find my updated email address, if it is not a problem please email me your queue statistics at this email: sailu_tp@hotmail.com
Your help is really appreciated.
Thanks,
Sailu
Sailu
Comments are closed.