Saturday, August 13, 2016

Integration Shift - Restful Goals

Application of REST design constraints help in achieving following goals:

Performance: It is amount of time spent in getting the response for a single request. Assuming that network performance is absolute, some of the design decisions like keeping data close to where it is processed, number of request optimization for a use case, omitting irrelevant data, pagination can improve user perception.

REST constraint like uniform contract negatively impact performance as forcing single technical interface keeps it resource based which can result in increased round trips for a use case.

However constraints like cacheability  & stateless prevents extra request and keeps request simple & self contained.

Scalability: It is  the ability to support large number of instances or concurrent interactions. It is all about serving all your clients in an acceptable amount of time and prevent Denial of Service.

REST constraint like Layered System & Uniform Contract allows load balancers as an intermediary layer without changing the service contract. It is further simplified with the Stateless constraint as each request can be handled independently and there is no need to synchronize session state explicitly between service instances.

Simplicity: Rest is all about simplicity and is achieved by proper application of separation of concerns. Client requests the representation of resource through a URI (Uniform Interface) and content-type header and it is up to server to handle the state by correctly applying (Layered system, client-server) constraint and return an appropriate status code. Application of Stateless constraint keeps the interaction simple & self-contained without waiting & referring to earlier requests.

Modifiability: It is the measure of how easy it is to make changes to the system. With the constrains like:

Uniform Interface allows the ability to refactor / redeploy service without impacting clients.
Stateless constraint provides ability to add / modify functionality even when solutions are running.
Layered System constraint allows the add new solutions like security, logging analytics without modifying the services. 


Visibility: It is understanding of interaction between the service and its consumers and ability to monitor & mediate that communication.

Uniform Interface like http provides the generic information to the service agents which enables to mediate / control the traffic with features like load balancing, security, analytics etc.


Portability: It is the ease at which service and solutions can be moved from one deployed location to another.
Code on Demand supports portability by client dynamically implement the upgrades as service is moved from one cloud environment to another.
Uniform Interface & Layered system supports portability by keeping the same technical interface is part of service logic is moved to different technology  / environment.

Reliability: Reliability is the measure of the level of fault tolerance built into the system. It is the ability of the system to maintain availability, even when things go wrong.

Restful constraint like Stateless enables intermediate load balancers to easily route the request to a available node without worrying about state information as each subsequent request is independent. 
Layered System can help introduce monitoring & load balancing at different levels which can increase the fault tolerance of the solution.

Uniform contract can impact reliability if side effects are not considered properly while modifying the state of resource using PUT (not safe but idempotent) & POST (neither safe nor idempotent).


In my next post, I will write about http as a HTTP as Uniform Contract.

No comments:

Post a Comment