DEV Community

Cover image for First steps from monolithic applications to microservices. Part 2
alexdodonov
alexdodonov

Posted on • Edited on

First steps from monolithic applications to microservices. Part 2

Hi! In my previous article I have described how you can start splitting your monolithic applications into services. And one way to do it was to split the backend by cutting one table (or set of tables) from another ones.

But it is not the only way.

I am sure that you have huge pieces of functionality wich are not using database, but they are also suitable candidates to become a microservice.

Here are few examples.

Email sending routine

Usualy if you want to send email in your code you just call sendEmail method, and pass recipient's address, name of the required email template, some variables, wich will be substituted in the email body or headers. And thats all.

But email sending process can be quite tricky. Some kind of template engine can be used, messages can be queued in RabbitMQ (or in it's equivalent). Messages in this queue may be prioritized and so on.

Writing all this I mean that all these email sending details are usually well incapsulated even in a very bad and messy code.

Thus it can be relatively easy be taken out into standalone service.

Interactions with the third-party APIs

This can be a difficult tusk but you surely suld keep in mind that it is also a good candidate to become a proxy service between your monolith and third party API.

The main argument is that these APIs evolute and old versions are deprecated and then become unsupported by their developers.

What you will do if this will happen? You will open your IDE and grep your source code to change it and make work with the new version of the deprecated API. In all places were it is used. May be they are quite numerous )

Don't you think that it is a great idea to have only one place wich must be updated. And standalone proxy-service is a good solution.

Report generation

I know that report generation routines are usually use database, but I nevertheless want to mention it in this article because you usually have some reports wich are independent from each other. Thus you can move them to standalone service one by one.

And reports usually require a lot of CPU and RAM resources, so you can speed up yor application by moving report generation in a separate service on a separet host.

That's all for today! Hope this article was usefull.

PS Subscribe, like, share )

Want more articles?

Subscribe me in Twitter

Or you can get access to my code on github

Top comments (0)