
Decoupling the tiers
We know that the application architecture plays a key role to ensure its candidature for Hybrid Cloud and it should be conducive for the use in some of the use cases.
The first thing that we need to do is to decouple the tiers of the applications if it needs to be considered for distributed or the co-existant use cases mentioned in the afore section. Lets take a look at how is it done:
The two major methods used in decoupling the different tiers are:
- Load balancers
- Queues (AMQP - Asynchronous Message Queuing Protocol)/ESB (Enterprise Service Bus) - (in older applications)
Load balancers are normally used when there is a direct call being made to the tier, this could be the user making a call to the web tier or even the web tier making API calls to the application tier.
An AMQP is normally used when there is a task at hand, and there might be several workers who can pick the task up and do it.
So, in order to understand this better, the use of a load balancer is more of a Managerial assignment, where the task is given to the manager, and the manager assigns it to one of the workers, depending upon which one is available and has less work, or even randomly in a round-robin fashion. We would call this a push assignment.
We also need to remember that if the worker goes on a long leave, the work may not be completed and the client has to re-request it. The manager would then have to assign it to someone that is available. Also, the manager is completely in grained in the work, which means it is constantly waiting for the work to come back in order to respond.
A worker in this context is a node or virtual machine in the particular tier that is supposed to service the request being sent to it.
On the other hand, a queue may be used, where the task is kept in the queue and the workers pick it up at their convenience. Once they complete it, they mark it completed. This is a more social way to assign work. If the worker dies during the process of finishing the activity, a timer can force the work to be reassigned. The queue is asynchronous and normally a call back is made when the work is completed.
The following table explains the differences in short:
