The choice of architecture is one of the most crucial nowadays when it comes to the application development. This decision defines the app’s ‘further life’. Today, we can look at three types of architecture. So let’s set the record straight and find out with which our future lies.
These days, a monolithic architecture is a kind of ‘a black sheep’ in the modern IT world. But is it fair? To tell the truth, yes but no. There are obvious reasons why you can safely choose the monolithic architecture as well as why not.
Advantages of Monolithic Architecture
-Appropriate for small applications. If your app is not big and you have little time for development, then your best choice is the monolithic architecture.
-Convenient testing and production processes. You can start and test an application on the developer’s computer and apply a standard deployment process to check on changes before putting it into production.
-Horizontal scaling. It’s possible to scale horizontally by starting several physical servers after a load balancer.
-Straightforward transaction controls and data integrity. Since monolithic applications usually use a single database for storage, they benefit a lot from straightforward transaction controls and different mechanisms of the data integrity maintain provided by the RDBMS.
-Simple infrastructure. Here, we have a single server for multiple things at once: front-end, back-end, and database. It will come as no surprise that monitoring in this case is performed more easily.
Disadvantages of Monolithic Architecture
-A single structure. Any changes will lead to the rebuild and deployment of the whole monolith.
-Hardly keeps the good modular structure. The changes in the logic of a module tend to affect other modules’ codes.
-Limited opportunities. When dealing with monolithic architecture, you’re bound to some common technology, which was chosen for the application at the very beginning. It results in a specific work organization: all specialists must literally sit back-to-back to each other in order to communicate effectively. However, they as well as certain parts of functionality could benefit from using different technologies a lot.
-Tight coupling and low cohesion. If you need to change one component, there is no way to make it instantly because the logic is spread through the whole app, thus, every part of the app has to be thoroughly tested even if not all components were changed, because it would be hard to predict what implication even a small change could cause with a tightly coupled code.
The main problem of monolithic architecture is that it’s not flexible enough for this fast-pacing world. The businesspersons whose applications are built according to the described approach are struggling a lot today. The only decision is to change everything in order to stay afloat and remain competitive.
At K&C, we’ve faced such a challenge. It was a web-application developed as a kind of a Liferay Portal. It had been in development for a long time (mainly in free form) and eventually it became clear that it made no sense to proceed further in this way.
So, the dedicated K&C team started the process by dividing the app into separate modules. We did not use OSGI, but we tried to divide the app into modules just inside the Liferay. As a matter of fact, this division was our first step towards the whole separation. And just after that, we began dividing the application into microservices.
Now let’s divide your monolithic app into microservices too!
1.Take your web-application;
2.According to the principle of bounded context, divide your monolithic app into ‘building blocks’;
3.Divide your app into modules;
4.Turn your modules into separate microservices.
Sounds easy;) But if you don’t know how to do it correctly you can contact the K&C agile development team and get useful tips regarding your web development issues.
When talking about microservice architecture, the easiest thing to do is to highlight its pros.
Advantages of Microservice Architecture
-Steady development. There is no need to write the whole app at once. Instead, development can be performed gradually.
-Flexible development. This means you can hire several teams and each will work with its own service.
-Dynamic lifecycle. This implies that you can launch and develop the app in a prompt manner.
-Unlimited technological potential. Compared to a monolithic approach, you can use any languages, any frameworks, and any technologies while developing an application.
-Unlimited scaling potential. A developer is able to independently scale the different parts of application.
Disadvantages of Microservice Architecture
-Communication. Remote calls are slower than the calls in the frames of a process; that is why the API must be coarser-grained.
-Application unavailability. The consequence of using microservices is the need to create an app so that they can function even if specific services fail to work. The problem is that any invoke to the service may malfunction because of its unavailability.
-Complicated infrastructure. There are many moving parts.That challenges developers to monitor all of them more carefully in order to maintain and manage the infrastructure effectively.
-Intricate transaction management and data consistency trade-offs. One of the major issues is the way transactions work when they span over different services. It’s assumed that the solution is in the distributed transaction approach or custom-made transaction manager, yet they both can come with other issues (e.g., deadlocks and data inconsistency). In some cases, we must rely on the eventual consistency approach. This means that instead of a strict boundary when the system is in the consistent state straight after the transaction is fixed, we allow our system to reach that state at some point in the future when some processes on the backend will have successfully cleaned up the inconsistency.
The only condition while working with microservices is that all services must work in a single environment – services have to be able to communicate with each other. This can be realized, for example, with the help of Kubernetes.
How the K&C agile development team approached the problem. Our decision is based on the framework Spring Cloud Netflix. It lets us integrate various applications built upon the Spring Boot framework. However, you can choose whatever you like. It can be NodeJS, Python, or what you are used to working with.
A serverless approach is rather young and extreme. In this type of architecture, we’re talking not about a set of services or functional modules but a set of functions that live their life and have their life cycle, beginning from deployment and ending with the approaches to scalability.
Is the architecture good or bad? Let’s look at its most significant pluses and minuses.
Advantages of Serverless Architecture
-Lightweight mechanism of functioning. This type allows the creation and running of the app and services without the necessity to manage infrastructure.
-Infrastructure. The whole infrastructure is maintained by an outside provider and needed functionality is provided in the form of services, which are responsible for the processes of authentication, message transfer and so on.
-This perfect for arranging business logic; especially when there are some functions that we need to bind as an asynchronous data stream. Moreover, we don’t have to include them into our application because the functions are based on a host platform of the application.
Disadvantages of Serverless Architecture
-An insufficient set of functions. Thus, we can’t build substantial chains of functions. This leads, in turn, to the complication of architecture and infrastructure, as far as it’s somewhat tricky to make so many separate modules interact.
-Tight coupling among all the functions. This results in the same problem as monolithic architecture.
However, today we can observe that many modern applications benefit from the serverless approach. It’s convenient, easy, and pleasant.
K&C’s expertise: We use serverless architecture for preparing images. First, we divide, cut, and distribute them in the cloud storage. Then, we publish images on CDM. This happens automatically with the help of lambda functions, which are stored on the Amazon Web Service Platform. This approach means we don’t have to worry about how many instances this function needs because Amazon’s mechanism offers a quite dynamic scaling.
It’s safe to say that the days of a monolithic architecture are fading. The monolith is appropriate only for a very small application, if at all. Although even in this case, there is the possibility to face numerous problems in the future. With this, such type of architecture belongs in the past as well as SOA technologies.
Microservices and Serverless
Considering the microservice and serverless architectures, or let’s name it more accurately ‘function as service’, they both are auspicious technologies. Most likely, the future lies with a mix of these two approaches – when part of the functionality is represented in the form of microservices, and another is in the form of serverless functions that are deployed in a host environment or cloud technologies.
For the K&C team, the future lies with self-improvement. We strive to keep track of events when related to web development. All this – to provide sustainable prosperity in the digital environment for your project.