Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the advantages of automated micro-service governance

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "what are the advantages of automated microservice governance". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations. I hope you can read carefully and learn something!

Microservice granularity fitness function

One of the biggest headaches for microservice architecture is microservice granularity. From the very beginning, we should follow the law of "two pizza teams," which is:

For the design of a single service, all participants from design, development, testing, and operation add up to only two pizzas.

However, in fact, from the practice of domestic large and medium-sized companies, this is not the case. Often a team maintains more microservices than it does, meaning six developers may maintain eight microservices. A common mistake is to divide microservices by technical dimensions rather than business dimensions. I can't figure out how to automate this part. However, we can determine whether two microservices can be merged: microservice granularity rationality analysis based on Git logs.

Number of service submissions. View individual microservice commits via git log

Change frequency. Find out if there are a lot of simultaneous changes between multiple modules

Demand correlation. Identify whether multiple microservices, modules, and classes change frequently at the same time by identifying submission specifications

Premise: Matches submission specification.

At this point, we just need to use a resolution function similar to coca git to achieve a similar effect.

API fitness function

Coca has built-in API analysis-related functions, which can support identifying Spring API annotations, API methods for service declarations, and analyzing call relationships. So, I don't need to develop such a function, just need to improve it a little, add some points. For API design, this tool does a few things:

API naming conventions. Such as inconsistent naming

Parameter rationality. If too much or too little, should not appear in the URL.

Compliance with RESTful specifications. For example, the words get and post should not appear in the URL, and whether all APIs are posts.

Whether the same resource prefix is used across services.

For most companies, achieving the first level of RESTful is quite difficult.

database table fitness function

Microservices transform inter-service calls from function calls to remote calls, which means that we do not access service B's database directly from service A, but rather access the database through service B's interface. However, in some scenarios, A and B are required to share a database (say, Oracle database instances for a fee), but we need to enforce restrictions on access to tables by A and B services. Therefore, we need to analyze whether there are modifications to the same table between multiple services, or whether there are modifications to multiple tables.

Table and service relationship maintenance. Scan tools like MyBatis to generate tables and service relationship maintenance

Implement snapshot testing of database table-mapping service.

In a nutshell, what our tool does in this part is to automatically scan and generate a snapshot every time the code is submitted. Just compare it to the stored snapshot to determine if there is a problem with the database. Then set up a reasonable tuning formula, that is, this part of the architecture fitness function.

Layered architecture fitness function

After solving the surface problem, we can try to achieve the goal of clean architecture. For layered architecture, what we're going to do is a little bit more complicated. Fortunately, however, complex call relationship recognition has been implemented by Coca. So, for our hierarchical fitness function, we only need to do these things:

Are there function calls between microservices?

Whether all APIs of a single service are in the same package, such as controller.

Whether there are unreasonable common and util modules.

Improved visualization for migration from a three-tier package architecture to a clean architecture.

Simply put, it is to automatically identify the parts described in the System Refactoring and Migration Guide.

data structure fitness function

With regards to data structures/data models, there are already tools that can do similar things. For microservices architecture, some of the judgments we have to make are:

Unreasonable coupling. If a struct/class is called by a large number of other classes at the same time, there must be some irrationality.

Oversize models. It is worth noting that in some big data scenarios, this is actually correct.

Overly complex nesting.

There is no model of behavior.

However, there are different recognition patterns for different use cases.

model analysis

In certain scenarios, the team abstracts a common model into a common module for use by multiple microservices. This pattern itself may be problematic because the models themselves should not be consistent in different bounding contexts.

similarity analysis

Given the relationship between multiplexing and coupling, they are not suggested here. Some copy/paste is required between services, but better ways to do it, such as DSL generation like proto, need to be considered. And it's managed by DDD--better naming for different similar types.

other details

We also need to do some infrastructure, such as the processing of modules:

module flag

build.xml

gradle

pom.xml

bazel

module ownership

demand Association

Submission information identification (regular relationship can be input, configuration)

Record package-demand-service relationship

cluster analysis

……

Well, none of this is easy.

"What are the advantages of automated microservice governance" is introduced here. Thank you for reading it. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report