How Application Architecture has Evolved in Software Development
In this tutorial we are going to see how application architecture has evolved in the last few years and with the driving factor for each evolution and we will also know in detail about the monolithic architecture, service-oriented architecture (SOA), microservices.
There are basically three types of software architecture depending upon the purpose of the application. We build our applications on any one of the Software Architecture based on the requirement and usage.
- Monolithic Traditional way of building applications i.e., Single codebase with all modules.
- Service oriented Collection of services and services communication with each other. Especially used in a Web Services based business.
- Microservices Structures an application as a collection of small autonomous services.
- Monolithic means composed all in one piece.
- Monolothic applications store whole application in one big container comprising of tightly coupled services.
- Monolothic applications are built as a single autonomous unit.It is a traditional model for sotware in which the structiure is a single and indivisible unit.
- Monolothic architecture is a solid solution for simple E-Commerce applications or blocked platforms especially when ongoing changes and development are not predicted.
- It is called Monolothic because the source code for the entire application should be build and packaged into a single unit like EAR or WAR.
- This architecute can be important for small applications only, growing enterprises can not effort downtime to update whole application for small changes.
- The application where everything is packaged as an EAR or WAR is monolithic in nature which means that even though we have seperate and distinguishable components but all are packaged together.
If you want to build a classic web application using Java
- Step 1: Design a presentation layer that means the user interface.
- Step 2: Design an application layer which handles all of the businees logic.
- Step 3: Design an integration layer to enable loose coupling between various components of the application layer.
- Step 4: Design a database layer that will be accessible to the underline persistent system.
- Step 5: To run the entire application you will have to build and package the entire application into a EAR or WAR and deploy it on an application web server like Tomcat.
Monolithic Architecture- Online Shopping site example
- Simple to build: It uses a standard way of developing applications, any engineering team having right knowledge and capabilities build monolithic application.
- Easier to test and debug: Since monolithic application is a single indivisible unit we can run end to end testing much faster.
- Easy to deploy: We just have to paste the previously prepared application to the server.
- Performance:All componenets typically share memory which is faster than service-to-service communications using IPC or other mechanisms.
All componenets like frameworks, templates or scripts can be easily applied.
- understanding: A large codebase can be significantly harder to understand and manage.
- Reliability: An error in any of the modules in the application can bring the entire application down.
If any bug occurs like database down or network issue whole system will not be accessible.
- Updation: Every element is closely related and dependent on the others (tight coupling), So it is difficult to changes new or advanced technology.
For each update that may be a minor or major, entire application should be redeployed due its single code base and tight coupling between the modules of application.
- Development Time: Since it has single code base application size goes on increasing exponentially due to its new requirements. So it is important for application developers to divide and break the applications down into individual components because everything in the monolithic approach is coupled together, developers cannot work independently to develop or deploy their own modules and must remain totally dependent on others which increases overall developement time.
- Scalability: We can scale whole application but can not scale components independently.
To scale monolithic applications for load balancing. We need to deploy the same EAR or WAR package into additional web server instances which is called as Horizontal scaling.
Each copy of the application in additional servers will utilize the same amount of underlying resources which is inefficient and an extra computation cost to company.
Monolithic structures make any changes to the application extremely slow as it often affects the entire system.
- If updates to part of an app caused errors, the whole thing has to be taken offline, Scaled back and fixed.
- It can require a completely rebuilt and deployed the version of software whenever a modification is made to a small section of code.
- If developers wish to scale certain functions of an application they must scale the entire application.
- So to remove these drawbacks we have to switch to next software architectures like SOA and Microservices.
Keeping the advantages and disadvantages intact Serive Oriented Architecture has come into play to overcome all the challenges and road blocks in the Monolithic Architecture.
- Service oriented architecture is a solution for making two applications communicate with each other by a collection of services.
- Service oriented architecture is an architectural style for building business application using loosely coupled service which act like black boxes and can be managed to achieve a specific functionality by linking together.
- SOA shifts our thinking from classes and objects to services and communication mechanism shift from communication protocol like http, ftp to messages.
- In software oriented architecture the consumer application will send the request to the service provider and in return the service provider send the response whioch be received by the consumer.
- The connections between the service provider and service consumer will be done through the web services, which transfer the request and responding with that the data is being requested.
- SOA is an approch for distributed system architecture that employs loosey coupled services, standard interfaces and protocols to deliver seamless cross platform integration.
- SOA is a collection of services and the services communicate with each other. Hence it is called as SOA.
- SOA is an enterprise-wide approach to software developement that takes advantage of resuable software components or services.
- Each service is composed of the code and data integrations required to execute a specific business function.
For Example checkong a customers credit card details, Signing into a website etc.
- To remove the limitations of monolithic architecture the serivce oriented architecture was introduced.
- It structures application into discrete reusable services that communicate through an Enterprise Service Bus(ESB).
In this architecture individual services are organised around a specific business process th adhere the communication protocol like SOAP, Active MQ to share themseleves through an ESB comprised application.
- A Service is a self-independent, does not depend on the language on which the consumer application is written.
- It is a logical encapsulation of self content business functionality.
- We should be able to change and modify those services without even affecting the other services in an isolated manner.
Client from any device using any operating system in any language can use the service(Platform independent).
Messages help us to communicate between the services.
- Message format should be standard.
- Message should work with cross platforms.
- Message should be able to communicate asynchronously.
- Message should be reliable.
- Message should be secured.
Message should help to describe and discover service.
- Application: SOA is better suited for large and complex business application environments that require integration with many heterogeneous applications.
- Code Reuse: These are used to create reusable code that decrease the time spent on the development process.
There is no need to rewrite the code every time when you need to create a new service or process.
- Programming Independence: It allows for using multiple coding languages because everything runs through a central interface.
- Platform Independence: It is a standard form of communication which allow the various systems and platforms to function independent of each other.
- Scalability: It allows greater scalability and each service can scale independently.
- Cost Reduction: Using SOA allows business to limit the amount od analysis required when developing custom solutions. SOA can save major applications integration cost.
- Greater Testability: SOA services are complete and self contained programs. This make it easy for testing, debugging or any form of maintenance
Increased Productivity: For developers there is no need to create every application from scratch. They can adapt and reuse old concepts and techniques when evolving into new services and technology.
- High Bandwidth Server: As services send messages and receive messages and information many times in a day. So there is need of high speed server.
- Extra Overhead: In SOA all inputs are first validated on consumer system before it is sent to service.
If multiple services are used by you then it will overload your system with further computations.
- High Cost: SOA is expensive in terms of human resources, technology and development.
- Others: SOA is not suitable for non distributed or standalone system.
- Like as SOA, microservices architecture are made up of loosely coupled, reusable and specialized components.
- Microservices are typically used to build individual applications in a way that makes them more agile, scalable and resilient rather than enterprise wide.
- By using microservice teams can update code more easily use different stacks for different components and scale the component independently of one another, reducing the waste and cost associated with having to scale entire applications because a single feature might be facing too much load.
- Microservices are a way of breaking large software project into loosely coupled modules which comminicate with each other through simple application programming interfaces(API’s).
- Microservies architecure has an application scope.
- Microservices can communicate with each other usally statelessy so apps built in this way can be more fault tolerant less dependent on a single ESB.
- Microservices are the foundation for cloud native applications.
- Microservices are architectural solution for designing complex mostly web-based applications.
Big enterprise like Amazon, Netflix and eBay adopt microservces architecture.
- Improved fault isolation: These independent service when constructed properly do not impact one another.
That means if one piece fails the whole app does not go down.
- Flexible: Microservices provide affects ability to try out a new technology on individual service as needed.
- Easy to understand: With added simplicty developers can better understand the functionality of a service.
- Smaller and faster deployments: Because of small codebases and scope, applications can be deployed quickly.
- Scalability: As services are separate, we can more easily scale the most needed once at the appropriate times, as opposed to the whole application.
Highly scalable as demand for certain services, you can deploy across multiple servers and infrastructure to meet your needs.
- Accessible: As large application is broken down into smaller pieces, developers can more easily understand, update and enhance those pieces, resulting in faster development cycles especially when combined with agile development methodologies.
Multiple microservices can be developed concurrently which results in less time spent in development.
- Complex communication: Communication between services is complex. Since everything is independent service so developer have to carefully handle request travelling between modules. For this developers must have to write extra code to avoid disruption.
- More Services - More Resources: Multiple databases and transaction management can be painful.
- Global Testing is Difficult: Testing a microservices based applications are difficult. With microservices each dependent service needs to be confirmed before testing can occur. Integration testing as well as end to end testing can become more difficult and more important than ever. Failure in one part of the architecture could cause fail to many dependent modules.
- Deployment Challengers: The product may need coordination among multiple services which may not be as striaght forward as deploying a war in a container.
- Logging: with distributed systems you need centralised logs to bring everything together otherwise the scale is impossible to manage.