Method for monitoring use condition of micro-service middleware

By configuring the SDK in the microservice middleware, collecting and sending messages to the server, analyzing and monitoring the middleware usage, the problems of difficulty in positioning abnormal middleware and insufficient adaptability are solved, and rapid positioning and business expansion are achieved.

CN119645760APending Publication Date: 2025-03-18HANGZHOU SOURCE CODE ZHILIAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411700113.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-26
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

During the microservice operation, when middleware is abnormal, it cannot be quickly located which microservice is used by abnormally. The middleware is not suitable for microservice access, and the adapted business scenarios are limited.

Method used

By configuring the SDK in the middleware of microservices, collect messages and execute data and send them to the server, and the server analyzes and monitors the usage of the middleware.

Benefits of technology

It realizes rapid positioning of microservices that cause middleware abnormalities, facilitates enterprises to access microservices, expand business usage scope, and provides intuitive monitoring of middleware usage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119645760A_ABST
    Figure CN119645760A_ABST
Patent Text Reader

Abstract

The invention relates to a method for monitoring the use condition of micro-service middleware. The method comprises the following steps of: configuring an SDK (Software Development Kit) in the micro-service middleware in advance; acquiring message execution data of the micro-service through an SDK (Software Development Kit) and sending the message execution data to the server; and the server analyzes and monitors the use condition of the middleware of the micro-service according to the message execution data. Through the middleware burying point sdk, the middleware use condition of the micro-service can be obtained, the middleware use condition of the micro-service can be gathered in a background at regular time, the corresponding index is processed and calculated, and a specific business scene is met. An SDK mode is adopted, which micro-service causes the middleware to be abnormal can be quickly positioned, users such as enterprises can conveniently access the micro-service and visually check the middleware use condition of the corresponding micro-service, and the service use range is expanded.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of microservice technology, and in particular to a method, system and electronic device for monitoring usage of a microservice middleware. Background Art

[0002] In the application of instruction set operating system operation and maintenance center, middleware is a key facility that provides information interaction for microservices. Middleware can provide customers with the function of viewing the middleware resources used by microservices, and mainly provides the following resource monitoring services:

[0003] The middleware resources used by microservices;

[0004] When middleware resources are abnormal, the abnormal microservice can be quickly located based on the usage of the corresponding microservice.

[0005] However, during the operation of microservices, the middleware still has the following technical problems:

[0006] When an exception occurs in the middleware, it is impossible to quickly locate which microservice caused the exception;

[0007] Currently, middleware is mainly connected to terminals and other devices, but it is not convenient for microservices to access and use, so its adapted business scenarios are limited. Summary of the invention

[0008] In order to solve the above problems, the present application proposes a method, system and electronic device for monitoring the usage of microservice middleware.

[0009] On the one hand, the present application proposes a method for monitoring the usage of microservice middleware, comprising the following steps:

[0010] S1. Pre-configure the SDK in the microservice middleware;

[0011] S2. Collect the message execution data of the microservice through SDK and send it to the server;

[0012] S3. The server executes data according to the message to analyze and monitor the usage of the middleware of the microservice.

[0013] As an optional implementation scheme of the present application, optionally, S1, pre-configuring an SDK of a server that can link to the microservice in the middleware of the microservice, including:

[0014] Select and determine the middleware for establishing SDK communication;

[0015] Perform SDK tracking in the determined middleware;

[0016] A communication link between the SDK and the server (isc-pivot-platform) of the microservice is configured.

[0017] As an optional implementation scheme of the present application, optionally, the communication mode of the communication link is one of the following:

[0018] grpc, mqtt or kafka.

[0019] As an optional implementation scheme of the present application, optionally, S2, collecting the message execution data of the microservice through the SDK and sending it to the server, includes:

[0020] The microservice starts running;

[0021] The message execution data of the corresponding middleware is captured through the SDK and sent to the server, wherein the message execution data at least includes: parameters before and after the message execution, tracking marks and / or the message execution time.

[0022] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, including:

[0023] Pre-configure the sampling frequency of link tracking into the Loki pre-deployed by the server;

[0024] receiving and caching the message execution data;

[0025] Loki tracks the message execution data with the tracking mark in a regular and quantitative manner according to the sampling frequency, and stores the tracked message execution data in the database of the server.

[0026] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, and further includes:

[0027] The server analyzes and counts the number of accesses and access time periods of the corresponding middleware recorded in the message execution data;

[0028] Based on the number of accesses and the access time period, the access data of the corresponding middleware pre-cached in the time series database is updated.

[0029] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, and further includes:

[0030] Analyze and determine whether there is data of interest to the microservice in the message execution data:

[0031] If it exists, the data is obtained through MQTT message subscription and stored in the time series database;

[0032] Otherwise, give up.

[0033] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, and further includes:

[0034] Analyze and determine whether there is data in the message execution data that meets the following preset data conditions:

[0035] Mysql type: sql DDL statement, sql statement takes more than 1s, sql execution fails;

[0036] Redis type: special key (hmgel or hgetall), special command (keys, scan or dump) or value length greater than 1k;

[0037] If it exists, an alarm is triggered, and an alarm notification is issued according to the preset notification rules and written into the time series database;

[0038] Otherwise, give up.

[0039] On the other hand, the present application proposes a system for implementing the above-mentioned method for monitoring the usage of a microservice middleware, including:

[0040] Microservices are used to collect the message execution data of the corresponding middleware through the SDK and send it to the server;

[0041] The server is used to execute data according to the message, analyze and monitor the usage of the middleware of the microservice;

[0042] The microservice is communicatively connected to the server.

[0043] In another aspect, the present application further provides an electronic device, comprising:

[0044] processor;

[0045] a memory for storing processor-executable instructions;

[0046] Wherein, the processor is configured to implement the method for monitoring the usage of microservice middleware when executing the executable instructions.

[0047] Technical effects of the present invention:

[0048] The present invention configures SDK in the middleware of microservices in advance; collects the message execution data of the microservices through SDK and sends it to the server; the server analyzes and monitors the usage of the middleware of the microservices according to the message execution data. The usage of the middleware of microservices can be obtained through the middleware embedding SDK, and the background regularly aggregates the usage of the middleware of microservices, and processes and calculates corresponding indicators to meet specific business scenarios. Using the SDK method, it is possible to quickly locate which microservice causes the middleware abnormality, which is convenient for enterprises and other users to access microservices and intuitively view the usage of the middleware of the corresponding microservices, thereby expanding the scope of business use.

[0049] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.

[0051] Figure 1 It is shown as a schematic diagram of the implementation process of the present invention;

[0052] Figure 2 Shown is a schematic diagram of the SDK message mechanism of the present invention;

[0053] Figure 3 It shows an application schematic diagram of the server of the present invention performing middleware data analysis based on SDK message;

[0054] Figure 4 The figure shows a statistics page for visually displaying the execution status of the middleware on the server side of the present invention;

[0055] Figure 5 It is a schematic diagram showing the application of the electronic device of the present invention. DETAILED DESCRIPTION

[0056] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise specified.

[0057] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.

[0058] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present disclosure can also be implemented without certain specific details. In some examples, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the main purpose of the present disclosure.

[0059] Terminology explanation:

[0060] isc-pivot-platform is the backend / platform server of the corresponding microservices.

[0061] SDK, or software development kit, is a form of empowerment provided by software service providers to developers. It packages certain capabilities of its own products to help developers build applications) The message sending mechanism of SDK is as follows:

[0062] Initialization: Before using the SDK to send messages, initialization operations are required, which may include setting necessary parameters, loading necessary library files, etc.

[0063] Create a message object: Create a corresponding message object according to the type of message you need to send. For example, if you want to send a text message, you need to create a text message object.

[0064] Configure message: After creating a message object, you need to configure the message, including setting properties such as message content, recipient, and sending time.

[0065] Send message: After configuring a good message, call the sending interface provided by the SDK to send the message. The sending operation may involve network communication, so there may be two sending methods: asynchronous and synchronous.

[0066] Processing responses: After sending a message, the SDK provides a callback mechanism to process the server's response. This may include confirming whether the message was successfully sent, handling sending failures, etc.

[0067] Example 1

[0068] like Figure 1 As shown, on one hand, the present application proposes a method for monitoring the usage of microservice middleware, comprising the following steps:

[0069] S1. Pre-configure the SDK in the microservice middleware;

[0070] S2. Collect the message execution data of the microservice through SDK and send it to the server;

[0071] S3. The server executes data according to the message to analyze and monitor the usage of the middleware of the microservice.

[0072] The present invention configures SDK in the middleware of microservices in advance; collects the message execution data of the microservices through SDK and sends it to the server; the server analyzes and monitors the usage of the middleware of the microservices according to the message execution data. The usage of the middleware of microservices can be obtained through the middleware embedding SDK, and the background regularly aggregates the usage of the middleware of microservices, and processes and calculates corresponding indicators to meet specific business scenarios. Using the SDK method, it is possible to quickly locate which microservice causes the middleware abnormality, which is convenient for enterprises and other users to access microservices and intuitively view the usage of the middleware of the corresponding microservices, thereby expanding the scope of business use.

[0073] The implementation principle of the present invention will be described in detail below.

[0074] As an optional implementation scheme of the present application, optionally, S1, pre-configuring an SDK of a server that can link to the microservice in the middleware of the microservice, including:

[0075] Select and determine the middleware for establishing SDK communication;

[0076] Perform SDK tracking in the determined middleware;

[0077] A communication link between the SDK and the server (isc-pivot-platform) of the microservice is configured.

[0078] like Figure 2 As shown, first, the administrator needs to deploy SDK on some middleware of microservices, select and confirm which middleware needs to deploy SDK and monitor the usage of the middleware.

[0079] For the middleware that needs to be monitored, deploy SDK and establish a communication link with the server. The communication link can be in one of the following modes: grpc, mqtt or kafka, for example, the message queue mechanism kafka is used.

[0080] In this embodiment, the message collection and forwarding mechanism configured in the SDK can be configured by the administrator, and the related programs and sampling parameters and other information are not limited in this embodiment. This embodiment only describes the functional services configured and applied by the SDK.

[0081] The message execution data collected by the SDK in the middleware can be MySQL type execution data or Redis type execution data, which is collected by the SDK and sent to the server.

[0082] As an optional implementation scheme of the present application, optionally, S2, collecting the message execution data of the microservice through the SDK and sending it to the server, includes:

[0083] The microservice starts running;

[0084] The message execution data of the corresponding middleware is captured through the SDK and sent to the server, wherein the message execution data at least includes: parameters before and after the message execution, tracking marks and / or the message execution time.

[0085] When the microservice is running, such as initiating calls to mysql, redis, http, etc., the SDK will capture the relevant actions and send the input parameters before the call, the return value after the call, the tracking mark: trace Id, and the corresponding time consumption information to the isc-pivot-platform microservice based on the selected communication method (optional grpc, mqtt, kafka).

[0086] The parameters and tracking tags in the message execution data can be marked by the corresponding middleware. These data are collected by the middleware and packaged into the SDK data format and uploaded to the backend by the SDK. These data are used for statistics on the usage of the middleware, such as the access path and the number of visits to the middleware that can be counted based on the data tracking tags.

[0087] like Figure 3 As shown in FIG. 1 , the server performs analysis and monitoring of message execution data.

[0088] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, including:

[0089] Pre-configure the sampling frequency of link tracking into the Loki pre-deployed by the server;

[0090] receiving and caching the message execution data;

[0091] Loki tracks the message execution data with the tracking mark in a regular and quantitative manner according to the sampling frequency, and stores the tracked message execution data in the database of the server.

[0092] The database deployed on the server, such as a time series database, may refer to the architecture of the corresponding service platform, and this embodiment does not limit this.

[0093] When the server receives the call data:

[0094] The data is cached in the memory, and the data in the memory is stored in the database at one time through a timing and quantity method (within a certain time period, or when the data in the memory reaches a certain amount), for subsequent query of the link status of the call.

[0095] The sampling frequency of link tracking (sampling time period, sampling range, etc.) can be set in advance.

[0096] As a distributed tracking system, Loki can perform regular and quantitative tracking data and store it in a database based on the sampling frequency of link tracking. Through Loki, the tracked data can be distributed and stored according to data attributes, so as to achieve classified management and avoid data confusion.

[0097] The principles and mechanisms of Loki are not described here. Through Loki's distributed storage management, it is easy to expand the use scenarios of microservices. For example, through Loki's distributed storage management mechanism, you can query the SQL commands executed by a microservice in a certain time period, so it is easy to track data management.

[0098] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, and further includes:

[0099] The server analyzes and counts the number of accesses and access time periods of the corresponding middleware recorded in the message execution data;

[0100] Based on the number of accesses and the access time period, the access data of the corresponding middleware pre-cached in the time series database is updated.

[0101] By analyzing and counting execution data on the server side, it is possible to count the usage of the middleware, especially the management data of the middleware on messages.

[0102] Based on the analysis results, the corresponding middleware access count of the microservice in the cache is updated. This data will be stored in the time series database regularly to show the order of the number of times the middleware is accessed by the microservice within a certain period of time.

[0103] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, and further includes:

[0104] Analyze and determine whether there is data of interest to the microservice in the message execution data:

[0105] If it exists, the data is obtained through MQTT message subscription and stored in the time series database;

[0106] Otherwise, give up.

[0107] If the microservice is interested in this data (data that the microservice is concerned about), the data can be obtained through MQTT message subscription, and the data will be written into the time series database for user query.

[0108] The data concerned by the microservice can be marked in advance by the microservice and saved on the server. In this way, the subsequent server can monitor the data reported by the microservice middleware, monitor the data concerned by the microservice, and notify the user and query in real time to realize message tracking report.

[0109] As an optional implementation scheme of the present application, optionally, S3, the server side analyzes and monitors the usage of the middleware of the microservice according to the message execution data, and further includes:

[0110] Analyze and determine whether there is data in the message execution data that meets the following preset data conditions:

[0111] MySQL type: sql DDL statement, sql statement takes more than 1 second, sql execution fails;

[0112] Redis type: special key (hmgel or hgetall), special command (keys, scan or dump) or value length greater than 1k;

[0113] If it exists, an alarm is triggered, and an alarm notification is issued according to the preset notification rules and written into the time series database;

[0114] Otherwise, give up.

[0115] For some special data, analysis will be performed. If the following conditions are met:

[0116] Mysql type, sql is a DDL (Data Definition Language, which defines the structure and objects of the database) statement;

[0117] Mysql type, the SQL statement execution time exceeds 1s;

[0118] Mysql type, sql execution failed;

[0119] Redis type, special keys (such as hmgel, hgetall, etc., which may take a long time);

[0120] Redis type, special commands (such as keys, scan, dump, and other commands that may have large amounts of data)

[0121] Redis type, value length is greater than 1k;

[0122] An alarm will be triggered and notified to the corresponding place according to the configured notification rules (such as email, SMS), and written into the time series database.

[0123] Notification rules can be set by the administrator.

[0124] like Figure 4 As shown, according to the above method, the execution status of the middleware can be monitored, and the execution status of different data types of the microservice middleware can be visually managed and displayed on the server side, which is convenient for the background to track and monitor the status of the middleware.

[0125] The server can monitor the execution status of the middleware of several microservices and perform configuration management according to actual needs.

[0126] On the server side, the SDK can be used to monitor which microservices have abnormalities, making it easier to track and manage microservices.

[0127] Obviously, those skilled in the art should understand that the implementation of all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. Those skilled in the art can understand that the implementation of all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (Flash Memory), a hard disk (Hard Disk Drive, abbreviated as: HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.

[0128] Example 2

[0129] Based on the implementation principle of Example 1, on the other hand, the present application proposes a system for implementing the above-mentioned method for monitoring the usage of a microservice middleware, including:

[0130] Microservices are used to collect the message execution data of the corresponding middleware through the SDK and send it to the server;

[0131] The server is used to execute data according to the message, analyze and monitor the usage of the middleware of the microservice;

[0132] The microservice is communicatively connected to the server.

[0133] Please understand the interaction between the above microservice end and the server end in conjunction with Example 1, and this example will not be repeated.

[0134] The modules or steps of the present invention described above can be implemented by a general-purpose computing system, they can be concentrated on a single computing system, or distributed on a network composed of multiple computing systems, and optionally, they can be implemented by a program code executable by a computing system, so that they can be stored in a storage system and executed by the computing system, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0135] Example 3

[0136] like Figure 5 As shown, further, in another aspect, the present application also proposes an electronic device, including:

[0137] processor;

[0138] a memory for storing processor-executable instructions;

[0139] Wherein, the processor is configured to implement a method for monitoring the usage of microservice middleware described in Example 1 when executing the executable instructions.

[0140] The electronic device of the embodiment of the present disclosure includes a processor and a memory for storing processor executable instructions. The processor is configured to implement a method for monitoring the usage of a microservice middleware as described in the above embodiment 1 when executing the executable instructions.

[0141] Here, it should be noted that the number of processors can be one or more. At the same time, the electronic device of the embodiment of the present disclosure may also include an input system and an output system. Among them, the processor, memory, input system and output system may be connected through a bus or in other ways, which are not specifically limited here.

[0142] The memory, as a computer-readable storage medium, can be used to store software programs, computer executable programs and various modules, such as the program or module corresponding to the method for monitoring the usage of a microservice middleware in an embodiment of the present disclosure. The processor executes various functional applications and data processing of the electronic device by running the software programs or modules stored in the memory.

[0143] The input system can be used to receive input numbers or signals. The signal can be a key signal related to user settings and function control of the device / terminal / server. The output system can include display devices such as display screens.

[0144] The embodiments of the present disclosure have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or technical improvements in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A method for monitoring the usage of microservice middleware, characterized in that: The steps include: S1. Pre-configure the SDK in the microservice middleware; S2. Collect the message execution data of the microservice through SDK and send it to the server; S3. The server executes data according to the message to analyze and monitor the usage of the middleware of the microservice.

2. A method for monitoring the usage of microservice middleware according to claim 1, characterized in that: S1. Pre-configure the SDK of the server that can link to the microservice in the middleware of the microservice, including: Select and determine the middleware for establishing SDK communication; Perform SDK tracking in the determined middleware; A communication link between the SDK and the server (isc-pivot-platform) of the microservice is configured.

3. A method for monitoring the usage of microservice middleware according to claim 2, characterized in that: The communication mode of the communication link is one of the following: grpc, mqtt or kafka.

4. A method for monitoring the usage of microservice middleware according to claim 1, characterized in that: S2. Collecting the message execution data of the microservice through SDK and sending it to the server, including: The microservice starts running; The message execution data of the corresponding middleware is captured through the SDK and sent to the server, wherein the message execution data at least includes: parameters before and after the message execution, tracking marks and / or the message execution time.

5. The method for monitoring the usage of microservice middleware according to claim 1, characterized in that: S3, the server side executes data according to the message, analyzes and monitors the usage of the middleware of the microservice, including: Pre-configure the sampling frequency of link tracking into the Loki pre-deployed by the server; receiving and caching the message execution data; Loki tracks the message execution data with the tracking mark in a regular and quantitative manner according to the sampling frequency, and stores the tracked message execution data in the database of the server.

6. A method for monitoring the usage of microservice middleware according to claim 5, characterized in that: S3, the server side executes data according to the message, analyzes and monitors the usage of the middleware of the microservice, and further includes: The server analyzes and counts the number of accesses and access time periods of the corresponding middleware recorded in the message execution data; Based on the number of accesses and the access time period, the access data of the corresponding middleware pre-cached in the time series database is updated.

7. A method for monitoring the usage of microservice middleware according to claim 5, characterized in that: S3, the server side executes data according to the message, analyzes and monitors the usage of the middleware of the microservice, and further includes: Analyze and determine whether there is data of interest to the microservice in the message execution data: If it exists, the data is obtained through MQTT message subscription and stored in the time series database; Otherwise, give up.

8. A method for monitoring the usage of microservice middleware according to claim 5, characterized in that: S3, the server side executes data according to the message, analyzes and monitors the usage of the middleware of the microservice, and further includes: Analyze and determine whether there is data in the message execution data that meets the following preset data conditions: Mysql type: sql DDL statement, sql statement takes more than 1s, sql execution fails; Redis type: special key (hmgel or hgetal l), special command (keys, scan or dump) or value length greater than 1k; If it exists, an alarm is triggered, and an alarm notification is issued according to the preset notification rules and written into the time series database; Otherwise, give up.

9. A system for implementing a method for monitoring the usage of a microservice middleware as described in any one of claims 1 to 8, characterized in that: include: Microservices are used to collect the message execution data of the corresponding middleware through the SDK and send it to the server; The server is used to execute data according to the message, analyze and monitor the usage of the middleware of the microservice; The microservice is communicatively connected to the server.

10. An electronic device, characterized in that include: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to implement a method for monitoring the usage of microservice middleware according to any one of claims 1 to 8 when executing the executable instructions.