Service Oriented Architecture (SOA)
Service Oriented Architecture (SOA)
- Composability of user-facing applications;
- Reusable Business Services;
- Technology stack independent;
- Autonomy (independent evolution, scalability & deployability).
- CORBA – Common Object Request Broker Architecture
- Web Services
- Message Queue
- Enterprise Service Bus (ESB)
- Microservices
- Platform neutral Remote Procedure Call;
- Transactions (also remote transactions!!);
- Security;
- Events;
- Programming language independence;
- OS independence;
- Hardware independence;
- Isolation from data-transfer/communication details;
- Data typing through an Interface Definition Language (IDL).
How it works

- The caller calls a local procedure implemented by the stub;
- The stub validates the call and creates a request message that passes to the ORB;
- The client ORB sends the message over the network to the server and blocks the current execution thread;
- The server ORB receives the request message and instantiates the skeleton;
- The skeleton executes the procedure on the called object;
- The called object performs a computation and returns the result;
- The skeleton packs the output arguments into a response message and passes it to the ORB;
- The ORB sends the message over the network back to the client;
- The client ORB receives the response message, unpacks it and delivers it to the stub;
- The stub passes output arguments to the caller, releases execution thread and the caller continues in execution.
Pros
- Tech stack independence (except for the ORB implementation);
- Isolation from data-transfer/communication details.
Cons
- Location transparency: The client code does not know if a call is local or remote. This sounds like a good thing, however, the latency and type of failures are quite different, depending if it’s a local or remote call. Not knowing what type of call it is, makes it impossible for applications to choose an appropriate strategy to handle the method call, and to end up making remote calls inside a loop, and therefore considerably slowing down the whole system.
- Complex, redundant and ambiguous specification: It was created as a mash-up of several existing vendor versions, so (at that time) it was ambiguous and redundant, making it difficult to implement.
- Blocked communication pipes: It used specific protocols over TCP/IP and specific ports, or even random ports. But enterprise security rules and firewalls would often only allow for HTTP communication over port 80, effectively blocking CORBA communication.
Web Services
We needed a reliable communication pipe, so:
We needed to reduce the remote communications, so:
We needed a simpler communication specification, so:
- SOAP had its first draft in 1998 and reached a W3C recommendation in 2003, making it effectively a standard. It embodied some of the ideas of CORBA, like a layer to handle the communication and a “document” defining the interfaces using a Web Services Description Language (WSDL);
- REST was defined in 2000, by Roy Fielding in his PhD dissertation “Architectural Styles and the Design of Network-based Software Architectures“, and it is a much simpler specification than SOAP which made it quickly gain higher adoption than the slightly older SOAP specification.
- GraphQL was developed by Facebook in 2012 and released to the public in 2015. It is an API query language that allows the client to specify exactly what data the server should send back, as opposed to an ad-hoc payload, avoiding both over-fetching and under-fetching data.

Pros
- Independent tech stack, deployment and scalability of services;
- Common, simple and reliable communication channel (text through HTTP, port 80);
- Optimised communication;
- Stable communication specification;
- Insulation of Domain contexts.
Cons
- Difficult integration of different web services, due to different communication languages, ie. two web services that use different JSON representations of the same concept;
- Synchronous communication can overload the systems.
Message Queue
- Request/Reply
- Publish/Subscribe
- List-Based
It maintains lists of published topics and subscribers to those topics. As it receives messages for a topic it puts the message into the corresponding topic list. Matching the message to a topic can be done by the message type or with a more complex set of predetermined criteria that can include the message content itself. - Broadcast-Based
As it receives messages, it broadcasts them to all the nodes that are listening to the queue. Each listening node is responsible for filtering and processing only the messages that it is interested in.
- List-Based

- In a pull scenario, the client will ask the queue for a message at every X amount of time. This has the benefit that the client is able to control its load but also might have the downside of introducing latency, ie. when there are messages on the queue and the client is not handling messages but just waiting for the moment to poll for a new message;
- In a push scenario, the queue will push messages to clients as soon as a message is received. The advantage here is that there is no latency, but the clients can not self-manage their load.
Pros
- Independent tech stack, deployment and scalability of services;
- Common, simple and reliable communication channel (text through HTTP, port 80);
- Optimised communication;
- Stable communication specification;
- Insulation of Domain contexts;
- Easy attachment and detachment of services;
- Asynchronous communication helps manage the system’s load.
Cons
Enterprise Service Bus (ESB)

- Monitor and control routing of message exchange between services;
- Resolve translation of messages between communicating service components;
- Control deployment and versioning of services;
- Marshal use of redundant services;
- Cater for commodity services like event handling, data transformation and mapping, message and event queuing and sequencing, security or exception handling, protocol conversion and enforcing proper quality of communication service;
Pros
- Independent tech stack, deployment and scalability of services;
- Common, simple and reliable communication channel (text through HTTP, port 80);
- Optimised communication;
- Stable communication specification;
- Insulation of Domain contexts;
- Easy attachment and detachment of services;
- Asynchronous communication helps manage the system’s load;
- Single point for versioning and translation management.
Cons
Microservices
- Services are modelled around business domainsBecause it can give us stable interfaces around a business concept, very cohesive and decoupled units of code and clearly identified bounded contexts;
- Culture of automationBecause we will have a lot more moving parts and deployable units;
- Hide implementation details
To allow one service to evolve independently of another; - Decentralise all the thingsDecentralise the decision making power and the architectural concepts, giving autonomy to the teams so that the organisation transforms itself into a Complex Adaptative System who can quickly adapt to change;
- Deploy independentlySo that we can deploy a new version of a service without the need to change anything else;
- Consumer firstA service should be easy to consume, easy to be used by other services;
- Isolate failure
So that even if one service fails, the others continue to operate, giving the overall system a high resilience to failure; - Highly observableDue to the system high number of parts, it is more difficult to understand everything that is going on, so we need sophisticated monitoring tools that allow us to know what is going on in every corner of the system and understand any chain reactions.
Pros
- Independent tech stack, deployment and scalability of services;
- Common, simple and reliable communication channel (text through HTTP, port 80);
- Optimised communication;
- Stable communication specification;
- Insulation of Domain contexts;
- Easy attachment and detachment of services;
- Asynchronous communication helps manage the system’s load;
- Synchronous communication helps manage the system’s performance;
- Truly independent and autonomous services;
- No business logic outside of the services;
- Potential to transform the organisation into a Complex Adaptative System, composed of several small autonomous parts/teams who can quickly adapt to business changes.
Cons
- High operational complexity:
- Needs high investment in a strong DevOps culture;
- Using a multitude of technologies and libraries can get out of hand;
- Input and output API changes must be managed carefully because there will be software relying on those interfaces;
- The usage of eventual consistency has significant implications that must be addressed while developing the application, all the way from the back-end to the UX layers;
- Testing becomes more complex as interface changes can have unpredictable consequences in other services.
Anti-Pattern: Ravioli Architecture

Conclusion



Comments
Post a Comment