Monolithic vs. Microservices Architecture: Which is Right for Your App

Two major types of software architecture are monolithic and microservices. The last one has become extremely popular in recent years. While monoliths are still there and programmers work with them as well. That is why the question “monolithic vs. microservices architecture” is still actual when we talk about app development.

####What is a Monolithic Architecture?

![monolithic vs microservices](https://d32myzxfxyl12w.cloudfront.net/assets/images/article_images/805f87ee59c1e105d8261eba7010f222f16a927a.png?1546526063)

A monolithic architecture is a model of software structure which is created as one piece where all Rails tools (ActionMailer, ActiveJob, ActionCable, etc.) can be gathered together with the code that these tools applies. The tools are not connected with each other but they are also not autonomous.

If one feature needs changes, it will influence the work of the whole process and other features because they are parts of one process.

Let’s recall what Ruby on Rails is, what it can offer, its pros and cons. Its most important benefit is that it is easy to work with.

If you write 'rails new' you immediately get a new application at once, then you can create any REST API you want and use Rails helpers and generators, which makes development even easier.

If you need to send emails in your Rails app, then use Rails ActionMailer. When you need to do some hard processing, ActiveJob will help you. With Rails 5 you will also be able to use websockets out of the box. Thus, it will be easy to create chats or make your application more interactive.

In case you use correct DSL syntax, you can use all that and even more immediately. Moreover, you don’t have to know everything about the internal implementation of these tools, consider it’s DSL, and receive the expected result.

####Monolithic vs. Microservices Architecture: Pros of Monolithic Applications

![microservices vs monolith](https://d32myzxfxyl12w.cloudfront.net/assets/images/article_images/60013d58ec8b2708d8b61dc3eeb606c8a1b9febb.png?1495612953)

The benefits of monolithic application are:

- Easy to develop as it has the big variety of available tools that are ready to be integrated into apps. It is simple to deploy because all actions are performed with one directory at once.

- Fast to develop as all of these Rails tools require minimum effort to be applied. It means that you don’t need to think how all works in tools like ActiveJob, ActionMailer or ActionCable.

Simplicity is one of the major advantages. Due to the simple structure of the monolithic architecture, there is no need to perform many complicated operations and extra activities that are required for complex systems.

####Monolithic vs. Microservices Architecture: Cons of Monolithic Applications

Simplicity is good but there are cases when it is not enough to be completely happy with the process of app development and its results. Let’s review the drawbacks of monolithic software:

- With every new approach integrated into your app, you have more and more dependencies on external libraries. Your codebase becomes large. This makes the workflow more difficult. What is more important, all of your machines become more wasteful in terms of power and money. And if your monolithic application becomes unsupported, you don’t have many options except starting a new app from scratch or decomposing current app into microservices.

- Every Rails tool works following the principle of a black box. It’s the characteristics not only of Rails, but of any external library. It doesn’t bother you until your task is simple and Rails can take care of it. If the task is complicated, it will be hard to monkey patch the use of the tool according to your needs and keep it synchronized with its source. 

- Monolithic applications are not reusable because they use tools out of the box. You will not be able to just extract a feature and integrate it into another project because it depends on the entire Rails ecosystem.

More details can be found [here](https://mlsdev.com/blog/128-microservices-vs-monoliths-how-to-understand-when-it-s-time-to-use-the-former-option)