If you are an entrepreneur, who is planning to built an application, or if you want to become a tech-lead of a high level enterprise company, then there is a one common thing that you need to know from every aspect, before you start developing your software. It is, deciding the most appropriate software architecture for your application. If you are a software engineer or a tech enthusiast, you already know that it’s really important even though you don’t have much knowledge about software architectures. So, in this article I will explain about software architectures and how those evolved though the time.
Before going to explain the types of architecture, you need to understand the different layers which are the foundation of software architecture. There are three types of layers known as Presentation Layer, Application Layer, and Data Layer.
This layer is also known as the Client Layer and this is what we see when using a software (User Interface). The main responsibility of this layer is to communicate with Application layer. This layer passes the information which is given by the user in terms of keyboard actions, mouse clicks to the Application Layer.
It is also known as Business Logic Layer. So, this layer is the one who decide what to do with user inputs, that received from the Presentation layer. Furthermore, this layer acts as a bridge between the Presentation and the Database layer. We use this layer to write the whole business logic of our software.
The data is always stored within this layer. Application layer communicates with Database layer to retrieve the data. It contains methods that connects the database and performs required actions, such as insert, update, and delete.
One-tier architecture is also known as single-tier architecture, and has all the layers such as Presentation, Business, Data layers in a single software package. It means that the user interface, business logic, and database layers are accessible by the application under the same local drive. Both the client and server, reside in the same machine. So, as you already guessed, this is the simplest application architecture to use. However, One-Tier Architecture is not suitable for a web application, due to it can only access data available in a single computer or server.
This is a cost-efficient architecture. So, if you want to develop an application based on this architecture, it will much easier and cheaper to build. However, the major disadvantage of this architecture is, it cannot share information from one client machine to others. Sometimes the applications based on this architecture are unable to work if some changes are done in the machine.
Applications like MP3 players, MS Office are come under one tier application.
In this architecture, the client tier handles both Presentation and Application layers and the server handles the Database layer. The two-tier architecture is also known as a “Client-Server Application”. In two-tier architecture, communication takes place between the Client and the Server. It means that, the client and the server are not on the same computer. So, client system sends the request to the server system and the server system processes the request and sends the response back to the client system.
It is easy to maintain and modify the two-tier application architecture. The communication between client and server is very quick, even though it happens as in the form of request and response. However, the main disadvantage with this architecture is that, if the number of clients exceeds the capacity then the server might be unable to respond to the requests made by all those clients. So, it decreases the productivity of the server.
Additionally, the client application may need to be reinstalled if some changes are done in the application. Since the business layer resides on the client-side, the client should have high processing power.
The three-tier architecture is very popular and common architecture. In this architecture all three major layers are separated from each other. Presentation layer resides at Client Tier, Application layer acts as middleware and Data layer is available at Data Tier. Unlike two-tier architecture, 2 servers perform the major tasks in this architecture. One server is for the business layer while the other is for database layer.
This architecture is used to design web applications. In this architecture, the application server act as an interface between the client and the server layer. So, the application layer helps the client in communicating with the server. The database layer store all of the data and respond according to the application layer logic. This layer also increases the security of the application.
The main goal of three-tier architecture is that, each tier runs on its own infrastructure, each tier can be developed simultaneously by a separate development team, and can be updated or scaled as needed without impacting the other tiers.
N-tier architecture is also called a Distributed Architecture or Multi-tier Architecture. It is similar to three-tier architecture, but the number of the application server is increased and represented in individual tiers, in order to distribute the business logic so that the logic can be distributed.
This architecture is very famous for its flexibility. It can increase its flexibility by increasing the number of database servers. The n-tier based application is more secure than the other tiers’ of architecture. Even making changes or modification in any layer can be done without affecting the other layers. At any point of time you can modify the business logic, increase the database size, without touching the client.
Note: Java EE architecture is based on n-tier architecture.
With the rise of internet, developers seek a way to available their applications and system through the internet. As a result of that they were able to build three components named as, Web Server, Web Container, and Application Server. So, in this chapter I will explain those three components.
A web server is a computer system that stores, processes, and delivers web pages to clients. The client is almost always a web browser or a mobile application. Depending on the setup, a web server can store one or more websites. This type of server only delivers static HTML content such as, documents, images, videos, and fonts.
Usually, web servers do not deal with dynamic content or server-side programming, but still you can add components for dealing with dynamic content. Also, web servers accept and fulfill Hypertext Transfer Protocol (HTTP or HTTPS) requests only.
Popular web servers: Nginx, Apache, Microsoft IIS, Jetty, and LightSpeed
A web container is the component of a web server that interacts with Java servlets and web applications runs within these Web containers of a Web servers. The Web container provides the runtime environment through components that provide naming context and life cycle management. Some Web servers may also provide additional services such as security and concurrency control. These web containers implement the web component aspect of the Java engineering architecture; it specifies a run time environment for various components such as transaction, concurrency, and deployment.
An application server is a software framework which generates dynamic content and assets for a client application. Clients include web-based applications, browsers, and mobile apps. Application server can transform data to provide the specialized functionality offered by a business, service, or application. Application servers enhance the interactive parts of a website that can appear differently depending on the context of the request.
Note: Web servers and application servers have one thing in common, they need a dedicated server to run the software.
Application server is the main link between a client and server-side code. Typical tasks of an application server include:
- Transaction management
- Dependency injection (DI)
The microservice architecture is designed to help developers avoid letting their software and applications grow up to be unwieldy, monolithic, and inflexible. Instead of building one big software, the goal is to create a numbers of different tiny programs and then create a new little program every time someone wants to add a new feature. So, each of these microservice has its own distinct responsibility and teams that can develop them independently of other microservices. The only dependency between them is communication. As microservices communicate with each other, you will have to make sure messages sent between them remain backward compatible.
If you wonder why microservices are so special and popular than other architectures, then let’s compare microservices with traditional monolith architecture. Unlike microservices, a monolith application is built as a single, large unit. This make changes to the application slow as it affects the whole application. If you want to do a modification for a small section of code, might require building and deploying an entirely new version of the application. Scaling specific functions of an application, also means you have to scale the entire application.
Advantages of Microservices Architecture
- Microservice architecture gives developers the freedom to independently develop and deploy services
- A microservice can be developed by a fairly small team
- Code for different services can be written in different languages
- Easy integration and automatic deployment (using open-source continuous integration tools such as Jenkins, Hudson, etc.)
- Easy to understand and modify for developers, thus can help a new team member become productive quickly
- The developers can make use of the latest technologies
- The code is organized around business capabilities
- Starts the web container more quickly, so the deployment is also faster
- When change is required in a certain part of the application, only the related service can be modified and redeployed — no need to modify and redeploy the entire application
So, this is the end of the article and I hope you enjoyed it. Happy Coding👨💻.
Software Architecture and its types | 1-tier 2 tier 3 tier N-tier Architecture |
Software Architecture is a system to represent the collection of components that accomplish a specific function or set…
Web Server, Web Container and Application Server
HTTP Server A web server is software that helps to deliver web content (web pages) to the clients (e.g. web browser)…