Software architecture is a foundation for building a system that can meet different criteria — technical, operational, and even business ones. Having the right kind of architecture determines how efficient the development process will be, as well as the final product’s performance and scalability. It can also affect the entire company and its future, helping to avoid some common issues and cut unnecessary costs. With the increasing business complexity and ever-changing product demands, the trends regarding what sort of software architecture is most commonly adopted are shifting as well. In search of the reduced code base complexity, minimized time-to-market, and improved fault diagnosis, businesses come to the common dilemma of monolithic vs microservices architecture.
written by:
Anastasia Borodinets
Software architecture is a foundation for building a system that can meet different criteria — technical, operational, and even business ones. Having the right kind of architecture determines how efficient the development process will be, as well as the final product’s performance and scalability. It can also affect the entire company and its future, helping to avoid some common issues and cut unnecessary costs. With the increasing business complexity and ever-changing product demands, the trends regarding what sort of software architecture is most commonly adopted are shifting as well. In search of the reduced code base complexity, minimized time-to-market, and improved fault diagnosis, businesses come to the common dilemma of monolithic vs microservices architecture.
Monolithic architecture is considered to be a traditional way to develop multiple applications in contract to microservices, however, many also see it as “outdated”. Instead, these days businesses often turn to the more versatile microservice approach, which allows them to build applications that are quicker to create and deploy, and easier to test and scale. In fact, according to Lightbend, 60% of respondents are already using microservices in production; whilst it is also predicted by IDC that 90% of all new applications will be built on top of microservices by 2022.
Big companies like Netflix, Amazon, and Uber have successfully adapted microservices proving their effectiveness. However, this doesn’t mean that this is the right approach for all companies. At the end of the day, even these industry giants started with a monolith and only migrated to microservices later due to their business-based growth.
Therefore, instead of blindly following the market trends, it is better that companies actually take a moment to evaluate what is the best for their own business. This may depend on a variety of factors, such as the product or service they are selling; the audience they are targeting; and/or the scale of development they are expecting.
Monolithic Architecture
By definition, a “monolith” refers to a single upright block of stone. Similarly, a monolithic application is an application composed of one piece or one block. It is a single-tiered structure that typically contains three tightly connected and interdependent modules: a relational database, a server-side application, and a client-side user interface. All of these act as one unit, therefore, they all must be present in order to execute the code. Additionally, any changes in one module require an update of the entire application.
Advantages of Monolithic Architecture
The main advantages of monolithic application development which lets it still stay as the default option are as follows:
- Easier and Faster Development. The biggest advantage is considered to be the development speed and the simplicity and straightforwardness of creating an application based on one code. There is a wide range of available tools, while it is also familiar to every development team-building concept.
- Easier Deployment. Monolith applications are considered to be simple to deploy, as it is only necessary to handle deployment once — one executable file or directory.
- Easier Testing and Error Tracing. With fewer variables, the risk for something to go wrong is much lower, while it is also easier to spot errors when all transactions are logged into one place.
- Trustworthiness. As monolithic architecture is a tried and tested standard method, it is also considered to be more trustworthy than anything newer and, therefore, more untested.
Disadvantages of Monolithic Architecture
Unfortunately, once it comes to developing bigger and more complex applications, all the above-mentioned advantages of monolithic architecture are gone and there are multiple drawbacks in their place instead.
- Development Speed Goes Down. As the application gets larger due to how its structure is tightly connected, it also gets more difficult to understand and modify. Even minor changes require the whole system update. Moreover, as the codebase increases in size, the IDE starts to slow down due to the overload, in turn, causing slower development speed and startup time.
- Scalability Is Limited. As each component of a monolithic application cannot be scaled independently — given they also each have different resource requirements — when the application gets bigger, it becomes more and more difficult to scale it up. As a result, as more people are going to use the software, there will be more and more issues with handling requests.
- Reliability Issues. Due to how interconnected and interdependent the components of a monolithic application are, even a minor issue leads to the failure of the entire application.
- Lack of Flexibility. When it comes to monolithic architecture, there is no other choice than to stick to a single technology, which may have its own limitations. Adopting any kind of new technology would mean rewriting the whole application, which is extremely costly and time-consuming. Consequently, making upgrades is a nearly impossible task, thus, developers cannot benefit from newly-released, more advanced frameworks and languages. This lack of flexibility becomes an especially big issue when the currently used framework goes obsolete.
Microservices Architecture
Microservices architecture structures an application as a collection of smaller independent services communicating via APIs. Each service has its own function, codebase, processes, lifecycle, and database. This lets each of the building blocks be developed, deployed, maintained, and updated separately, without affecting the rest of the application, in contrast to the interdependent monolithic architecture. As a result, development teams are able to meet ever-changing business needs by quickly updating each service or building new components of the app, instead of rebuilding or redeploying the whole thing.
The transition to the microservices approach was a natural evolution towards better communication between the growing number of platforms, simplicity, and greater user-friendliness of systems. The term was coined in the early 2000s by Dr. Peter Rogers at a meetup dedicated to cloud computing (in the form of 'Micro-Web-Services' which later transformed into 'microservices' as we know it). The man passionately supported the idea of getting away from conventional thinking and expanding the capabilities of standard software architectures. As you will see below, he had a point.
Advantages of Microservices
The rising popularity of microservices can be explained by the following main advantages:
- Independent Development. As mentioned above, each service can be developed and updated independently from the rest of the services, which makes the process much quicker and more understandable, as compared to always looking at the whole picture at once in monolithic applications.
- Independent Deployment. Similar to development, deployment of each microservice can be done on its own, without the necessity to redeploy the whole application. Hence, for more complex applications microservices architecture makes continuous deployment possible.
- Faster Time-to-Market. As microservices literally refer to being small, while also having different teams working on each of them individually, they are quick to build and deploy, saving companies’ resources and giving their customers new desired products in much less time.
- Mixed Technology and Effective Updating. In a microservices application, each service is allowed to be written in a different language without affecting other services in any way. It lets developers base their technology stack choice on what is most suitable for the specific service, instead of being stuck with one single option from the start of the project, which often might not work as well for some of the other modules.
- Resiliency. As all services are self-isolated, when something goes wrong with one of them, it might be a threat to the service, but it does not take down the whole application, unlike with a monolithic architecture. It is also faster to find the bug in an isolated service than in the typically larger monolithic structure. Moreover, this kind of approach limits the damage that developers can cause through manual errors and mistakes.
- Granular Scaling. Same as each service can be developed and updated individually, it can also be scaled separately according to its traffic. The ability to scale horizontally, again, helps to save time, money, and effort.
Disadvantages of Microservices
Even though when looking at all the above advantages microservices architecture may seem like an obvious choice, it still comes at a price and brings major challenges that need to be taken into account.
- Complexity. While standalone services seem superior to their larger monolithic counterparts as they are more flexible, lightweight, scalable, and might be easier to develop; the fact that there may be hundreds of thousands of them in one application leads to high developmental and operational complexities. First and foremost, it means that there need to be that many pieces built, deployed, and monitored, which can be a huge load of work even for several teams. Secondly, the importance of inter-process communication between these teams of developers becomes really high in order to solve these complexities and architect a robust and reliable structure from the very start.
There are various automated solutions, such as Kubernetes, that are aimed to make things easier, however, each such solution still adds up to the overall complexity, while also increasing overhead, which is not always worth it.
- Harder Deployment. Deployment of a large number of services is very complex, especially if changes need to be implemented across multiple services, and usually, it requires a high level of automation, which is very costly. For smaller and less complicated applications, monolithic architecture would be a better choice, in this case, like deployment, there can be done all in one go.
- More Complicated Testing. The testing process of microservices applications is much less straightforward than of the monolithic-built. There is much more code to screen through, and services have to all interact with each other, thus, it is much harder to isolate the faults leading to more debugging needed in the future.
- Performance. As services are running independently, developers need to create digital bridges that would connect them with each other. The concept of services interacting via requests between processes often results in communication bottlenecks, which, in turn, cause major performance concerns and delays in more complex applications.
- Security. A large ecosystem of stand-alone services communicating with each other via network protocols implies higher security concerns, as there are significantly more of the exposed access points. It means that much more attention needs to be put into securing the application. However, while in monoliths it is necessary to secure only one service, here every microservice needs to be secured separately, creating a much higher load of work.
One Approach Does Not Fit All
To summarize, each software architecture has its own advantages and its own drawbacks, which can highly affect the success of the developed solution. Therefore, it is important to carefully make the decision on what would be the right architecture considering several factors: the problem being addressed, the scale of development, the expectation for the future development, as well as the size of the team and the available budget.
To generalize, monolithic architecture is most suitable for:
- Simple, lightweight applications that only require limited functionality
- Startups and businesses operating only with a small team and looking for a quick launch
- MVP versions of the products in their trial stage, which are not guaranteed to be used often
On the other hand, the microservices architecture might be more suitable for:
- Complex and evolving applications
- Stable and verified business concepts with a lot of traffic
Have some questions about the microservice architecture? We will be happy to consult you on the issue. Simply contact us or visit the website.
Contacts
Feel free to get in touch with us! Use this contact form for an ASAP response.
Call us at +44 781 135 1374
E-mail us at request@qulix.com