Five Most Common Questions About Microservices

Posted by: Veselin Mijuskovic April 28, 2021

Category: Topic: DevOps

Here are five frequently asked questions about microservices that you need to ask yourself before you embark on an adventure called developing an app based on microservice architecture. Of course, I suppose you know what an app based on microservice architecture is: an application that is designed as a set of loosely related services that implement application functionality and are independently developed and independently implemented, communicate over a network with a well-defined and standardized protocol (usually HTTP). Microservices provide an encapsulation of functionality and data that the rest of the application sees as a unit without the knowledge how that unit has been implemented and how it works. 

Bear in mind this text is written from the perspective of someone who deals primarily with DevOps and DevSecOps, and comes from the Ops world. Details regarding the use of the best library or environment for the development of microservices are not subject to this text.  

Note: The text expresses ‘microservice’ and ‘service’ as synonyms. The term ‘microservice’ is a bit of a misnomer because it implies that there is a ‘service’ that is significantly larger than ‘microservice’. In reality, there is no point where ‘service’ turns into ‘microservice’ and vice versa. 

How To Know If Microservice Is The Best Way To Build An App 

Microservices bring a number of advantages when creating an app: 

Focus on the Dev and leave the Ops to us

Streamline and automate your workflows to deliver more value. Start your DevOps journey with the help of experts.

Get in touch

But nothing is for free, including microservices. This kind of architecture also brings some additional complications that often become a source of problems: 

So, how do you know if microservice architecture is the right solution for you? If your app is initially very complex, with a bunch of different functionalities, and, perhaps most importantly, for which you expect to grow both in size (by adding new functionalities) and by the number of users, then it makes sense to think about using the microservice approach in the design of your new app. But if your app isn’t that complex and you have a small team and relatively limited means to start with, it might be better off starting with monolithic architecture as it reduces the cost of development and the initial cost of exploitation. If the application starts to grow, then there will be a need to refactor the existing monolithic application into micro-service architecture which in practice has proved to be a better and cheaper solution than to immediately start using microservice architecture. 

Should Smaller Companies And Start-ups Use Microservices? 

This question is related to the previous one – whether to move with microservice architecture at all. As I said, it all depends on what happens to your app in the future. If you assume that the app will certainly become more complex, get new functionality and frequently update existing functionality, become critical to the whole business (which implies that downtime has to be minimal) then it makes sense to start with microservices. 

But again, even though all start-ups want to create their own services/apps to serve the global market, that’s not going to happen with the most of them and, because of the lower initial investment, it’s better to start with a monolithic app that’s well designed and can scale up and out rather than go with microservices from the start. With some luck, the start-up business will grow so much that, at some point in time, the limitations of monolithic architecture will becume a problem, in which case it will be necessary to refactor that application into microservice architecture. But in that case the small company or a start-up will already grow enough that they are no longer a small company or a start-up so they will be able to afford the costs of refactoring and, thus, enable further grow. 

Source: Dev.to

What Determines The Ideal Size Of A Microservice? 

Logic dictates that the application be split into basic services that apply SRP. So, by the definition of SRP,  the service must have only one reason to change. Example: The service that creates and prints reports can be changed because the contents of the report need to be changed or the report format needs to be changed. The theory requires that, in this case, this service should be broken down into two smaller services — one that creates the contents of the report, and the other that formats the specified content into the requested format. 

Microservices must be ‘smart’, because ‘stupid’ tubes are used for connections between microservices (‘stupid’ tubes equals less latency and logic has to be implemented somewhere). The more services there are, the more connections between them has to be established and that becomes the app’s narrow point. For this reason, the decision to determine what is right size and complexity of the microservice lies on the shoulders of the system’s chief architect and his experience. Unfortunately, there is no formula that can help with this decision. 

What Is The Role Of Containers In Microservices? 

Each microservice should be isolated, should have its own data storage system, and should have the ability to scale independently. This means that the microservice requires its own isolated environment which is achieved by some kind of virtual machine. However, since services are generally small in size, the use of the standard, ‘fat’ virtual machine would be excessive, both from the point of resources they require and the point of starting a new service instance when needed. For this reason, the most optimal solution for deploying microservices are containers. Containers provide optimal resource usage and startup speed, and container management systems can provide some functionality of the shelf that is necessary for microservices, like service discovery and API gateways.  

In addition, containers provide testing and deployment automation that is essential for microservice architecture. 

How Is The Security Of Microservices Achieved? 

Microservices bring additional security challenges compared to monolithic architecture because, basically, they increase the attack surface that must be defended. Separating the app into smaller, independent parts that communicate over the network brings a fundamental problem that the microservice must reliably verify who is on the other side of the communication channel. In the case of monolithic applications, this problem does not exist because communication between parts of the application is completely internal. 

The key thing for designing applications based on microservice architecture is that system security must be taken into consideration since the design phase. Communication channels must ensure that the parties that communicate can be reliably authenticated and authorised without increasing the complexity of the communication protocol itself. The principle of ‘defence in depth’ needs to be applied to establish layers of protection around specific microservice. DevSecOps tools need to be included in the continuous development in order to detect bugs in code and deployment.  

Conclusion 

This article should help you determine whether it is cost-effective to start an adventure called microservicel architecture, as well as avoid some major problems with the implementation of microservices. As you may have noticed, microservicel architecture is not the ideal solution to all problems, but on the right occasion, it is the most optimal solution that can bring you a lot of benefits. 

Ready to microservice?

The consultation with our experts is free. Get in touch!

Start

Keep reading

How to Migrate Your Application from Monolith to Microservices

23.09.2021

According to a 2020 O’Reilly report on microservices adoption, 77% of businesses have already adopted microservices, while 92% of them state they are experiencing success after migrating monolith to microservices. The trend to en-masse start using microservices application architecture comes as no surprise considering the multiple benefits that the microservices architecture provides, including: Improved resilience […]

read more

What is Cloud Bursting and Does Your Business Need it?

09.09.2021

Back in 2014, NASA launched a satellite called OCO-2 (Orbiting Carbon Observatory 2) to gain more insight into the Earth’s carbon uptake. Two years later, they had petabytes of gathered data that needed to be processed which would have taken over 3 months and cost about $200,000 if they had used on-premise data centers for […]

read more

How Managed Cloud & Open Source Solutions Fuel Business Growth

29.07.2021

With the modern business landscape becoming more and more saturated and competitive in recent years, companies worldwide face an ongoing challenge of emerging through the noise and initiating growth. The resources are often suboptimal, which can make the process of developing a cost-effective and sustainable business strategy an insurmountable problem for many companies.  Luckily, with […]

read more