Performance collection method, device, equipment, and medium for distributed nodes
By determining the target update time and acquisition period of the target strategy on the distributed node, the performance data of the distributed nodes is periodically collected, which solves the problem of difficulty in analyzing the overall performance of the distributed system in the existing technology, and real-time and accurate acquisition and analysis of the distributed system performance is achieved.
Patent Information
- Application Number
- CN202411641502.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-11-18
AI Technical Summary
The prior art is difficult to analyze the overall performance of distributed systems, especially the failure to effectively analyze the load changes of distributed systems.
By determining the target update time and acquisition period of the target policy on the distributed nodes, and executing performance acquisition instructions based on these moments and cycles, performance data of multiple distributed nodes at the same time is periodically collected.
Ensure real-time acquisition and analysis of the overall performance of distributed systems, and improve the accuracy and utilization of performance data.
Smart Images

Figure CN119155211B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distributed systems, and more specifically to a performance collection method, device, equipment, and medium applied to distributed nodes. Background Art
[0002] With the emergence of more and more distributed systems, mastering the overall operating status of distributed systems has become the key to system operation and maintenance. When one or more distributed nodes in a distributed system are abnormal, it is particularly important to be able to promptly discover the cause of the abnormality. In related technologies, performance indicator data of multiple distributed nodes are collected at regular intervals, where the performance indicator data may include processor usage, memory occupancy, throughput and other data of the distributed nodes, and the performance of multiple distributed nodes is analyzed based on the collected performance indicator data.
[0003] In the process of implementing the concept of the present invention, it is found that there are at least the following problems in the related technology: in the process of analyzing the performance of multiple distributed nodes based on the collected performance indicator data, only the performance of each distributed node can be analyzed, and the performance of the distributed system as a whole cannot be analyzed, for example, the load changes of the distributed system as a whole cannot be analyzed. Summary of the invention
[0004] In view of the above problems, the present invention provides a performance collection method, device, equipment, medium and distributed system applied to distributed nodes.
[0005] According to a first aspect of the present invention, there is provided a performance collection method applied to distributed nodes, the method comprising: upon receiving a target policy, determining a target update time and a collection period based on the target policy, wherein the target update time represents a creation time of the target policy; determining an initial execution time of the target policy at the distributed node based on a current system time of a device where the distributed node is located, the target update time and the collection period, wherein a time interval between the initial execution time and the target update time is an integer multiple of the collection period; and starting from the initial execution time, executing the performance collection instructions included in the target policy based on the collection period.
[0006] According to an embodiment of the present invention, the above-mentioned determination of the initial execution time of the above-mentioned target policy at the above-mentioned distributed node based on the current system time of the device where the distributed node is located, the above-mentioned target update time and the above-mentioned collection cycle includes: determining the reference time based on the above-mentioned collection cycle, the above-mentioned current system time and the above-mentioned target update time; determining the above-mentioned initial execution time after the above-mentioned target update time based on the above-mentioned reference time and the above-mentioned collection cycle.
[0007] According to an embodiment of the present invention, the reference time is determined based on the acquisition period, the current system time and the target update time, including: performing a remainder calculation on the time difference based on the acquisition period to determine the remaining duration; and determining the reference time based on the difference between the remaining duration and the target update time.
[0008] According to an embodiment of the present invention, the above-mentioned initial execution time after the above-mentioned target update time is determined based on the above-mentioned reference time and the above-mentioned acquisition cycle, including: determining the delay period based on the above-mentioned acquisition cycle and a preset multiple; and adding the above-mentioned delay period on the basis of the above-mentioned reference time to obtain the above-mentioned initial execution time.
[0009] According to an embodiment of the present invention, the above method also includes: periodically sending query requests to the message middleware to receive feedback information returned by the above message middleware; when the received feedback information includes the above target policy, determining the local update time of the local policy of the above distributed node; and when the target update time of the above target policy and the local update time of the local policy are different, executing the performance collection instructions included in the above target policy to perform performance collection of the above distributed node.
[0010] According to an embodiment of the present invention, the above-mentioned method also includes: when the above-mentioned feedback information received does not include the above-mentioned target strategy, or when the target update time of the above-mentioned target strategy is the same as the local update time of the local strategy, executing the performance collection instructions included in the above-mentioned local strategy to perform performance collection of the above-mentioned distributed nodes.
[0011] The second aspect of the present invention provides a distributed system, comprising: multiple distributed nodes; the above-mentioned distributed nodes are configured to: upon receiving a target policy, determine a target update time and a collection period based on the above-mentioned target policy, wherein the above-mentioned target update time represents the creation time of the above-mentioned target policy; based on the current system time of the distributed node, the above-mentioned target update time and the above-mentioned collection period, determine the initial execution time of the above-mentioned target policy at the above-mentioned distributed node; and starting from the above-mentioned initial execution time, execute the performance collection instructions included in the above-mentioned target policy based on the above-mentioned collection period; wherein the time interval between the initial execution times of each of the above-mentioned multiple distributed nodes is an integer multiple of the above-mentioned collection period.
[0012] The third aspect of the present invention provides a performance collection device applied to distributed nodes, characterized in that the above-mentioned device includes: a first determination module, which is used to determine the target update time and the collection period based on the above-mentioned target policy when a target policy is received, wherein the above-mentioned target update time represents the creation time of the above-mentioned target policy; a second determination module, which is used to determine the initial execution time of the above-mentioned target policy in the above-mentioned distributed node based on the current system time of the distributed node, the above-mentioned target update time and the above-mentioned collection period, wherein the time interval between the above-mentioned initial execution time and the above-mentioned target update time is an integer multiple of the above-mentioned collection period; and a first execution module, which is used to execute the performance collection instructions included in the above-mentioned target policy based on the above-mentioned collection period starting from the above-mentioned initial execution time.
[0013] A fourth aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0014] The fifth aspect of the present invention further provides a computer-readable storage medium on which a computer program or instruction is stored, and the steps of the above method are implemented when the above computer program or instruction is executed by a processor.
[0015] According to an embodiment of the present invention, the target update time of the target policy is used as a reference, and the initial execution time of the target policy at the distributed node is determined based on the current system time, the target update time and the collection cycle of the device where the distributed node is located. For each distributed node that has updated the target policy, since the target update time and the collection cycle are determined to be the same for each initial execution time, and the time interval between the initial execution time and the target update time is an integer multiple of the collection cycle, although the initial execution times of multiple distributed nodes may be different, the time points at which multiple distributed nodes trigger the execution of the target policy in the cycle are the same. By determining the time points at which multiple distributed nodes periodically trigger the execution of the target policy, the performance data of multiple distributed nodes at the same time point are periodically collected, and the data used for the performance analysis of the distributed system as a whole are guaranteed to be collected in real time as much as possible, thereby improving the accuracy of the performance data for the performance analysis of the distributed system. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings.
[0017] Figure 1 An application scenario diagram of a performance collection method applied to distributed nodes according to an embodiment of the present invention is shown.
[0018] Figure 2 A flow chart of a performance collection method applied to a distributed node according to an embodiment of the present invention is shown.
[0019] Figure 3 An interactive diagram of a performance collection method applied to distributed nodes according to an embodiment of the present invention is shown.
[0020] Figure 4 A schematic diagram showing the time relationship according to an embodiment of the present invention is shown.
[0021] Figure 5 A structural block diagram of a performance collection device applied to a distributed node according to an embodiment of the present invention is shown.
[0022] Figure 6 A block diagram of an electronic device suitable for implementing a performance acquisition method applied to distributed nodes according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0023] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0024] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0025] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0026] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0027] In the process of analyzing the performance of a distributed system, in the related technology, for multiple distributed nodes, the performance data of each distributed node is collected at a regular time, the regularly collected performance data is processed through interpolation or fitting models to generate continuous performance change data, and the performance of each node in the distributed system at different times is analyzed based on the continuous performance change data, thereby providing reference data for staff in the later maintenance of the distributed system.
[0028] However, in the process of analyzing the performance of each node in the distributed system at different times based on continuous performance change data, the time interval for regularly collecting performance data is too long, resulting in a high probability that the performance data used in the performance analysis is obtained through interpolation or fitting models, and the accuracy of the performance data cannot be guaranteed. Currently, a method that can improve the accuracy of performance data is urgently needed.
[0029] An embodiment of the present invention provides a performance collection method applied to distributed nodes, characterized in that the method includes: when a target policy is received, determining a target update time and a collection period based on the target policy, wherein the target update time represents the creation time of the target policy; determining an initial execution time of the target policy at the distributed node based on the current system time, target update time and collection period of the device where the distributed node is located, wherein the time interval between the initial execution time and the target update time is an integer multiple of the collection period; and starting from the initial execution time, executing the performance collection instructions included in the target policy based on the collection period.
[0030] Figure 1 An application scenario diagram of a performance collection method applied to distributed nodes according to an embodiment of the present invention is shown.
[0031] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first distributed node 101, a second distributed node 102, a third distributed node 103, a message middleware 104, and a server 105. The server 105 is used to provide a target policy for the first distributed node 101, the second distributed node 102, and the third distributed node 103. The message middleware 104 is used to provide a medium for a communication link between the first distributed node 101, the second distributed node 102, the third distributed node 103, and the server 105.
[0032] The server 105 may be a server that provides various services, such as analyzing the data collected by the first distributed node 101, the second distributed node 102, and the third distributed node 103. The server 105 may analyze and process the received user request data, and feed back the processing results to the distributed nodes.
[0033] It should be noted that the performance collection method applied to distributed nodes provided in the embodiment of the present invention can be executed in the first distributed node 101, the second distributed node 102, and the third distributed node 103, respectively. Accordingly, the performance collection device applied to distributed nodes provided in the embodiment of the present invention can generally be set in the first distributed node 101, the second distributed node 102, and the third distributed node 103, respectively, and can be executed. The performance collection method applied to distributed nodes provided in the embodiment of the present invention can also be executed by other distributed nodes that are different from the first distributed node 101, the second distributed node 102, and the third distributed node 103 and can communicate with the first distributed node 101, the second distributed node 102, the third distributed node 103 and / or the server 105. Accordingly, the performance collection device applied to distributed nodes provided in the embodiment of the present invention can also be set in a distributed node or distributed cluster that is different from the server 105 and can communicate with the first distributed node 101, the second distributed node 102, the third distributed node 103 and / or the server 105.
[0034] It should be understood that Figure 1 The number of terminal devices, networks and servers in the system is only . According to the implementation requirements, there can be any number of distributed nodes, message middleware and servers.
[0035] The following will be based on Figure 1 The scene described by Figure 2~Figure 4 A performance collection method applied to distributed nodes in an embodiment of the present invention is described in detail.
[0036] Figure 2 A flow chart of a performance collection method applied to a distributed node according to an embodiment of the present invention is shown.
[0037] like Figure 2 As shown, the performance collection method applied to a distributed node in this embodiment includes operations S210 to S230.
[0038] In operation S210 , when the target policy is received, a target update time and a collection period are determined based on the target policy, wherein the target update time represents a creation time of the target policy.
[0039] In operation S220, based on the current system time of the device where the distributed node is located, the target update time and the collection period, the initial execution time of the target policy in the distributed node is determined, wherein the time interval between the initial execution time and the target update time is an integer multiple of the collection period.
[0040] In operation S230 , starting from the initial execution time, the performance collection instructions included in the target policy are executed based on the collection cycle.
[0041] According to an embodiment of the present invention, a target policy represents a policy provided by a server or other distributed nodes, and the target policy is used to collect performance data of the distributed nodes, wherein the performance data may include processor usage, memory occupancy, input / output usage, and throughput of the device where the distributed node is located. The target update time may represent the time when the target policy is generated on the server or distributed node, or the time when the target policy is last modified on the server or distributed node. The collection cycle represents the period of periodic execution of the target policy. The target update time and the collection cycle may be parameters of the target policy. When the distributed node receives the target policy, the target update time and the collection cycle included in the target policy are determined based on the target policy.
[0042] According to an embodiment of the present invention, the system time of the devices where the multiple distributed nodes are located is synchronized. The initial execution time represents the time when the target policy is executed on the distributed node. The system time of the device where the distributed node is located is obtained as the current system time. By processing the current system time, the target update time and the collection period of the device where the distributed node is located, the initial execution time of the target policy on the distributed node is obtained, so that the time interval between the initial execution time and the target update time is an integer multiple of the collection period.
[0043] According to an embodiment of the present invention, the performance collection instruction is used to obtain the performance data of the distributed node. The performance collection instruction included in the target policy is executed at the initial execution time. Starting from the initial execution time, the performance collection instruction included in the target policy can be periodically executed with the time length represented by the collection cycle reached each time as the trigger condition for executing the target policy.
[0044] According to an embodiment of the present invention, the target update time of the target policy is used as a reference, and the initial execution time of the target policy at the distributed node is determined based on the current system time, the target update time and the collection cycle of the device where the distributed node is located. For each distributed node that has updated the target policy, since the target update time and the collection cycle are determined to be the same for each initial execution time, and the time interval between the initial execution time and the target update time is an integer multiple of the collection cycle, although the initial execution times of multiple distributed nodes may be different, the time points at which multiple distributed nodes trigger the execution of the target policy in the cycle are the same. By determining the time points at which multiple distributed nodes periodically trigger the execution of the target policy, the performance data of multiple distributed nodes at the same time point are periodically collected, and the data used for the performance analysis of the distributed system as a whole are guaranteed to be collected in real time as much as possible, thereby improving the accuracy of the performance data for the performance analysis of the distributed system.
[0045] According to an embodiment of the present invention, based on the current system time, target update time and collection cycle of the device where the distributed node is located, the initial execution time of the target policy in the distributed node is determined, including: determining the reference time based on the collection cycle, the current system time and the target update time; determining the initial execution time after the target update time based on the reference time and the collection cycle.
[0046] According to an embodiment of the present invention, the time interval between the reference moment and the target update moment is an integer multiple of the collection period, and the time interval between the reference moment and the current system moment is less than the collection period. The distributed node determines the time interval between the current system moment and the target update moment based on the current system moment and the target update moment, and performs a downward division operation with the collection period based on the time interval between the current system moment and the target update moment to obtain an integer division result. The product of the integer division result and the collection period is added to the target update moment to obtain the reference moment.
[0047] According to an embodiment of the present invention, determining the reference time based on the collection period, the current system time and the target update time includes: performing a modulus calculation on the time difference based on the collection period to determine the remaining time; and determining the reference time based on the difference between the remaining time and the target update time. The remaining time is less than the collection period; and the time difference is the time interval difference between the current system time and the target update time.
[0048] According to an embodiment of the present invention, determining an initial execution time after a target update time based on a reference time and a collection period includes: determining a delay period based on the collection period and a preset multiple; and adding the delay period to the reference time to obtain the initial execution time, wherein the preset multiple is a positive integer.
[0049] According to an embodiment of the present invention, the preset multiple can be a positive integer selected based on expert experience. The distributed node determines the delay period based on the product of the acquisition period and the preset multiple. The delay period represents the time delayed backward based on the reference time. The delay period is added to the reference time to obtain the initial execution time.
[0050] According to an embodiment of the present invention, when the reference time is after the current system time, the reference time is determined as the initial execution time. In the process of distributed nodes processing the acquisition cycle, target update time, current system time, etc., the time can be converted into a long integer timestamp, and the calculation accuracy can be accurate to millisecond level.
[0051] According to an embodiment of the present invention, the initial execution time is determined by calculation, and when the system time of the distributed node reaches the initial execution time, the performance collection instructions included in the target policy are executed. Since the tasks to be executed on the distributed nodes are cumbersome, by calculating the initial execution time, the time point for executing the performance collection instructions included in the target policy is determined, which provides a reference for the distributed nodes to perform other tasks, such as the task of correcting the system time of the distributed nodes, improves the accuracy of the initial execution time, and thus improves the accuracy of the performance data for performance analysis of the distributed system.
[0052] According to an embodiment of the present invention, the system time of the devices where the multiple distributed nodes are located needs to be kept consistent, and the time of the multiple distributed nodes can be periodically corrected through the Network Time Protocol (NTP).
[0053] According to an embodiment of the present invention, the initial execution time of the target policy at the distributed node is determined based on the current system time, target update time and collection period of the device where the distributed node is located, and further includes: the distributed node determines the time interval between the current system time and the target update time based on the current system time and the target update time, and performs an upward division operation with the collection period based on the time interval between the current system time and the target update time to obtain a rounding result. The product of the upward rounding result and the collection period is added to the target update time to obtain the initial execution time.
[0054] According to an embodiment of the present invention, the performance collection method applied to distributed nodes also includes: periodically sending query requests to the message middleware to receive feedback information returned by the message middleware; when the received feedback information includes a target policy, determining the local update time of the local policy of the distributed node; and when the target update time of the target policy and the local update time of the local policy are different, executing the performance collection instructions included in the target policy to perform performance collection of the distributed nodes.
[0055] According to an embodiment of the present invention, a query request is used to query whether there is a new message on the message middleware. The distributed node periodically sends a query request to the message middleware. When receiving feedback information returned by the message middleware and determining that the feedback information includes a target policy, the local policy stored on the distributed node is determined. The local update time is determined based on the parameter information in the local policy, wherein the local update time represents the creation time of the local policy or the time when the local policy is modified on the server.
[0056] According to an example of the present invention, the target update time of the target policy is different from the local update time of the local policy, indicating that the local policy executed on the distributed node is different from the target policy, and it is necessary to replace the local policy being executed by the distributed node with the target policy, and execute the performance collection instructions included in the target policy on the distributed node to perform performance collection of the distributed node.
[0057] According to an embodiment of the present invention, different target strategies are distinguished by target update time, and distributed nodes periodically send query requests to the message middleware to receive feedback information returned by the message middleware. This allows distributed nodes to obtain the latest strategies in a timely manner and synchronize the time points for executing target strategies of multiple distributed nodes in a timely manner, thereby reducing the waste of computing resources of distributed nodes and making the performance data collected by distributed nodes valuable data for the overall performance analysis of the distributed system, thereby improving the utilization rate of the collected performance data.
[0058] According to an embodiment of the present invention, the performance collection method applied to distributed nodes also includes: when the received feedback information does not include the target policy, or when the target update time of the target policy and the local update time of the local policy are the same, executing the performance collection instructions included in the local policy to perform performance collection of the distributed nodes.
[0059] According to an embodiment of the present invention, when the received feedback information does not include the target policy, it indicates that no new policy has been generated, and there is no need to change the parameters such as the performance indicators and the collection period for collecting performance data. When the target update time of the target policy and the local update time of the local policy are the same, it indicates that the local policy executed locally by the distributed node is the same as the target policy, and there is no need to update the local policy. The distributed node continues to periodically execute the performance collection instructions included in the local policy based on the execution rules of the local policy reaching the distributed node.
[0060] According to an embodiment of the present invention, by determining whether the target update time is the same as the local update time of the local policy, if the target update time of the target policy is the same as the local update time of the local policy, the performance collection instructions included in the local policy are continued to be executed. This avoids invalid updates of the local policy and improves the efficiency of performance collection.
[0061] According to an embodiment of the present invention, when collecting performance data of a distributed system, each distributed node keeps the collection time of each cycle as consistent as possible. When an abnormality occurs in the distributed system, the operation and maintenance personnel can compare and analyze the performance of each distributed node based on the performance data of multiple distributed nodes at multiple points in time.
[0062] Figure 3An interactive diagram of a performance collection method applied to distributed nodes according to an embodiment of the present invention is shown.
[0063] like Figure 3 As shown, the performance collection method applied to distributed nodes in this embodiment may involve detection services, collection service agents, and message middleware. Figure 3 The interaction diagram shown is illustrated with a distributed node, wherein the performance collection method applied to distributed nodes of the present invention is applied to the collection service agent. Among them, the detection service is responsible for the configuration of the target policy, the issuance of the target policy, and the processing of the collected performance data. The collection service agent is responsible for collecting performance data according to local policies, and executing the performance collection method applied to distributed nodes of the present invention. The message middleware is responsible for forwarding and storing messages. The scheduling of collection tasks in the collection service agent can be achieved through the scheduling component. The detection service and the collection service agent communicate through the message middleware, realizing the decoupling between services.
[0064] The startup process of each service / component may include: Step 1: Start the message middleware; Step 2: Start the detection service; Step 3: Start the collection service agent; Step 4: The collection service agent starts the collection task and push task according to the performance collection instructions included in the target strategy, wherein the push task is used to send performance data to the message middleware after obtaining the performance data of one or more collection cycles; Step 5: The detection service stores or processes the data.
[0065] The message middleware may include a first topic, a second topic, and a third topic. The first topic is used to receive a policy application request sent by a collection service agent, and to provide feedback on the first polling request when a first polling request of a detection service is received. The second topic is used to receive a target policy sent by a detection service, and to provide feedback on the query request when a query request of a collection service agent is received. The third topic is used to receive performance data sent by a collection service agent, and to provide feedback on the second polling request when a second polling request of a detection service is received.
[0066] When a new collection service agent is started, the component for sending a query request to the message middleware can be started first. Then, a policy application request is sent to the first topic of the message middleware. This helps the distributed nodes to obtain the target policy in a timely manner. When the target policy exists in the second topic, in response to the query request of the collection service agent, the target policy is sent to all collection service agents subscribed to the topic.
[0067] Figure 4 A schematic diagram showing the time relationship according to an embodiment of the present invention is shown.
[0068] like Figure 4As shown, the start time represents the start time of the collection service agent on the distributed node, and the collection time points represent multiple collection time points after the initial collection time is determined.
[0069] According to an embodiment of the present invention, a distributed system includes: multiple distributed nodes; the distributed nodes are configured to: upon receiving a target policy, determine a target update time and a collection period based on the target policy, wherein the target update time represents the creation time of the target policy; determine an initial execution time of the target policy at the distributed node based on the current system time, target update time and collection period of the distributed node; and starting from the initial execution time, execute performance collection instructions included in the target policy based on the collection period; wherein the time interval between the initial execution times of the multiple distributed nodes is an integer multiple of the collection period.
[0070] Based on the above performance collection method applied to distributed nodes, the present invention also provides a performance collection device applied to distributed nodes. Figure 5 The device is described in detail.
[0071] Figure 5 A structural block diagram of a performance collection device applied to a distributed node according to an embodiment of the present invention is shown.
[0072] like Figure 5 As shown, the performance collection device 500 applied to a distributed node in this embodiment includes a first determination module 510 , a second determination module 520 , and a first execution module 530 .
[0073] The first determination module 510 is used to determine the target update time and the collection period based on the target policy when the target policy is received, wherein the target update time represents the creation time of the target policy. In one embodiment, the first determination module 510 can be used to perform the operation S210 described above, which will not be repeated here.
[0074] The second determination module 520 is used to determine the initial execution time of the target policy in the distributed node based on the current system time of the distributed node, the target update time and the collection period, wherein the time interval between the initial execution time and the target update time is an integer multiple of the collection period. In one embodiment, the second determination module 520 can be used to perform the operation S220 described above, which will not be repeated here.
[0075] The first execution module 530 is used to execute the performance collection instructions included in the target policy based on the collection cycle starting from the initial execution time. In one embodiment, the first execution module 530 can be used to execute the operation S230 described above, which will not be repeated here.
[0076] According to an embodiment of the present invention, the second determination module 520 includes: a reference determination unit and a time determination unit.
[0077] The reference determination unit is used to determine the reference time based on the collection period, the current system time and the target update time.
[0078] The time determination unit is used to determine an initial execution time after the target update time based on a reference time and a collection period.
[0079] According to an embodiment of the present invention, the reference determination unit includes: a duration determination subunit and a first determination subunit.
[0080] The duration determination subunit is used to perform a remainder calculation on the time difference based on the collection period to determine the remaining duration.
[0081] The first determination subunit is used to determine a reference time based on a difference between the remaining duration and the target update time.
[0082] According to an embodiment of the present invention, the time determination unit includes: a delay determination subunit and a second determination subunit.
[0083] The delay determination subunit is used to determine the delay period based on the acquisition period and the preset multiple.
[0084] The second determining subunit is used to increase the delay period on the basis of the reference time to obtain an initial execution time.
[0085] According to the embodiment of the present invention, the performance collection device 500 further includes: a request sending module, a third determining module, and a second executing module.
[0086] The request sending module is used to periodically send query requests to the message middleware to receive feedback information returned by the message middleware.
[0087] The third determination module is used to determine the local update time of the local policy of the distributed node when the received feedback information includes the target policy.
[0088] The second execution module is used to execute the performance collection instructions included in the target policy to perform performance collection of distributed nodes when the target update time of the target policy is different from the local update time of the local policy.
[0089] According to the embodiment of the present invention, the performance collection device 500 further includes: a third execution module.
[0090] The third execution module is used to execute the performance collection instructions included in the local policy to perform performance collection of distributed nodes when the received feedback information does not include the target policy or when the target update time of the target policy is the same as the local update time of the local policy.
[0091] According to an embodiment of the present invention, any multiple modules among the first determination module 510, the second determination module 520, and the first execution module 530 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present invention, at least one of the first determination module 510, the second determination module 520, and the first execution module 530 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, at least one of the first determination module 510, the second determination module 520, and the first execution module 530 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0092] Figure 6 A block diagram of an electronic device suitable for implementing a performance acquisition method applied to distributed nodes according to an embodiment of the present invention is shown.
[0093] like Figure 6 As shown, the electronic device 600 according to an embodiment of the present invention includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 to a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0094] In RAM603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM602 and RAM603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to an embodiment of the present invention by executing the programs in ROM602 and / or RAM603. It should be noted that the program can also be stored in one or more memories other than ROM602 and RAM603. Processor 601 can also perform various operations of the method flow according to an embodiment of the present invention by executing the programs stored in the one or more memories.
[0095] According to an embodiment of the present invention, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the input / output (I / O) interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0096] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.
[0097] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: 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), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM602 and / or RAM603 described above and / or one or more memories other than ROM602 and RAM603.
[0098] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program includes a program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the performance collection method for distributed nodes provided by the embodiment of the present invention.
[0099] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 601. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0100] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0101] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0102] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0103] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0104] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present invention may be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features described in the various embodiments of the present invention may be combined and / or combined in various ways. All of these combinations and / or combinations fall within the scope of the present invention.
[0105] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination advantageously. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. A performance collection method applied to distributed nodes, characterized in that: The method comprises: In case of receiving the target policy, determining the target update time and the collection period based on the target policy, wherein the target update time represents the creation time of the target policy; Determine the initial execution time of the target policy at the distributed node based on the current system time of the device where the distributed node is located, the target update time and the collection period, wherein the time interval between the initial execution time and the target update time is an integer multiple of the collection period; Starting from the initial execution time, the performance collection instructions included in the target policy are executed based on the collection cycle; wherein, determining the initial execution time of the target policy at the distributed node based on the current system time of the device where the distributed node is located, the target update time and the collection cycle includes: Determine a reference time based on the acquisition period, the current system time and the target update time; Determining the initial execution time after the target update time based on the reference time and the acquisition period; The determining of the reference time based on the acquisition cycle, the current system time and the target update time comprises: Based on the time interval between the current system time and the target update time, perform a downward division operation on the acquisition period to obtain an integer division result; Adding the product of the integer division result and the acquisition period to the target update time to obtain the reference time; The determining, based on the reference time and the acquisition period, the initial execution time after the target update time comprises: Determine a delay period based on the acquisition period and a preset multiple; The delay period is added to the reference time to obtain the initial execution time.
2. The method according to claim 1, characterized in that The method further comprises: Periodically sending query requests to the message middleware to receive feedback information returned by the message middleware; In a case where the received feedback information includes the target policy, determining a local update time of the local policy of the distributed node; In the case where the target update time of the target policy is different from the local update time of the local policy, the performance collection instruction included in the target policy is executed to perform performance collection of the distributed nodes.
3. The method according to claim 2, characterized in that The method further comprises: When the received feedback information does not include the target policy, or when the target update time of the target policy is the same as the local update time of the local policy, the performance collection instruction included in the local policy is executed to perform performance collection of the distributed node.
4. A distributed system comprising: Multiple distributed nodes; The distributed node is configured to: upon receiving a target policy, determine a target update time and a collection period based on the target policy, wherein the target update time represents a creation time of the target policy; determine an initial execution time of the target policy at the distributed node based on a current system time of the distributed node, the target update time and the collection period; and, starting from the initial execution time, execute performance collection instructions included in the target policy based on the collection period; Wherein, the time interval between the initial execution times of the plurality of distributed nodes is an integer multiple of the collection period; The determining, based on the current system time of the device where the distributed node is located, the target update time and the acquisition period, the initial execution time of the target strategy at the distributed node includes: Determine a reference time based on the acquisition period, the current system time and the target update time; Determining the initial execution time after the target update time based on the reference time and the acquisition period; The determining of the reference time based on the acquisition cycle, the current system time and the target update time comprises: Based on the time interval between the current system time and the target update time, perform a downward division operation on the acquisition period to obtain an integer division result; Adding the product of the integer division result and the acquisition period to the target update time to obtain the reference time; The determining, based on the reference time and the acquisition period, the initial execution time after the target update time comprises: Determine a delay period based on the acquisition period and a preset multiple; The delay period is added to the reference time to obtain the initial execution time.
5. A performance collection device applied to distributed nodes, characterized in that: The device comprises: A first determination module is used to determine a target update time and a collection period based on the target policy when a target policy is received, wherein the target update time represents a creation time of the target policy; A second determination module is used to determine the initial execution time of the target policy at the distributed node based on the current system time of the distributed node, the target update time and the collection period, wherein the time interval between the initial execution time and the target update time is an integer multiple of the collection period; A first execution module, configured to execute the performance collection instructions included in the target strategy based on the collection cycle starting from the initial execution time; The second determining module includes: A reference determination unit, configured to determine a reference time based on the acquisition period, the current system time and the target update time; a time determination unit, configured to determine the initial execution time after the target update time based on the reference time and the acquisition period; The reference determination unit is further configured to perform a downward division operation on the acquisition period based on the time interval between the current system time and the target update time to obtain an integer division result; and add the product of the integer division result and the acquisition period to the target update time to obtain the reference time; The time determination unit comprises: A delay determination subunit, configured to determine a delay period based on the acquisition period and a preset multiple; The second determining subunit is used to increase the delay period on the basis of the reference time to obtain the initial execution time.
6. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 3.
7. A computer-readable storage medium having a computer program or instruction stored thereon, characterized in that: When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Distributed configuration management method and device and system for realization of distributed configuration management
CN107483250A
Abnormal node task processing method and device based on cluster node mutual inspection
CN112035326A