Lately has been a lot of debating and hype around Microservices. But what are microservices? Why is there that amount of noise around a term? Hope this introductory blog post can help you understand what is a microservice and introduce you into the topic.

Photo by Glen Carrie

What are Microservices?

Paraphrasing Martin Fowlers in his article about Microservices, “microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API”. Although he’s making a reference to HTTP APIs, it’s not the only mechanism to communicate services, but it’s becoming the most used due to the growing popularity of the web services.

It’s pretty common to see people getting confused about libraries and microservices when reading about it for first time. Don’t worry, it happened to all of us. They are different in that libraries are running in the same process than the main application, and they communicate using in-process function calls. Another common mistake is to confuse an architecture based on microservices with a modular architecture. While they are similar they’re not exactly the same. It’s true that microservices are implicitly modular but it’s false that every modular architecture uses microservices. In fact, most of the modular applications are monolithic.

As developers, sometimes we tend to organize our code around technical features, such as frontend, backend, helpers, libraries, etc. Microservices are organized around business capabilities and that’s why it’s often confused with modules of a modular application. It means each service performs a business feature and inside this service you can organize the code as you desire. You can think in a service as an independent application which is able to run alone and has value by itself.

“Smart endpoints and dumb pipes” — with that sentence microservice community tries to summarize how the application should be structured in terms of communication. The smart part of the application should reside in the services (endpoints) and communication should be done as simple as possible, using REST APIs or message queues, such as RabbitMQ or ZeroMQ. In fact, message queues is the second most used approach for communicating services, especially those ones that run long-time operations or are not high priority. For instance, if a service needs to communicate with another one that just sends emails, message queues are a nice choice.

Pros and cons

Microservice term has been out there for years but lately, as web services grow, it’s going to generate some hype around it. It’s not the ultimate solution for all your application architectures, because of this you should be aware of the pros and cons.

> Evolutionary Design

This is probably one of the biggest advantages of the microservices architecture. As your application grows it’s easy to plug-in new services with new business capabilities. As most of the software applications are business-driven and market changes so fast you will end up loving this advantage.

> Multiple Programming Languages

Every time you start an application you have to decide in which language you’ll build it. Sometimes you choose one depending on your skills and sometimes depending on the best choice for the application in question. As time goes on and your application grows you end up having to stick to the selected programming language and related technologies you chose. Then you realize that some new features will perform better in another language/framework. Or even worst, that technology doesn’t have a library to use with your programming language. Here is where microservices can help a lot. As every service is a decoupled and independent application you can use a different language/technology for each one, depending on your needs. So, for instance, your application is written in Ruby on Rails and you want to integrate a chat using Node.js.

> Multiple Database Types

Similarly as described before, you can have different types of database in your application. For instance, let’s say your application uses MySQL to handle most of the relational data but for a chat you may prefer to use a time series database such as InfluxDB. I’m not a DB expert, don’t take my word literally on which kind of DB is the best for a chat, it’s just an example.

> Independent Deployable Units

As I said before, a microservice is an independent application and, as such, it can be deployed independently. It means that every time you need to change a service it’s not necessary to re-deploy the entire application. It will make you feel more self confident when you’re about to deploy.

> System Resilience

As a decoupled and distributed system, when some of the services fails (and it will do) just a feature of your application will fail, but the application will be still usable. Moreover, you can have a service monitoring the rest of the services and if one of them fails it will reboot the service.

> Easy to Scale

Imagine your application is allowing to upload images and apply effects over them. Some of these effects may consume a lot of memory and you don’t want it to affect to the rest of the application. Using microservices you can easily add memory (or other resources) to the server/process running this service. It’s easy to scale resources depending on the service needs.

> Deal with Too Many Services

When you’re deciding in how many services you want to split your application it’s easy to get crazy with the service boundaries and end up having lots of services you’ll have to develop and maintain. It will be so easy to introduce unnecessary complexity into the system, and therefore errors. Be careful with that.

> Code Duplication

The same way is nice to have the ability of using different programming languages, it’s also very easy to have the same code in different languages. When it happens within the same language some people suggest to use this code as a library but then you’ll be introducing coupling.

> Testing

Testing is a pro and a con. While it’s fairly easy to test a single service it can be a pain to test the whole system and its integration, since every time you want to test the entire application you have to configure and set every service up.

> Asynchronicity

Asynchronous operations introduces complexity in its coordination and make it really difficult when you need synchronous or transactional operations.

Many of these are not really a disadvantage but just a lack of tools for automating or monitoring. As a friend of mine says: “We need a tool!”.

Should I be using Microservices today?

That’s a great question I often heard. I would start by analyzing the application needs carefully. My advice is that it’s better to start small and easy but without disregarding that your application can grow and you don’t want to suffer it, but enjoy it. Be pragmatic not dogmatic. It’s true that there are well known practices that will work for your application but don’t be afraid to adapt them to your needs.

A common approach that I also follow is to start the application monolithic but modular. After this, start separating these modules into services as you really need it. It will not be easy, as every in-process call you made you’ll have to rewrite as a Remote Procedure Call, you’ll need to mount a new server/process with its own resources and configure them, but believe me, it will be easier than having to start with a tightly-coupled application.

Form Follows Function

This title is an excerpt of a nice quote from Louis Sullivan:

“Whether it be the sweeping eagle in his flight, or the open apple-blossom, the toiling work- horse, the blithe swan, the branching oak, the winding stream at its base, the drifting clouds, over all the coursing sun, form ever follows function, and this is the law. Where function does not change, form does not change.” — Louis Sullivan

***
by Francisco Méndez Vilas
Full Stack Developer at Redbooth

References

Previous ArticleNext Article

Leave a Reply

Your email address will not be published. Required fields are marked *

E.

Essential Podcasts for Entrepreneurs & Tech Lovers

Podcasts are a great way to discover new subjects and new people. Whether you are a tech lover or an entrepreneur, bellow you will discover podcasts for entrepreneurs you should – without a doubt – listen to. 

Itnig Podcast with César Migueláñez, Bernat Farrero and Carlos Pierre
Itnig Podcast with César Migueláñez, Bernat Farrero and Carlos Pierre

« Masters of Scale » 

with Reid Hoffman

The host: Reid Hoffman decides to turn to the corporate world instead of pursuing a university carrier. He worked for Apple, Fujitsu for then starting his own business: SocialNet and left it in 2000 to join Confinity. Confinity gives life to Paypal after fusionning. Finally, in 2003, Hoffman co-founds LinkedIn. He is Master of Scale’s host. 

About: The podcast welcomes some of the greatest entrepreneurs. You will discover throughout the talk how they managed to take their companies from 0 to a lot of zeros. You can listen to Masters of Scale’s special guests like Mark Zuckerberg (Facebook), Selina Tobaccowalla (Evite), Brian Chesky (Airbnb) or Nancy Lublin (Crisis Text Line). Must-hear: one of the top tech podcasts for entrepreneurs.

Listen to the podcast: On their website, Apple Podcasts, Spotify and Youtube

The Team: Reid Hoffman, June Cohen, Deron Triff and Jai Punjabi

« Rocket » 

with Christina Warren, Simone de Rochefort and Brianna Wu

The hosts: Christina Warren started as a Freelance Writer. Then, she worked at Mashable as a Senior Tech Analyst and Tech Correspondent and ended the journey at Microsoft as a Senior Cloud Developer Advocate. About Simone de Rochefort, she is  Senior Video Producer and co-host of The Polygon Show. Brianna Wu founded her first startup at the age of 19, Giant Spacekat. She was Head of Development at the time. She is now running for US Congress. 

About: In this podcast, you will discover three passionate women and their “geek conversation” as they like to call it.  No guest speakers, but you will be able to listen to a panel of tech subjects from Apple to Comics, you will not be disappointed. 

Listen to the podcast: On their website, Apple Podcasts, Overcast, Pocket Casts, Spotify and Castro

« This week in Startups »

with Jason Calacanis

The host: Jason Calacanis starts as an internet industry journalist in New-York. In 2003, he co-founded Weblogs, Inc and then a few years later he joined Sequoia Capital, launched the web directory Mahalo. He also founded ThisWeekIn.com. Furthermore, he created This Week in Startups podcast and a startup named Inside.com. Finally, he was part of the creation of the Sydney Launch Festival. 

About: Either you are looking to start your own company, or you are a successful entrepreneur, or you just love technology, this podcast will give you a peek to the entrepreneurship world. You will hear stories of all kinds! On his website, you will also find his events and some research on transportation, healthcare and more. This is one is part of the tech podcasts for entrepreneurs not to be missed.

Listen to the podcast: Apple Podcasts, Youtube, SoundCloud and RSS Feed

You can also subscribe to their newsletter in order to receive episodes directly. 

The Team: Jason Calacanis, Jacqui Deegan, and Tony Agapiou

« Recode / Decode » 

with Kara Swisher

The host: Kara Swisher is an American journalist specialized in the technology industry. She first started to work for an alternative newspaper in Washington for then working for the Washington Post. She wrote articles for the Wall Street Journal and New York Times and wrote her own books. Finally, in 2014, she created Recode, a website dedicated to the latest technology news. In 2015, she initiates Recode Decode. 

About: The weekly podcast welcomes tech experts and great entrepreneurs. They review how they got there, what’s on their mind about the current industry and what they would improve or create. Her recent guests were Elon Musk (Tesla CEO), former Secretary of State Hillary Clinton and Mark Zuckerberg. 

Listen to the podcast: Apple Podcasts, Google Podcasts, Spotify, Stitcher, and TuneIn

« K Fund PodKast »

with Jaime Novoa

The host: Jaime Novoa’s background is quite diverse. He is a writer and an investor, but he also worked in data analysis and social media analysis. In 2014, he founded Novobrief, a newsletter for startups. Then, in 2016, he becomes an investor at K Fund and he founds, in 2019, Dealflow, a weekly tech newsletter. 

About: The podcast discusses startups, entrepreneurs and Venture Capital. You will discover enterprises and their story. From data science, unicorns or digital platforms, you sure will find more than one interesting podcast. 

Listen to the podcast: On their website and Soundcloud

« Clockwise »

with Dan Moren and Mikah Sargent

The hosts: Dan Moren is an active author and writer as well as podcaster. He was a Senior Editor at Macworld. Today, he hosts two podcast shows: Clockwise and The Rebound. As for Mikah Sargent, he started as a Website Designer and Developer for then switching as a Senior Editor at Newsy. He now hosts few podcasts such as Clockwise on Replay FM or on TWiT.tv. 

About: The weekly podcast discusses technology and welcomes each time 2 special guests. For 30 minutes, they address 4 topics where all four speakers get to elaborate on the matter, highlight the issues and expose their thoughts. 

Listen to the podcast: On their website, Apple Podcasts, Overcast, Pocket Casts, Spotify and Castro

« Itnig Podcast»

with Bernat Farrero

The host: Bernat Farrero starts his career as a Developer. In 2009, he founded Itnig, a startup ecosystem that organizes entrepreneurship events. They also have a coworking for startups, a podcast and a fund for early-stage projects. Furthermore, he is a Founder of Factorial, Quipu and Camaloon. He is also a Board Member of Playfullbet, GymForLess and Parkimeter. Finally, he hosts Itnig’s weekly Podcast. 

About: The podcast welcomes every week a new guest. If you wish to learn from successful entrepreneurs, you are on the right platform. The discussions turn around Technology and its industry. You will come across guests like Carlos Pierre (Badi), Vincent Rosso (BlaBlaCar) or Oscar Pierre (Glovo).

Listen to the podcast: Youtube, Spotify, Apple Podcasts, Ivoox, and Google Podcasts

You can subscribe to their newsletter if you want to receive the podcast’s link every Monday. 

Whether you are at an early stage of your project, an investor or you are just curious, these podcasts for entrepreneurs give you the opportunity to be updated on tech and business news. Also, you get to learn from successful international entrepreneurs, which can definitely be very useful for your business.