Introducing MicroService

In this article, I am 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 first part, I suggest you read part one first:

Part 1

Introducing MicroServiceIn Enterprise software, the team’s main challenge is not product development. This challenge arises after the software is run. Such challenges include managing changes and scaling or rewriting the software if it is not developed properly. To better understand this, we continue the discussion with one example.
Suppose we have a comprehensive insurance software that is integrated software based on monolithic architecture. After a few years, it has been decided to make changes to the parts of the software such as life insurance, travel insurance and health insurance. In this case, for example, changes to health insurance are applied faster and are ready to be sent to the customer, but due to the integrated system, the release of the modified version should be postponed until the completion of the changes in other departments. In another example, consider that due to the increasing number of users on one system, we want to scale out the system. In this case, we need to include a few versions of the whole system in processes independent of each other. In this case, due to the dependencies of the system sections on each other, this is done slowly and scale out costs also increase. Naturally, if the system is divided into smaller subsets, the costs and scale out time will decrease. Now suppose that each of these subsets has the ability to operate as a separate service, in which case what do you think will change the cost of repairs and maintenance?
We will answer this question with a more understandable example. Suppose the subset of the life insurance system is divided into three parts: insurance application, issuance of insurance policy and damage section. Each of these sections can also be presented to the customer separately, for example, the insurance application includes filling out the proposal form, reviewing the information entered by the insurance practitioners and announcing the opinion of insurance experts to increase the insurance rate based on the medical and occupational risks of the insured person, which finally after a few days, the proposed form will be approved by the experts and will be converted into an insurance policy. In this case, it is easier to apply changes or scaling than previous situations, and it is less expensive.

Microservice Architecture

Microservice Architecture

Microservice architecture, or MSA, is a method of developing software systems that has been greatly welcomed among users over the past few years. Although it’s a little difficult to provide an accurate definition for it, many app developers prefer the use of microservice architecture to create their own applications in other ways. Microservice architecture is a service-oriented architecture and is used in the construction of a program to create a collection of related services that run for business capabilities. This feature enables the continuous delivery of complex applications and gives organizations the ability to develop their technologies. Microservice architecture is actually an approach in the field of software development in which a large program is built in a form of modular services. Each module in the microservice architecture pursues a specific purpose and is connected to other modules by a simple and convenient interface. Microservice architecture is a solution to problems that arise in complex programs for programmers. In the microservice architecture, each microservice runs through a unique process and manages its own database. This both enables the development of software with a decentralized approach and allows each service to be run and managed independently. In other words, there is the least centralized management in these services, and each service can be written in a different programming language or have a different database.
Microservice is a way to divide an app or application (not just a mobile app) into smaller, lighter, independent and manageable segments and services. In other words, microservice is a distributed or distributed software development architecture.
In microservice architecture, the application is divided into different services on the server side, and each service is an independent processing process that is considered as one of the specific functionality of the program on the server side. These services are designed solely for the purpose of managing a particular task. For example, the task of a service is to manage users only if the other service’s task is simply to control the search section of the site. Programs written with microservice architecture are not required to run on separate servers, and this requirement is only required if ram consumption is high or if there is a need for high CPU processing power. In this case, it is better for each service to use a separate server, but in the network platform, these services are connected to each other. In this case, given that all microservices are independent of each other, we can easily use different programming languages to write them or store each data on a different database. For example, for traditional data storage, we use MySQL and NoSQL databases to store unpredictable structured data.

Different data storage scenarios in microservice architecture
Here you may be wondering how different services interact with each other in an app that uses microservice architecture? The answer to this question is that a program based on microservice architecture establishes communication between different services through rikostes or HTTP requests and RESTful APIs. In fact, microservice architecture solves the problems that monolithic architecture creates. In microservice architecture, server-side applications are divided into different services, and each service has a different processing process, which is considered as one of the specific capabilities of server-side programs. For example, a payments task service and another service are used to manage accounts.

Service sharing in micro service architecture
In the above diagram, it can be assumed that service 1 is a web server and is associated with the browser to receive requests from the client or user, and the other two are used as API for various other operations.

Microservice Architecture Philosophy

Microservice Architecture Philosophy

Microservice architecture philosophy is similar to Unix’s philosophy. In unix philosophy, one thing is tried to be done, but in a good way. In microservice architecture as well
– The services are small but follow a specific commercial and functional purpose and accomplish it.
– The culture of the organization or company must accept the automating deployment and testing of the software. This is because in microservice architecture, such an approach is needed and by doing so, the burden on management, system administrators and executives will be reduced.
– Culture and design patterns should include a culture of error solving or failure and constantly strive to improve the services.
– The Services must be flexible, responsive and combined with other services and only perform their duties in full.

Microservice Architecture Advantages

Today, modular programs have become a competitive advantage in any industry. The idea in microservice architecture allows developers to develop their apps and applications based on separate components or services that can be easily modified, deleted or updated, and in this case, there is no need to engage the entire app or application. If we want to examine the benefits of microservice architecture in general, we can mention the following:
– Unlike Monolithic architecture, in a program that uses microservice architecture, services are not divided by microservice architecture, but rather by the type of task of those services. In other words, a service such as uploading one file, including parts such as user interface, database-related models, controller, logging system, etc. It will be (in this case, we assume that the developer creates a service called File Uploader and then uses it to build similar services in other projects as well. )
– Another advantage of microservice architecture is to leave programmers’ hands open in using different programming languages for different parts of the project. In fact, given that today some programming languages, in specific sectors and domains, are more specialized and the use of language designed specifically for certain activities will increase the performance of our program, by microservice architecture we can use a separate programming language for each service and the final performance of our application and application at a great level. let’s put it.
– Microservice architectures are so-called Scalable or expandable. The independent nature of different modules in a microservice allows us to develop our app or application using a specific programming language, exclusive database, and even a specific server, and, if needed, merely upgrade resources related to the same platform.
One of the most important and valuable features of microservice architecture relates to the increase in parts of a service (e.g. a service that has only one running part, to a service with two or three separate parts) without having to add other parts of the services it is associated with. This mode can be seen in the figure below.

Add parts of a service in microservice architecture
In this diagram, as you can see, from service number 1, two parts are created on two separate servers, with incoming traffic divided by Balance Loadr and other services remaining as many as they were.

Microservice architecture problems

Microservice architecture problems

– Since server-side applications written with microservice architecture are divided into different services, the development and settings of each of them can be difficult and time-consuming.
– Communication between services is done in microservice architecture on the network platform, so you should expect a slowdown in the performance of the services.
– Due to network communications in applications using microservice architecture, security breaches are more likely in these programs.
– It is difficult to write codes for services that interact with other services on the network platform, and programmers in these situations are involved in issues such as communication, data encryption and conversion.
– Due to the separate parts of the program together, reviewing and monitoring and tracking the performance of the services together is one of the main tasks of developers or users of microservice architecture-based applications.
And finally, the speed of programs written with microservice architecture is slower than programs written with Monolithic architecture. The reason for this also goes back to the executive environment of the programs. Programs written with monolithic architecture are processed on server memory.

Data management in microservice architecture

In microservice architecture, each service can have its own database to store its data or use the central database. Using a dedicated database for each service has its own problems. Problems such as coordination between different services, in which case, if one of the Services is in trouble or disabled, all services that are associated with it will also be in trouble, and this problem will spread in a chain to all services that depend on the data being exchanged with these services. In addition, there are duplicate data in the microservice architecture, and coding will be difficult for this system. As a result, it is better that the Services deal with the central database, and if a particular service needs to generate certain data that is not shared with other services, it can use its own database. Another important point is that the Services should not be directly associated with the central database, but rather a separate service called the Database Service, which is responsible for providing APIs specifically for working with the central database.

To continue the article, see the third part, which is the last part of this article:

Part 3

Leave A Comment

Captcha 70 − = 64

Please Send Email

Your message sent successfully
There has been an error