Micro-service module construction method and device, electronic equipment and storage medium

By obtaining historical business data in the power service system and dividing microservice projects and load balancing allocation, the delay and fault propagation problems caused by the interaction mode between services under the microservice architecture are solved, the system's high availability and data consistency are improved, and the system's high availability and data consistency are improved. User experience and service quality.

CN119127232APending Publication Date: 2024-12-13GUANGZHOU KETENG INFORMATION TECH

Patent Information

Application Number
CN202411091589.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In the face of large business volume and high dependence between services, traditional power grid systems are difficult to efficiently handle communication between services to ensure high system availability, data consistency and security. Especially under the microservice architecture, complex interaction modes between services It is easy to cause problems with increasing delays and fault propagation.

Method used

By obtaining historical business data of the power service system, dividing business types and deploying them into microservice projects, and providing services to microservice modules based on load balancing and business types, reducing coupling and dependence between microservice modules and improving system High availability and data consistency.

Benefits of technology

It effectively avoids the problems of increasing latency and fault propagation when the business volume is large, ensures efficient communication and data security of the system, and improves user experience and service quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127232A_ABST
    Figure CN119127232A_ABST
Patent Text Reader

Abstract

The invention discloses a micro-service module construction method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining historical business data of a power service system, the historical business data comprising a plurality of data groups, each data group corresponding to a business processing process, and the data group comprising at least one business type used in the business processing process; determining the processing times of the service types and the correlation degree between the service types according to the historical service data; dividing the business type into a plurality of micro-service items based on the processing times and the correlation degree, wherein each micro-service item corresponds to at least one business type; deploying the micro-service items in the power service system to obtain a plurality of micro-service modules; and when the electric power service system processes the business, carrying out business distribution on the micro-service module based on the load balance and the business type. The problems of delay increase, fault propagation and the like caused when the service volume is relatively large are avoided, and the consistency and the security of data are ensured while communication between services is efficiently processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of power grid service technology, and in particular to a microservice module construction method, device, electronic device and storage medium. Background Art

[0002] With the rapid development of the power industry and the growing demand for intelligence, traditional power grid systems are facing more and more challenges, including system scalability, reliability, maintainability and security.

[0003] The traditional power service system adopts a monolithic architecture, which has the problems of high complexity, high maintenance cost and difficult upgrading. In addition, when faced with large business volume and high dependence between services, it is difficult to efficiently handle communication between services and ensure high availability of the system while ensuring data consistency and security. Especially under the microservice architecture, the complex interaction mode between services is prone to increase latency, fault propagation and other problems, affecting user experience and service quality. Summary of the invention

[0004] The present invention provides a microservice module construction method to solve the problem that complex interaction modes between services in the existing microservice architecture easily lead to increased delays, fault propagation and other problems.

[0005] In a first aspect, the present invention provides a microservice module construction method, which is applied to a power service system, comprising:

[0006] Acquire historical business data of the electric power service system, the historical business data including a plurality of data groups, each of the data groups corresponding to a business processing process, and the data group including at least one business type used in the business processing process;

[0007] Determine the number of times the service type is processed and the degree of association between the service types according to the historical service data;

[0008] Dividing the business type into a plurality of microservice items based on the number of processing times and the correlation, each of the microservice items corresponding to at least one of the business types;

[0009] Deploy the microservice project in the power service system to obtain multiple microservice modules;

[0010] When the power service system processes services, the microservice modules are allocated services based on load balancing and the service type.

[0011] In a second aspect, the present invention provides a microservice module construction device, comprising:

[0012] A historical business data acquisition module, used to acquire historical business data of the power service system, wherein the historical business data includes a plurality of data groups, each of which corresponds to a business processing process, and the data group includes at least one business type used in the business processing process;

[0013] A service type feature acquisition module, used to determine the number of times the service type is processed and the degree of association between the service types according to the historical service data;

[0014] A microservice project division module, used to divide the business type into a plurality of microservice projects based on the number of processing times and the correlation, each of the microservice projects corresponding to at least one of the business types;

[0015] A microservice module deployment module, used to deploy the microservice project in the power service system to obtain multiple microservice modules;

[0016] The service allocation module is used to allocate services to the microservice modules based on load balancing and the service type when the power service system processes services.

[0017] In a third aspect, the present invention provides an electronic device, the electronic device comprising:

[0018] at least one processor; and

[0019] a memory communicatively connected to the at least one processor; wherein,

[0020] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the microservice module construction method described in the first aspect of the present invention.

[0021] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the microservice module construction method described in the first aspect of the present invention when executed.

[0022] The embodiment of the present invention provides a method for constructing a microservice module, including: obtaining historical business data of an electric power service system, the historical business data including multiple data groups, each data group corresponding to a business processing process, and the data group including at least one business type used in the business processing process; determining the number of processing times of the business type and the correlation between the business types according to the historical business data; dividing the business type into multiple microservice projects based on the number of processing times and the correlation, each microservice project corresponding to at least one business type; deploying the microservice project in the electric power service system to obtain multiple microservice modules; when the electric power service system processes the business, the microservice modules are allocated based on load balancing and business types. Each microservice project corresponds to at least one business type, and the business types with higher correlation can be concentrated in the same microservice module, and the business corresponding to the business types with higher correlation can be processed in the same microservice module, which can reduce the coupling and dependence between the microservice modules, and the business types with more processing times can also be added with multiple microservice modules accordingly, so as to avoid the problems of increased delay and fault propagation when the business volume is large, and ensure the consistency and security of data while efficiently processing the communication between services and ensuring the high availability of the system, and guarantee the user experience and service quality.

[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0025] Figure 1 is a flow chart of a microservice module construction method provided in Embodiment 1 of the present invention;

[0026] Figure 2 is a flow chart of a microservice module construction method provided in Embodiment 2 of the present invention;

[0027] Figure 3 It is a structural diagram of a microservice module construction device provided in Embodiment 3 of the present invention;

[0028] Figure 4 It is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0030] Embodiment 1

[0031] Figure 1 This is a flowchart of a microservice module construction method provided in the first embodiment of the present invention. This embodiment is applicable to the case of constructing a microservice module in a power service system. The method can be executed by a microservice module construction device. The microservice module construction device can be implemented in the form of hardware and / or software. The microservice module construction device can be configured in an electronic device. Figure 1 As shown, the microservice module construction method includes:

[0032] S101. Acquire historical business data of a power service system, where the historical business data includes multiple data groups.

[0033] Each data group corresponds to a business processing process, and the data group includes at least one business type used in the business processing process. The data group is the summary data of the business processing process, and the data group may include: business order number, business type, processing time and information of the person who processed it.

[0034] Business types can be specifically divided into: electricity usage inquiry, electricity payment, account holder information, change of account opening bank, electricity maintenance, etc.

[0035] S102: Determine the number of times a service type is processed and the degree of association between the service types according to historical service data.

[0036] The number of times each service type is processed can be determined based on the number of times the service type appears in historical service data. The more times the service type is processed, the greater the demand for the service type is for users.

[0037] The correlation between service types can be the frequency of any two or more service types being processed at the same time. The more the frequency of being processed at the same time, the higher the correlation between the two or more service types. It also means that for users, the demand for processing the two or more service types at the same time is greater. For example, users usually pay the bills while inquiring about electricity usage. If the demand for electricity usage inquiry and electricity payment to be processed at the same time is large, the two service types can be regarded as related services, and the correlation between the two service types is high.

[0038] The number of times a single service type is processed may be the number of times services of only this service type are processed in one service processing process, or may be the total number of times this service type is processed in all historical service data, which is not limited in this embodiment.

[0039] S103: Divide the business type into multiple microservice projects based on the number of processing times and the correlation, and each microservice project corresponds to at least one business type.

[0040] After obtaining the number of processing times of business types and the correlation between business types, on the one hand, for business types with more processing times, more microservice projects can be set, and the microservice projects at this time correspond to one business type; on the other hand, for two or more business types with a high correlation between business types, the corresponding microservice projects can be set uniformly and centrally, that is, the microservice projects at this time correspond to two or more business types.

[0041] It should be noted here that the number of each microservice project may be one or more.

[0042] S104. Deploy the microservice project in the power service system to obtain multiple microservice modules.

[0043] There is a one-to-one correspondence between microservice projects and microservice modules. Microservice projects are equivalent to the deployment instruction files of microservice modules. Microservice modules are deployed in the power service system based on the deployment instruction files. Microservice modules are used to process business. For microservice modules that merge two or more types of business, when it is necessary to process two or more types of business at the same time, they can be processed in the same microservice module without interacting with other microservice modules. This can avoid problems such as increased delays and fault propagation when the business volume is large, and ensure data consistency and security while efficiently processing communication between services and ensuring high availability of the system.

[0044] For a microservice module that corresponds to only one type of business, when the microservice module corresponds to multiple microservice projects, the number of microservice modules is also multiple, indicating that the number of microservice modules is consistent with the demand for the business type. When the demand for the business type is large, the number of microservice modules is also large. When the user's demand for a certain type of business is large, the power service system can also quickly handle these business types (corresponding businesses).

[0045] Microservice module deployment includes the following steps:

[0046] (1) In the power service system, the data model and business logic are designed for each microservice project to obtain multiple initial modules;

[0047] (2) Define the communication interface between the initial modules;

[0048] Specifically, protocols such as RESTful or gRPC are used to define the communication interface between microservices to ensure interface standardization, ease of use and security.

[0049] (3) Containerize and orchestrate each initial module to obtain a constructed microservice module;

[0050] Use Docker to containerize and encapsulate each microservice to achieve lightweight deployment of services, and use Kubernetes or Docker Compose to orchestrate services to improve resource utilization and fault isolation capabilities.

[0051] (4) Assign message middleware to the microservice module, and the message middleware is used to store message queues.

[0052] Use message middleware such as RabbitMQ, Kafka or NATS between microservice modules to implement asynchronous communication mode, improve system processing capabilities and response speed, and ensure reliable message delivery.

[0053] In addition, when deploying microservice modules, you can establish a GitLabCI / CD pipeline to automate the code testing, building, and deployment processes, accelerate the launch of new features, and shorten the iteration cycle.

[0054] S105. When the electric power service system processes services, the microservice modules are allocated services based on load balancing and service types.

[0055] Load balancing is a technology that distributes workloads across multiple computing resources or system components to achieve better performance, reliability, and scalability.

[0056] Each microservice module corresponds to a certain business type, that is, each microservice module can only handle its corresponding business type. Therefore, the business type is one of the factors that need to be considered when allocating business. On the other hand, it also reduces the interaction and coupling between microservice modules. When the power service system processes business, the business allocation of microservice modules based on load balancing and business type can handle different business types in an orderly and efficient manner, avoiding problems such as increased delays and fault propagation when the business volume is large.

[0057] It should also be noted that some microservice modules correspond to one type of business, called Class A microservice modules, and Class A microservice modules also occupy less computing resources when running; another part of the microservice modules correspond to two or more types of business, called Class B microservice modules, and Class B modules also occupy more computing resources when running. When implementing load balancing, you can set them by category. For Class A microservice modules, allocate more computing resources and set a higher load threshold. For Class B microservice modules, allocate less computing resources and set a smaller load threshold.

[0058] Class A microservice modules and Class B microservice modules usually have overlapping business types. For example, Class B microservice module B1 is for electricity payment and electricity query. Class A microservice module B1 is for electricity payment. Class A microservice module A2 is for electricity query. B1 has overlapping business types with A1 and A2. If a user needs to use both electricity payment and electricity query at the same time, in order to reduce the interaction between microservices, it can be allocated to B1 first. When the business load of B1 is large (overloaded), it can be allocated to A1 and A2. If a user needs to use one of the business types of electricity payment or electricity query at the same time, in order to reduce the amount of resources occupied when the microservice module is running, it can be allocated to A1 or A2 first. When the business load of A1 or A2 is large, it can be allocated to B1.

[0059] The embodiment of the present invention provides a method for constructing a microservice module, including: obtaining historical business data of an electric power service system, the historical business data including multiple data groups, each data group corresponding to a business processing process, and the data group including at least one business type used in the business processing process; determining the number of processing times of the business type and the correlation between the business types according to the historical business data; dividing the business type into multiple microservice projects based on the number of processing times and the correlation, each microservice project corresponding to at least one business type; deploying the microservice project in the electric power service system to obtain multiple microservice modules; when the electric power service system processes the business, the microservice modules are allocated based on load balancing and business types. Each microservice project corresponds to at least one business type, and the business types with higher correlation can be concentrated in the same microservice module, and the business corresponding to the business types with higher correlation can be processed in the same microservice module, which can reduce the coupling and dependence between the microservice modules, and the business types with more processing times can also be added with multiple microservice modules accordingly, so as to avoid the problems of increased delay and fault propagation when the business volume is large, and ensure the consistency and security of data while efficiently processing the communication between services and ensuring the high availability of the system, and guarantee the user experience and service quality.

[0060] Embodiment 2

[0061] Figure 2 This is a flow chart of a microservice module construction method provided in Embodiment 2 of the present invention. Embodiment 2 of the present invention is optimized based on Embodiment 1 above. Figure 2 As shown, the microservice module construction method includes:

[0062] S201. Acquire historical business data of a power service system, where the historical business data includes multiple data groups.

[0063] Each data group corresponds to a business processing process, and the data group includes at least one business type used in the business processing process.

[0064] S201 is similar to S101 in the first embodiment, and the details may refer to the relevant description of S101.

[0065] S202. Count the individual processing frequency of each business type according to historical business data as the number of processing times of each business type.

[0066] Different from the first embodiment, the processing times of the service types in this embodiment are the individual processing frequencies of each service type counted in the historical service data, rather than the total number of occurrences of a single service type in the historical service data.

[0067] S203: Set two or more business types that appear in the same business processing process as a business combination.

[0068] S204: Count the occurrence frequency of each business combination as the correlation between the business types in the business combination.

[0069] S205. Divide the business type into multiple independent microservice projects based on the number of processing times and the degree of correlation.

[0070] Each microservice project corresponds to at least one business type.

[0071] In an optional example, the microservice project includes a first microservice project and a second microservice project, and the business type is divided into multiple microservice projects based on the number of processing times and the correlation, including: for each business type, setting a corresponding first microservice project according to the number of processing times of the business type, and the number of each first microservice project is positively correlated with the number of processing times; setting a corresponding second microservice project according to a business combination with a correlation greater than a preset correlation threshold, and the number of each second microservice project is positively correlated with the correlation.

[0072] In another optional example, the microservice project includes a first microservice project and a second microservice project, and the business type is divided into multiple microservice projects based on the number of processing times and the correlation, including: for each business type, the number of processing times of the business type is used as the initial number of the corresponding first microservice project; the corresponding second microservice project is set according to the business combination whose correlation is greater than a preset correlation threshold, and the number of second microservice projects is positively correlated with the correlation; for each business type, the number of second microservice projects including the business type is determined to obtain the number of existing projects; the difference between the initial number corresponding to the business type and the number of existing projects is used as the final number of the first microservice project corresponding to the business type, and the corresponding first microservice project is set based on the final number.

[0073] Compared with the previous example, in this example, the number of first microservice projects is adjusted. For the business types already included in the second microservice project, the number of corresponding first microservice projects can be appropriately reduced, so that when the microservice modules are deployed according to the microservice projects in the subsequent steps, lightweight deployment can be achieved. However, the total amount of this business type is the same as the number of times this business type is processed. Therefore, it can also be guaranteed that this business type can be processed quickly and efficiently.

[0074] S206. Deploy the microservice project in the power service system to obtain multiple microservice modules.

[0075] S207. When the electric power service system processes services, the microservice modules are allocated services based on load balancing and service types.

[0076] S206-S207 are similar to S104-S105 in the first embodiment, and the details can refer to the relevant description of S104-S105.

[0077] In this embodiment, the frequency of individual processing of each business type is counted according to the historical business data as the number of times each business type is processed; two or more business types that appear in the same business processing process are set as a business combination; the frequency of occurrence of each business combination is counted as the correlation between the business types in the business combination, so as to reasonably set the number of each microservice project (module). In addition, when setting the number of the first microservice project, the total amount of business types corresponding to each first service project in the power service system is taken into account, which can ensure that the business type can be processed quickly and efficiently, and can also enable lightweight deployment when deploying microservice modules according to microservice projects in subsequent steps.

[0078] In an optional embodiment, the microservice module is provided with a corresponding message middleware, and the message middleware is used to store the message queue. The microservice module construction method also includes: when the power service system processes the business, calculating the queue length of the message queue of each microservice module; obtaining the capacity threshold of the message queue corresponding to the microservice module; updating the capacity threshold of the message queue corresponding to the microservice module based on the queue length; the queue length of the message queue of the microservice module is calculated using the following formula:

[0079] Qlen=(Prate-Crate) / Δt;

[0080] Among them, Qlen represents the queue length of the message queue, Prate is the message production rate, Crate is the message consumption rate, and Δt is the size of the time window.

[0081] Using the above formula to calculate the queue length of the message queue of the microservice module can ensure the balance between the message processing rate and the production rate and avoid message backlogs. You can analyze the specific scenarios of the application and identify the production and consumption characteristics of key message flows, including peak hours, average processing time, etc. Determine the appropriate monitoring time window Δt, such as 1 minute, 5 minutes or longer, and flexibly select it according to business needs and system response requirements. When Prate>Crate, it indicates that there is a risk of message backlog and the queue capacity should be increased; otherwise, consider reducing the queue length appropriately to save resources. Apply the calculated queue length adjustment value to the message queue system (such as RabbitMQ, Kafka) to achieve dynamic expansion or reduction. This may require the message queue service to support dynamic configuration updates or to adjust queue parameters through automated scripts.

[0082] When there is a risk of message backlog, an alarm is triggered and sent to the operation and maintenance team or countermeasures are automatically taken, such as starting the backup message middleware, adjusting the message processing priority, etc., to quickly alleviate the backlog problem. At the same time, a regular review mechanism is implemented to analyze the reasons for the message backlog, for example, whether it is a sudden increase in production rate, consumer processing delay or system bottleneck, and optimize the system configuration or adjust the message processing logic accordingly.

[0083] In an optional embodiment, the microservice module construction method also includes: obtaining at least one performance indicator of each microservice module during the use of the microservice module; calculating the health score of the microservice module based on the performance indicator; when the health score is lower than a preset health threshold, marking the microservice module as abnormal.

[0084] Optionally, performance indicators include CPU usage, memory usage, response time, and service availability. The health score of the microservice module is calculated using the following formula;

[0085] Health_Score=α*CPU_Util+β*Mem_Usage+γ*Resp_Time+δ*Availability;

[0086] Among them, Health_Score is the health score, CPU_Util is the CPU utilization, Mem_Usage is the memory usage, Resp_Time is the response time, Availability is the service availability, and α, β, γ, and δ are custom weight coefficients.

[0087] In an optional embodiment, for the microservice module, the circuit breaker rules and degradation strategies are set in the circuit breaker framework so that when some microservice modules are unavailable, the system can still provide basic functions; the specific implementation steps are:

[0088] (1) Monitor request status: Integrate monitoring tools such as Prometheus or Zipkin into the microservice architecture to collect the response status of each external service request in real time. Record the number of successful and failed requests to provide data support for subsequent calculations.

[0089] (2) Define the time window T: According to business requirements and system response time characteristics, determine an appropriate time window T, such as the past 5 minutes, 10 minutes, or half an hour. This window is used to count the recent request status to reflect the immediate service health status.

[0090] (3) Calculate the failed request ratio Frate: within the selected time window T, the failed request ratio Frate = Failed_Requests / Total_Requests;

[0091] Failed_Requests is the number of failed requests, and Total_Requests is the total number of requests.

[0092] (4) Setting the fault tolerance factor ∈: Based on historical data and business tolerance, the fault tolerance factor ∈ is reasonably set. This value is usually a small positive number to prevent premature circuit breaking due to short-term request failures. It is generally determined based on empirical values ​​or system stability requirements.

[0093] (5) Apply the formula to calculate the fuse threshold: Use the formula Threshold = Frate*N+∈, where N is the total number of requests in the time window, to calculate the precise threshold for fuse triggering. This value will serve as the decision basis for the fuse mechanism.

[0094] Implement circuit breaker logic: Integrate circuit breaker components such as Hystrix or Resilience4j in the microservice framework and configure circuit breaker thresholds. Once the proportion of failed requests reaches or exceeds the threshold, the circuit breaker logic is activated immediately, and requests to the problematic service are stopped. Instead, the degradation strategy is executed or the default value is returned to protect the stability of the system.

[0095] Monitoring and recovery strategy: Implement post-fuse monitoring and record the fuse status and duration. Set retry logic after fuse, such as trying to reconnect to the service after a period of time (cooling period), or gradually relax the fuse limit according to the service recovery situation until the service call is fully restored.

[0096] Feedback and optimization: Collect data such as the frequency, impact range, and recovery status of circuit breaker triggers, and regularly analyze the effectiveness of circuit breaker strategies. According to the analysis results, adjust the circuit breaker threshold, time window, or fault tolerance factor in a timely manner, and continuously optimize the circuit breaker strategy to adapt to business changes and system evolution.

[0097] Through the above steps, we can ensure that the circuit breaker mechanism can not only respond quickly to service failures, but also automatically restore normal service calls when the system recovers, thereby improving the elasticity and reliability of the entire microservice architecture.

[0098] Embodiment 3

[0099] Figure 3 This is a schematic diagram of the structure of a microservice module construction device provided in Embodiment 3 of the present invention. Figure 3 As shown, the microservice module construction device includes:

[0100] The historical business data acquisition module 301 is used to acquire the historical business data of the power service system, wherein the historical business data includes a plurality of data groups, each of which corresponds to a business processing process, and the data group includes at least one business type used in the business processing process;

[0101] A service type feature acquisition module 302, configured to determine the number of times the service type is processed and the degree of association between the service types according to the historical service data;

[0102] A microservice project division module 303 is used to divide the business type into multiple microservice projects based on the number of processing times and the correlation, and each of the microservice projects corresponds to at least one of the business types;

[0103] A microservice module deployment module 304 is used to deploy the microservice project in the power service system to obtain multiple microservice modules;

[0104] The service allocation module 305 is used to allocate services to the microservice modules based on load balancing and the service type when the power service system processes services.

[0105] Optionally, the service type feature acquisition module 302 includes:

[0106] A processing times determination submodule, used for counting the individual processing frequency of each of the service types according to the historical service data as the processing times of each of the service types;

[0107] A service combination setting submodule, used to set two or more service types appearing in the same service processing process as a service combination;

[0108] The correlation determination submodule is used to count the occurrence frequency of each of the service combinations as the correlation between the service types in the service combinations.

[0109] Optionally, the microservice project includes a first microservice project and a second microservice project, and the microservice project division module 303 includes:

[0110] An initial quantity determination submodule, for each of the business types, using the number of processing times of the business type as the initial quantity of the corresponding first microservice item;

[0111] A second microservice project setting submodule, configured to set corresponding second microservice projects according to the business combination whose correlation is greater than a preset correlation threshold, wherein the number of the second microservice projects is positively correlated with the correlation;

[0112] The existing project quantity confirmation submodule is used to determine the number of the second microservice projects that include the business type for each of the business types, and obtain the number of existing projects;

[0113] A final quantity confirmation submodule, used to use the difference between the initial quantity corresponding to the business type and the number of existing projects as the final quantity of the first microservice project corresponding to the business type;

[0114] The first microservice project setting submodule is used to set the corresponding first microservice project based on the final quantity.

[0115] Optionally, the microservice module deployment module 304 includes:

[0116] An initial module design submodule, used to design a data model and business logic for each of the microservice projects in the power service system to obtain a plurality of initial modules;

[0117] An interface definition submodule, used to define the communication interface between the initial modules;

[0118] A containerization submodule is used to containerize and orchestrate each of the initial modules to obtain a constructed microservice module;

[0119] The message middleware allocation submodule is used to allocate message middleware to the microservice module, and the message middleware is used to store message queues.

[0120] Optionally, the microservice module is provided with a corresponding message middleware, and the message middleware is used to store a message queue. The microservice module construction device further includes:

[0121] A queue length calculation module, used to calculate the queue length of the message queue of each microservice module when the power service system processes business;

[0122] A capacity threshold acquisition module, used to obtain the capacity threshold of the message queue corresponding to the microservice module;

[0123] A capacity threshold updating module, used to update the capacity threshold of the message queue corresponding to the microservice module based on the queue length;

[0124] The queue length of the message queue of the microservice module is calculated using the following formula:

[0125] Qlen=(Prate-Crate) / Δt;

[0126] Among them, Qlen represents the queue length of the message queue, Prate is the message production rate, Crate is the message consumption rate, and Δt is the size of the time window.

[0127] Optionally, the microservice module construction device further includes:

[0128] A performance indicator acquisition module, used to acquire at least one performance indicator of each microservice module during the use of the microservice module;

[0129] A health score calculation module, used to calculate the health score of the microservice module according to the performance indicator;

[0130] The abnormal marking module is used to mark the microservice module as abnormal when the health score is lower than a preset health threshold.

[0131] Optionally, the performance indicators include CPU usage, memory usage, response time and service availability, and the health score of the microservice module is calculated by the following formula;

[0132] Health_Score=α*CPU_Util+β*Mem_Usage+γ*Resp_Time+δ*Availability;

[0133] Among them, Health_Score is the health score, CPU_Util is the CPU utilization, Mem_Usage is the memory usage, Resp_Time is the response time, Availability is the service availability, and α, β, γ, and δ are custom weight coefficients.

[0134] The microservice module construction device provided in the embodiment of the present invention can execute the microservice module construction method provided in any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method.

[0135] Embodiment 4

[0136] Figure 4 A schematic diagram of the structure of an electronic device 40 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0137] like Figure 4 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.

[0138] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0139] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The processor 41 executes the various methods and processes described above, such as a microservice module construction method.

[0140] In some embodiments, the microservice module construction method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the microservice module construction method described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to execute the microservice module construction method in any other appropriate manner (e.g., by means of firmware).

[0141] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0142] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0143] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0144] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0145] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0146] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0147] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0148] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A microservice module construction method, applied to a power service system, characterized in that: include: Acquire historical business data of the electric power service system, the historical business data including a plurality of data groups, each of the data groups corresponding to a business processing process, and the data group including at least one business type used in the business processing process; Determine the number of times the service type is processed and the degree of association between the service types according to the historical service data; Dividing the business type into a plurality of microservice items based on the number of processing times and the correlation, each of the microservice items corresponding to at least one of the business types; Deploy the microservice project in the power service system to obtain multiple microservice modules; When the power service system processes services, the microservice modules are allocated services based on load balancing and the service type.

2. The microservice module construction method according to claim 1, characterized in that: The determining, according to the historical service data, the number of times the service type is processed and the degree of association between the service types comprises: Counting the individual processing frequency of each of the business types according to the historical business data as the number of processing times of each of the business types; Two or more business types appearing in the same business processing process are set as a business combination; The occurrence frequency of each of the service combinations is counted as the correlation between the service types in the service combinations.

3. The microservice module construction method according to claim 2, characterized in that: The microservice project includes a first microservice project and a second microservice project, and the business type is divided into a plurality of microservice projects based on the number of processing times and the correlation, including: For each of the business types, the number of times the business type is processed is used as the initial number of the corresponding first microservice item; According to the business combination whose correlation is greater than a preset correlation threshold, a corresponding second microservice project is set, and the number of the second microservice projects is positively correlated with the correlation; For each of the business types, determine the number of the second microservice projects that include the business type, and obtain the number of existing projects; The difference between the initial quantity corresponding to the business type and the number of existing projects is used as the final quantity of the first microservice project corresponding to the business type; The first microservice project corresponding to the final quantity is set.

4. The microservice module construction method according to claim 1, characterized in that: The microservice project is deployed in the power service system to obtain multiple microservice modules, including: In the power service system, a data model and business logic are designed for each microservice project to obtain a plurality of initial modules; defining a communication interface between said initial modules; Containerize and package each of the initial modules to obtain a constructed microservice module; A message middleware is allocated to the microservice module, and the message middleware is used to store a message queue.

5. The microservice module construction method according to any one of claims 1 to 4, characterized in that: The microservice module is provided with a corresponding message middleware, and the message middleware is used to store a message queue. The microservice module construction method further includes: When the power service system processes business, calculating the queue length of the message queue of each of the microservice modules; Obtaining a capacity threshold of a message queue corresponding to the microservice module; Updating a capacity threshold of a message queue corresponding to the microservice module based on the queue length; The queue length of the message queue of the microservice module is calculated using the following formula: Qlen=(Prate-Crate) / Δt; Among them, Qlen represents the queue length of the message queue, Prate is the message production rate, Crate is the message consumption rate, and Δt is the size of the time window.

6. The microservice module construction method according to any one of claims 1 to 4, characterized in that: Also includes: During the use of the microservice modules, obtaining at least one performance indicator of each of the microservice modules; Calculate the health score of the microservice module according to the performance indicator; When the health score is lower than a preset health threshold, the microservice module is marked as abnormal.

7. The microservice module construction method according to claim 6, characterized in that: The performance indicators include CPU usage, memory usage, response time and service availability. The health score of the microservice module is calculated by the following formula: Health_Score=α*CPU_Util+β*Mem_Usage+γ*Resp_Time+δ*Availability; Among them, Health_Score is the health score, CPU_Util is the CPU utilization, Mem_Usage is the memory usage, Resp_Time is the response time, Availability is the service availability, and α, β, γ, and δ are custom weight coefficients.

8. A microservice module construction device, characterized in that: include: A historical business data acquisition module, used to acquire historical business data of the power service system, wherein the historical business data includes a plurality of data groups, each of which corresponds to a business processing process, and the data group includes at least one business type used in the business processing process; A service type feature acquisition module, used to determine the number of times the service type is processed and the degree of association between the service types according to the historical service data; A microservice project division module, used to divide the business type into a plurality of microservice projects based on the number of processing times and the correlation, each of the microservice projects corresponding to at least one of the business types; A microservice module deployment module, used to deploy the microservice project in the power service system to obtain multiple microservice modules; The service allocation module is used to allocate services to the microservice modules based on load balancing and the service type when the power service system processes services.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the microservice module construction method described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the microservice module construction method according to any one of claims 1 to 7 when executed.

Citation Information

Patent Citations

  • Micro-service online distribution method and system based on coupling degree

    CN112148484A

  • Micro-service distribution method, electronic equipment and storage medium

    CN115834689A

  • Method and device for monitoring micro-service system

    CN115860935A

  • Micro-service dynamic scheduling method, device, equipment and medium

    CN116405543A

Cited By

  • Edge computing device management method and system based on NATS and micro service

    CN119676286A