Features of a microservice

In this article, I’m going to provide you with microservice architecture and the advantages and features of this type of architecture, as well as data management in microservice architecture and when and where we use this architecture. In three sections:Introduction and review of Monolithic and Microservice Part 1, Introduction and Review of Monolithic and Microservice Part 2 and Introduction and Review of Monolithic and Microservice Part 3. Stay with me.
If you haven’t read the second part, I suggest you read the second part first:

Part 2

Features of a microservice

Componentization via Services

Our definition of component is a unit of software that can be replaced and updated on its own. As explained in previous sections, microservices divide a software into smaller services that can be developed on their own. We consider all libraries as components that depend on our software and can be used by calling functions in the software process. While the Services are components that are outside the software process and are accessible by communication mechanisms such as Web Service Request and Remote Procedure Call.
If we want to make changes to a component in integrated systems that are composed of multiple components and these components interact with each other during a process, this change requires the deployment of the entire system. While this will not happen in the micro service architecture, it is enough to re-deploy the service or component that has changed, and other parts will not be changed.

Technology Heterogeneity

Consider a system that consists of multiple services. In this case, we can decide what specific technology to use for each service. This feature allows us to use the best tools available to fix any problems. This, unlike systems that can only use the technology defined in that system, will give our system a lot of flexibility. To better understand this, we review an example together. Suppose we want to increase the performance of part of our system. For this purpose, we can use any technology that can be helpful. For example, in a social networking system, we can store information about users and their communications in a graph-based database and information about users’ posts and comments in a documented database. You can see that we don’t need to use certain technology and we can use the technology we want based on our needs.

Microservices allow us to choose among new technologies. One of the biggest obstacles to the use of new technologies is the system’s dependence on them. In an integrated system, if we want to change the language used or the system database or frameworks, the whole system will suffer these changes, but in microservices, we can make these changes with the lowest cost and time possible. It is important to note that the use of new technology has its own challenges and we need expert and rigorous investigations to use it.

Resilience

In the event that one of the Services is in trouble and this problem does not reach all services in a chain, by separating that service from the system, there will be no disruption in the process and the system will continue to operate without any problems. That means the scope of a service, such as a wall between the service and other departments, prevents them from being effective. In integrated systems, other parts of the system will become unusable if a service fails. Of course, by installing different versions on different machines, the impact of these problems can be reduced to some extent. With microservices, we can design systems that act against errors in the system in a way that does not disturb the system’s process.

Scaling

Scaling in micro service architecture

Supposing there is a problem with the operation of a section as part of a system. If our system uses integrated architecture, we will have to scale the whole system if this problem has only occurred in a small part of the system. In contrast, if we use microservice architecture on the system, we can scale only the same service or part that is in trouble and the rest of the system will be unchanged.
Gilt is an online clothing store that uses microservice architecture due to problems with system performance. The store started working with an integrated software in 2007, but after 2 years the system was no longer able to cover the site’s traffic, so they decided to have a better and more effective result with the volume of traffic received by dividing the main parts of the system into microservices. The Gilt system is currently composed of about 450 microservice, each of which is running on several different machines.

Ease of Deployment

Changing a line of program codes made up of millions of lines of code requires programmers to redeploy the entire system and release new versions of the program. This reintegration can take a high risk, forcing programmers to make further changes and publish other versions, and this volume of changes can cause a hit to the program provided. However, in microservice, small changes do not affect the whole system and changes are applied solely to the desired service, and in case of problems in the system, the origin of these problems is known and the system can be restored to a better state faster. This feature is one of the reasons why prominent companies such as Netflix and Amazon have turned to microservice architecture.

Organizational Alignment

Many of us have experienced problems with big projects and big teams, and these problems will increase, especially when team members are not focused together. We know that if a small team works on a smaller piece of code, it’s much more effective than when a big team is involved in working on a big code. Micro service allows us to align our architecture with our organizational structure and help us to increase the efficiency and impact of teams in the organization by dividing the program structure into smaller sections and creating smaller teams specific to each sector.

Composability

Composability in micro service architecture

One of the key features that exists in distributed and service-oriented systems is the reusability of system functionality. Microservices allow us to use system functionality in a variety of ways and for a variety of purposes. It matters to us how users use our software. Now we need to think about the different ways they can combine system capabilities to be used in web applications, mobiles or other tools. In microservices, the main thinking is to separate different parts of the system, and in addition, these parts are accessible from the outside so that we can create different parts by changing the conditions.

Optimizing for Replaceability

If you’re working in a medium or large organization, you may have encountered an outdated system that’s operating in a part of the organization that no one is in the mood to approach or make changes to under the pretext that it’s troublesome and risky. Using themicroservice architecture, the cost of these changes is lower and these changes are applied with less risk.

Optimizing for Replaceability
When do we use microservice architecture?

  • If the source code of your project is so bulky that it is difficult to develop it locally (such as loading the whole project into an IDE), in this case it is better to use microservice architecture because the process of بیلدing some large projects that use Monolithic architecture sometimes takes tens of minutes.
  • Only some parts of the program need to be developed, and if you have used monolithic architecture, you will necessarily need to upgrade the entire system if you do not need to upgrade the entire system.
  • In the event that the developers are not together and cannot work on the project independently.

In fact, there is no clear rule of thumb for choosing between microservice architecture and Monolithic architecture, and the best reason to use microservice architecture instead of Monolithic architecture is the team’s preference to avoid the problems that Monolithic architecture poses.If the developer team decides to redirect from Monolithic architecture to microservice architecture, there is no need to write the whole program from scratch. In this case, only the components that have become troublesome will become the type of service. This type of server-side program, the main part of which is monolithic but some of their specific functions are written as a service, is called microservice with monolithic kernal.

Differences in Monolithic, Microservice and SOA Architectures

Monolithic-microservic architecture difference

When we talk about microservices, the question arises whether this architecture is the service-oriented architecture that was introduced a decade ago or not? Due to similarity, these two types of architecture can be eligible to have the favorite advantages of service-oriented architectural advocates in micro servic architecture. There are many definitions of service-oriented architecture and usually this type of architecture is confused with architectures including several integrated services.
Clearly, there are failed implementations of service-oriented architecture focusing on reducing FBS complexities that, despite spending too much money, have not led to favorable outputs. Many of the techniques used in microservice architecture are derived from the experiences of integrated service developers in large organizations. In fact, the use of the web platform, as well as simple communication protocols, is a response to centralized and complex standards.
Finally, the problems of centralized management in service-oriented architecture have led microservice architecture advocates to abandon soa architecture completely. However, others consider micro service architecture to be a state of service-oriented architecture.