A resource state event aggregation method and device, electronic equipment and storage medium

By creating preset cluster resource status events, mapping them to message queues, and generating compressed indexes, the problems of short-lived storage and low retrieval efficiency of Kubernetes resource status events are solved, achieving more persistent storage and faster data retrieval.

CN115328615BActive Publication Date: 2026-02-17WENYUAN SUHANG (JIANGSU) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210956561.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-10
Publication Date
2026-02-17
Estimated Expiration
2042-08-10

AI Technical Summary

Technical Problem

Native Kubernetes resource status events are limited by storage, have short storage cycles, and low retrieval efficiency, making them unable to meet the demand for rich data.

Method used

Create resource status events for preset cluster resources, map them to preset message queues, generate compressed indexes and aggregate them, remove unnecessary information, reduce data volume, and improve storage persistence and retrieval efficiency.

Benefits of technology

By compressing and aggregating resource status events, more persistent storage and faster data retrieval are achieved, improving the efficiency of resource status event retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115328615B_ABST
    Figure CN115328615B_ABST
Patent Text Reader

Abstract

The application discloses a resource state event aggregation method and device, electronic equipment and a storage medium, and aims at solving the technical problems that the original Kubernetes resource state event is limited by storage, the storage period is short, and the extraction efficiency is low. The application comprises the following steps: creating a resource state event of a preset cluster resource; mapping the resource state event to a preset message queue; extracting the resource state event in the preset message queue, and generating a compressed index of the preset cluster resource; and aggregating the resource state event according to the compressed index to obtain an aggregation result of the resource state event.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a method, apparatus, electronic device, and storage medium for aggregating resource status events. Background Technology

[0002] Traditional application deployment methods involve installing applications via plugins or scripts. The drawback of this approach is that the application's operation, configuration, management, and entire lifecycle become tied to the current operating system. This hinders application upgrades, updates, and rollbacks. While some functionality can be achieved by creating virtual machines, virtual machines are very resource-intensive and detrimental to portability.

[0003] Therefore, Kubernetes is now commonly used for application deployment. Kubernetes is an open-source container orchestration engine from Google that supports automated deployment, large-scale scalability, and containerized application management. When deploying an application in a production environment, multiple instances of the application are typically deployed to load balance application requests.

[0004] Kubernetes cluster resources have a large number of status events. Using these resource status events, cluster performance can be monitored and evaluated, providing metrics for cluster optimization and enabling the cluster to become more efficient and robust.

[0005] However, due to the large amount of data and storage limitations, the native Kubernetes cluster does not persist these state events and cleans them up in a short period of time. Furthermore, the native Kubernetes resource state events are not rich enough; many states that platforms need to monitor are missing, failing to meet requirements. In addition, the native Kubernetes resource state events are not aggregated or statistically analyzed, making it difficult for developers to easily and efficiently extract platform metrics. Summary of the Invention

[0006] This invention provides a method, apparatus, electronic device, and storage medium for aggregating resource status events, which addresses the technical problems of native Kubernetes resource status events being limited by storage, having short storage cycles, and low extraction efficiency.

[0007] This invention provides a method for aggregating resource status events, comprising:

[0008] Create resource status events for preset cluster resources;

[0009] Map the resource status events to a preset message queue;

[0010] Extract the resource status events from the preset message queue and generate a compressed index of the preset cluster resources;

[0011] The resource status events are aggregated based on the compressed index to obtain the aggregated result of the resource status events.

[0012] Optionally, the step of creating a resource status event for a preset cluster resource includes:

[0013] Obtain the initial resource status events and resource status event formats of the preset cluster resources;

[0014] Extract resource information from the initial resource status event according to the resource status event format;

[0015] The resource messages are combined according to the resource status event format to generate a resource status event.

[0016] Optionally, the step of mapping the resource status event to a preset message queue includes:

[0017] Obtain the resource ID of the resource status event from the resource information;

[0018] Retrieve the first eight digits of the resource ID;

[0019] Retrieve the preset message queue corresponding to the mapping key and the first eight digits of the resource ID;

[0020] The resource status events are mapped to the preset message queue.

[0021] Optionally, the step of extracting the resource status events from the preset message queue and generating a compressed index of the preset cluster resources includes:

[0022] Resource status events are sequentially extracted from the preset message queue as the current resource status events;

[0023] Obtain the current resource ID and the first last event action of the current resource status event;

[0024] Match the current resource ID in the preset compression index;

[0025] If the match is successful, obtain the second last event action of the preset compression index;

[0026] When the first last event action is the same as the second last event action, the time of the current resource status event is updated to the preset compression index to obtain the modified compression index;

[0027] Determine whether all the resource status events have been matched.

[0028] If not, use the modified compression index as the preset compression index, and return to the step of sequentially extracting resource status events from the preset message queue as the current resource status events;

[0029] If so, the modified compression index will be used as the compression index for the preset service.

[0030] Optionally, it also includes:

[0031] When the first last event action is different from the second last event action, the current resource status event is added to the preset compression index to obtain the modified compression index;

[0032] Determine whether all the resource status events have been matched.

[0033] If not, use the modified compression index as the preset compression index, and return to the step of sequentially extracting resource status events from the preset message queue as the current resource status events;

[0034] If so, the modified compression index will be used as the compression index for the preset service.

[0035] Optionally, the step of aggregating the resource status events according to the compressed index to obtain the statistical results of the resource status events includes:

[0036] Obtain the start and end times of preset indicators;

[0037] The resource status events in the compressed index are aggregated according to the start and end times of the preset indicators to obtain the aggregation result.

[0038] The present invention also provides a resource status event aggregation device, comprising:

[0039] The resource status event creation module is used to create resource status events for preset cluster resources;

[0040] The mapping module is used to map the resource status events to a preset message queue;

[0041] A compressed index generation module is used to extract the resource status events from the preset message queue and generate a compressed index for the preset cluster resources.

[0042] The aggregation module is used to aggregate the resource status events according to the compression index to obtain the aggregation result of the resource status events.

[0043] Optionally, the resource status event creation module includes:

[0044] The initial resource status event and resource status event format acquisition submodule is used to acquire the initial resource status events and resource status event formats of preset cluster resources;

[0045] The resource information extraction submodule is used to extract resource information from the initial resource status event according to the resource status event format.

[0046] The resource status event generation submodule is used to combine the resource messages according to the resource status event format to generate resource status events.

[0047] The present invention also provides an electronic device, the device comprising a processor and a memory:

[0048] The memory is used to store program code and transmit the program code to the processor;

[0049] The processor is configured to execute the resource status event aggregation method as described above, according to the instructions in the program code.

[0050] The present invention also provides a computer-readable storage medium for storing program code for executing the resource status event aggregation method as described in any of the preceding claims.

[0051] As can be seen from the above technical solutions, the present invention has the following advantages: The present invention provides a resource status event aggregation method, including: creating resource status events of a preset cluster resource; mapping the resource status events to a preset message queue; extracting the resource status events in the preset message queue and generating a compressed index of the preset cluster resource; aggregating the resource status events according to the compressed index to obtain the aggregation result of the resource status events.

[0052] As shown in the above steps, this invention addresses the problem of insufficient richness of native resource status events by creating resource status events for preset cluster resources. Next, it compresses the resource status events to reduce data volume, thereby improving the storage persistence of resource status events. Finally, it aggregates the compressed resource status events, allowing developers to quickly extract specific data based on the aggregation results, thus improving the extraction efficiency of resource status events. Attached Figure Description

[0053] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0054] Figure 1 A flowchart illustrating the steps of a resource status event aggregation method provided in an embodiment of the present invention;

[0055] Figure 2 A flowchart illustrating the steps of a resource status event aggregation method according to another embodiment of the present invention;

[0056] Figure 3 This is a structural block diagram of a resource status event aggregation device provided in an embodiment of the present invention. Detailed Implementation

[0057] This invention provides a method, apparatus, electronic device, and storage medium for aggregating resource status events, which addresses the technical problems of native Kubernetes resource status events being limited by storage, having short storage cycles, and low extraction efficiency.

[0058] To make the objectives, features, and advantages of this invention more apparent and understandable, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the embodiments described below are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.

[0059] Please see Figure 1 , Figure 1 A flowchart illustrating the steps of a resource status event aggregation method provided in an embodiment of the present invention.

[0060] The present invention provides a resource status event aggregation method, which may specifically include the following steps:

[0061] Step 101: Create resource status events for preset cluster resources;

[0062] A cluster typically consists of several master nodes and worker nodes. It integrates host machine resources and manages resources such as network, storage, CPU, and memory. Currently, in the industry standard, containers are usually built on lightweight and highly scalable container scheduling clusters (such as Kubernetes).

[0063] Resources refer to a series of objects in a cluster, including pods, jobs, deployments, etc.

[0064] Resource status events: When cluster resources undergo state changes, a series of events occur. Taking a pod as an example, there will be events such as pod creation, pod scheduling, pod being assigned to a node, pod container image being pulled, pod starting to run, and pod destruction.

[0065] In this embodiment of the invention, the original cluster resource status event contains some information that the platform does not need, which consumes a considerable amount of space. Therefore, this embodiment of the invention redefines the resource status event format to remove the information that the platform does not need from the initial resource status event.

[0066] In one example, the resource status event format defined in this embodiment of the invention is as follows:

[0067] event={event_time,resource_id,resource_type,action,message}.

[0068] Where event_time is the time the event occurred, resource_id is the resource ID, resource_type is the resource type, action is the event action, and message is the event message.

[0069] Based on the redefined format of resource state events, these events can be recreated. Because the recreated resource state events eliminate some information that the platform doesn't need, storage pressure is reduced, and they can be stored more persistently compared to existing technologies.

[0070] Step 102: Map resource status events to a preset message queue;

[0071] A message queue is a container that stores messages during transmission. It acts as middleware, relaying messages from source to destination. The primary purpose of a message queue is to provide routing and ensure message delivery; if the receiver is unavailable when a message is sent, the message queue retains the message until it can be successfully delivered.

[0072] After creating resource status events for each cluster resource, they can be mapped to different message queues to process the resource status events in a certain order.

[0073] Step 103: Extract resource status events from the preset message queue and generate a compressed index of the preset cluster resources;

[0074] After adding all resource status events of the cluster resources to the message queue, the resource status events in the message queue can be compressed to generate a compressed index of the preset cluster resources. This reduces the storage pressure on resource status events.

[0075] In one example, the compression of resource status events could involve deleting duplicate resource status events that meet certain conditions.

[0076] Step 104: Aggregate the resource status events based on the compressed index to obtain the aggregated result of the resource status events.

[0077] In information science, aggregation refers to the selection, analysis, and classification of relevant data to obtain the desired results. It mainly refers to any data transformation process that can produce scalar values ​​from arrays.

[0078] After compressing resource status events, these events in the compressed index can be aggregated to obtain an aggregated result. Aggregating resource status events allows for statistical analysis, facilitating data extraction and application by developers and improving the efficiency of resource status event extraction.

[0079] This invention addresses the issue of insufficient richness of native resource status events by creating pre-defined resource status events for cluster resources. Next, it compresses these resource status events to reduce data volume, thereby improving storage persistence. Finally, it aggregates the compressed resource status events, allowing developers to quickly extract specific data based on the aggregation results, thus improving the efficiency of resource status event extraction.

[0080] Please see Figure 2 , Figure 2 A flowchart illustrating the steps of a resource status event aggregation method according to another embodiment of the present invention. Specifically, it may include the following steps:

[0081] Step 201: Obtain the initial resource status event and resource status event format of the preset cluster resources;

[0082] The initial resource status event of a cluster resource is a resource status event from native resource status event sources such as watch / Kubernetes. Because the native cluster resource status events contain some information that the platform does not need, this information consumes a significant amount of space, causing the platform's storage space to be used up too quickly. This necessitates periodic space cleanup, making it impossible to persistently save the resource status events. Therefore, this embodiment of the invention redefines the resource status event format to remove the platform-unnecessary information from the initial resource status event, retaining only the information required by the platform.

[0083] In one example, the resource status event format defined in this embodiment of the invention is as follows:

[0084] event={event_time,resource_id,resource_type,action,message}.

[0085] Step 202: Extract resource information from the initial resource status event according to the resource status event format;

[0086] Step 203: Combine resource messages according to the resource status event format to generate resource status events;

[0087] After obtaining the resource status event format, the information defined in the resource status event format can be extracted from the initial resource status event. The extracted information is then used to fill the resource status event format to obtain the recreated resource status event.

[0088] Furthermore, developers can create and publish custom resource status events within the service. For example, in the resource scheduler service, native Kubernetes resource status events only include basic events such as pod creation, pod scheduling completion, pod allocation to nodes, container pulling images within a pod, and pod destruction. These events do not cover the entire resource scheduling cycle, making it impossible to obtain accurate metrics for system improvement when monitoring and evaluating the performance of the resource scheduler server in scheduling pods. Therefore, in this embodiment of the invention, more custom resource status events can be defined to constitute the entire lifecycle of cluster resources. For example, custom events can be defined such as pod scheduling missing resources or pod scheduling stopping due to exceeding quotas.

[0089] Step 204: Map resource status events to a preset message queue;

[0090] After creating resource status events for each cluster resource, they can be mapped to different message queues to process the resource status events in a certain order.

[0091] However, when producers publish resource status events on various services, the sheer number of these events can lead to message backlog and excessive processing time if a standard single-message queue is used for caching, thus impacting the service.

[0092] Therefore, in this embodiment of the invention, the step of mapping resource status events to a preset message queue may include the following sub-steps:

[0093] S11, retrieve the resource ID of the resource status event from the resource information;

[0094] S12, retrieve the first eight digits of the resource ID;

[0095] S13, retrieve the preset message queue corresponding to the first eight digits of the mapping key and the resource ID;

[0096] S14, map resource status events to a preset message queue.

[0097] In this embodiment of the invention, resource status events can be mapped to different message queues based on resource ID (resource_id), and then multiple consumers can be used to process the event messages of each message queue.

[0098] Since the resource_id is in the form of a hexadecimal UUID like 6f5c3c41-9393-44ed-8c83-b96b197438f9, the first eight digits of the resource_id can be used as a mapping key to map resource status events to different message queues.

[0099] For example, in this embodiment of the invention, 16 message queues can be opened. The first message queue processes the first eight resource status events in the range [0, 2^32 / 16*1], the second message queue processes the first eight resource status events in the range [2^32 / 16*1, 2^32 / 16*2], and so on, until the 16th message queue processes the first eight resource status events in the range [2^32 / 16*15, 2^32 / 16*16]. By mapping resource status events to different message queues for processing, the processing efficiency of resource status events can be improved.

[0100] It should be noted that the above-described message queue division is merely an example of an embodiment of the present invention, and those skilled in the art can choose other division criteria for message queues according to actual circumstances. The embodiments of the present invention do not impose specific limitations in this regard.

[0101] Step 205: Extract resource status events from the preset message queue and generate a compressed index of the preset cluster resources;

[0102] After adding all resource status events of the cluster resources to the message queue, the resource status events in the message queue can be compressed to generate a compressed index of the preset cluster resources. This reduces the storage pressure on resource status events.

[0103] In one example, the step of extracting resource status events from the message queue and generating a compressed index of a preset cluster resource may include the following sub-steps:

[0104] S21, sequentially extract resource status events from the preset message queue as the current resource status events;

[0105] S22, get the current resource ID and the first and last event actions of the current resource status event;

[0106] S23, Match the current resource ID in the preset compression index;

[0107] S24, if the match is successful, obtain the second last event action of the preset compressed index;

[0108] S25, when the first last event action is the same as the second last event action, update the time of the current resource status event to the preset compression index to obtain the modified compression index;

[0109] S26, Determine whether all resource status events have been matched;

[0110] S27, If not, modify the compression index as the preset compression index and return to the step of sequentially extracting resource status events as the current resource status events from the preset message queue;

[0111] S28, If so, modify the compressed index as the compressed index for the default service.

[0112] In this embodiment of the invention, the first last event action refers to the last time action of the current resource status event; the second last event action refers to the last event action in the preset compression index.

[0113] In this embodiment of the invention, for each message queue, the consumer can start a corresponding consumer to consume resource status events.

[0114] If all resource status events are stored during the consumption process, it will put a lot of pressure on storage. Therefore, it is necessary to compress some redundant resource status events.

[0115] For example, in Kubernetes, there are many recurring resource status events. A typical sequence of resource status events in a pod's lifecycle might be: 1) pod creation; 2) pod scheduling begins; 3.1) pod lacks resources; 3.2) pod lacks resources; 3.3) pod lacks resources; 4) pod scheduling complete; 5) pod assigned to a node; 6.1) container1 in the pod has pulled the image; 6.2) container2 in the pod has pulled the image; 6.3) container3 in the pod has pulled the image; 7) pod starts running; 8) pod is destroyed. When saving these resource status events, the three resource status events indicating resource shortage (3.1), 3.2), and 3.3) can be compressed into a single resource status event. Similarly, the three resource status events indicating image pulling (6.1) and 6.2) can be compressed into a single resource status event, thus saving significant storage space.

[0116] In the specific implementation, assume the record format of the compressed index is as follows:

[0117] resource={resource_id,resource_type,last_update_time,last_action,events,stats};

[0118] First, resource status events are extracted based on their sequence numbers, and each resource status event is identified as the current resource status event. Then, the current resource ID (resource_id) and the first last action (action) of the current resource status event are obtained. In the preset compressed index containing the current resource ID, the second last action (last_action) is matched. If the current resource_id and the last_action in the preset compressed index are the same, it indicates that the action of the current resource status event is the same as the action of the resource status event with the previous sequence number, meaning the current resource status event is the same as the previous resource status event. At this point, the current resource status event and the previous resource status event can be compressed into a single resource status event. Specifically, the current resource status event is not saved to the event in the preset compressed index, but the time in the event corresponding to the preset compressed index is updated to the time of the current resource status event, thus obtaining the updated modified compressed index.

[0119] Then continue to traverse the resource status events, take the next resource status event as the current resource status event, and repeat the above operation until all resource status events have been matched with the preset compression index.

[0120] Furthermore, the step of extracting resource status events from the message queue and generating a compressed index of preset cluster resources may also include the following sub-steps:

[0121] S31, when the first last event action is different from the second last event action, add the current resource status event to the preset compression index to obtain the modified compression index;

[0122] S32, determine whether all resource status events have been matched;

[0123] S33, If not, modify the compression index to the preset compression index and return to the step of sequentially extracting resource status events from the preset message queue as the current resource status events;

[0124] S34, If so, modify the compressed index as the default compressed index for the service.

[0125] In this embodiment of the invention, when the first last event action differs from the second last event action, it indicates that the current resource state event is different from the previous resource state event. At this time, the current resource state event can be added to the preset compression index. Then, the next resource state event is used as the current resource state event, and the above operation is repeated until all resource state events have been matched with the preset compression index.

[0126] Step 206: Aggregate the resource status events based on the compressed index to obtain the aggregated result of the resource status events.

[0127] After compressing resource status events, these events in the compressed index can be aggregated to obtain an aggregated result. Aggregating resource status events allows for the summarization and statistical analysis of resource statuses, facilitating data extraction and application by developers. This improves the efficiency of resource status event extraction.

[0128] In one example, the step of aggregating resource status events based on a compressed index to obtain statistical results for the resource status events may include the following sub-steps:

[0129] S41, obtain the start and end times of preset indicators;

[0130] S42, aggregate the resource status events in the compressed index according to the start and end times of preset indicators to obtain the aggregation result.

[0131] In this embodiment of the invention, when performing aggregated statistics on resource status events, the indicators of resource status can be customized according to the start and end times of the set indicators. Taking a pod as an example, the following indicators can be defined: 1) the time spent on scheduling; 2) the time spent on allocation to a node; 3) the time spent pulling an image, etc.

[0132] Assume the following sequence exists: 1) pod creation; 2) pod scheduling begins; 3.1) pod lacks resources; 3.2) pod lacks resources; 3.3) pod lacks resources; 4) pod scheduling complete; 5) pod is assigned to a node; 6.1) container1 in the pod has finished pulling the image; 6.2) container2 in the pod has finished pulling the image; 6.3) container3 in the pod has finished pulling the image; 7) pod starts running; 8) pod is destroyed.

[0133] The time spent on scheduling = [pod scheduling begins, pod scheduling completes]; the time spent on assigning to a node = [pod scheduling completes, pod is assigned to a node]; the time spent pulling an image = [pod is assigned to a node, pod pulls image completes].

[0134] By setting different metrics, resource status events can be aggregated, making it easier for developers to perform statistics on resource status events.

[0135] Furthermore, in this embodiment of the invention, each metric can be updated in the stats item of the compressed index for subsequent visualization. During visualization, the stats item can be queried using the Grafana tool to obtain the data for visualization.

[0136] This invention addresses the issue of insufficient richness of native resource status events by creating pre-defined resource status events for cluster resources. Next, it compresses these resource status events to reduce data volume, thereby improving storage persistence. Finally, it aggregates the compressed resource status events, allowing developers to quickly extract specific data based on the aggregation results, thus improving the efficiency of resource status event extraction.

[0137] Please see Figure 3 , Figure 3 This is a structural block diagram of a resource status event aggregation device provided in an embodiment of the present invention.

[0138] This invention provides a resource status event aggregation device, comprising:

[0139] The resource status event creation module 301 is used to create resource status events for preset cluster resources;

[0140] Mapping module 302 is used to map resource status events to a preset message queue;

[0141] The compressed index generation module 303 is used to extract resource status events from the message queue and generate a compressed index of preset cluster resources.

[0142] The aggregation module 304 is used to aggregate resource status events based on the compressed index to obtain the aggregated result of resource status events.

[0143] In this embodiment of the invention, the resource status event creation module 301 includes:

[0144] The initial resource status event and resource status event format acquisition submodule is used to acquire the initial resource status events and resource status event formats of preset cluster resources;

[0145] The resource information extraction submodule is used to extract resource information from the initial resource status event according to the resource status event format.

[0146] The resource status event generation submodule is used to combine resource messages according to the resource status event format to generate resource status events.

[0147] In this embodiment of the invention, the mapping module 302 includes:

[0148] The resource ID retrieval submodule is used to retrieve the resource ID of resource status events from resource information;

[0149] The "First Eight Digits Retrieval" submodule is used to retrieve the first eight digits of a resource ID.

[0150] The preset message queue submodule is used to obtain the preset message queue corresponding to the first eight digits of the mapping key and the resource ID;

[0151] The mapping submodule is used to map resource status events to preset message queues.

[0152] In this embodiment of the invention, the compressed index generation module 303 includes:

[0153] The current resource status event determination submodule is used to sequentially extract resource status events from a preset message queue as the current resource status events.

[0154] The current resource ID and first and last event action acquisition submodule is used to obtain the current resource ID and first and last event action of the current resource status event;

[0155] The matching submodule is used to match the current resource ID in a preset compression index;

[0156] The second last event action acquisition submodule is used to acquire the second last event action with a preset compressed index if the match is successful.

[0157] The update submodule is used to update the time of the current resource status event to the preset compression index when the first last event action is the same as the second last event action, so as to obtain the modified compression index.

[0158] The first judgment submodule is used to determine whether all resource status events have been matched.

[0159] The first return submodule is used to, if not, modify the compression index as the preset compression index and return the steps of sequentially extracting resource status events as the current resource status events from the preset message queue.

[0160] The first compressed index generation submodule is used to modify the compressed index as the compressed index for the default service if the condition is met.

[0161] In this embodiment of the invention, the compressed index generation module 303 further includes:

[0162] Add a submodule to add the current resource status event to the preset compression index when the first last event action is different from the second last event action, so as to obtain the modified compression index;

[0163] The second judgment submodule is used to determine whether all resource status events have been traversed.

[0164] The second return submodule is used to, if not, modify the compression index as the preset compression index and return the steps of extracting resource status events as the current resource status events in the preset message queue in sequence.

[0165] The second compressed index generation submodule is used to modify the compressed index as the compressed index for the default service if the condition is met.

[0166] In this embodiment of the invention, the aggregation module 304 includes:

[0167] The start and end time acquisition submodule is used to obtain the start and end times of preset indicators;

[0168] The aggregation submodule is used to aggregate resource status events in the compressed index according to the start and end times of preset metrics to obtain the aggregation result.

[0169] This invention also provides an electronic device, which includes a processor and a memory:

[0170] The memory is used to store program code and transfer the program code to the processor;

[0171] The processor is used to execute the resource status event aggregation method of this embodiment of the invention according to the instructions in the program code.

[0172] This invention also provides a computer-readable storage medium for storing program code for executing the resource status event aggregation method of this invention.

[0173] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0174] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0175] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0176] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0177] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0178] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0179] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0180] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0181] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method of resource state event aggregation, the method comprising: The method comprises the following steps: creating resource state events of preset cluster resources; mapping the resource state events to a preset message queue; extracting the resource state events in the preset message queue to generate a compressed index of the preset cluster resources; aggregating the resource state events according to the compressed index to obtain an aggregation result of the resource state events; wherein the step of extracting the resource state events in the preset message queue to generate the compressed index of the preset cluster resources comprises: extracting resource state events from the preset message queue as current resource state events in sequence; obtaining a current resource id and a first last event action of the current resource state event; matching the current resource id in a preset compressed index; if the matching is successful, obtaining a second last event action of the preset compressed index; when the first last event action is the same as the second last event action, updating a time of the current resource state event to the preset compressed index to obtain a modified compressed index; judging whether all the resource state events are matched; if not, taking the modified compressed index as the preset compressed index and returning to the step of extracting resource state events from the preset message queue as current resource state events in sequence; if yes, taking the modified compressed index as a compressed index of a preset service.

2. The method of claim 1, wherein, The step of creating resource state events of preset cluster resources comprises: obtaining an initial resource state event and a resource state event format of a preset cluster resource; extracting resource information from the initial resource state event according to the resource state event format; combining the resource information according to the resource state event format to generate a resource state event.

3. The method of claim 2, wherein, The step of mapping the resource state events to a preset message queue comprises: obtaining a resource id of the resource state event from the resource information; obtaining the first eight bits of the resource id; obtaining a preset message queue corresponding to the mapping key and the first eight bits of the resource id; mapping the resource state event to the preset message queue.

4. The method of claim 1, wherein, The method further comprises the following steps: when the first last event action is different from the second last event action, adding the current resource state event into the preset compressed index to obtain a modified compressed index; judging whether all the resource state events are matched; if not, taking the modified compressed index as a preset compressed index and returning to the step of extracting resource state events from the preset message queue as current resource state events in sequence; if yes, taking the modified compressed index as a compressed index of a preset service.

5. The method of claim 1, wherein, The step of aggregating the resource state events according to the compressed index to obtain a statistical result of the resource state events comprises: obtaining a start time and an end time of a preset index; aggregating the resource state events in the compressed index according to the start time and the end time of the preset index to obtain an aggregation result.

6. A resource state event aggregation apparatus, characterized by The method comprises the following steps: a resource state event creation module for creating resource state events of preset cluster resources; a mapping module for mapping the resource state events to a preset message queue; The compression index generation module is configured to extract the resource state events in the preset message queue and generate a compression index of the preset cluster resource. The aggregation module is configured to aggregate the resource state events according to the compression index and obtain an aggregation result of the resource state events. The compression index generation module comprises: The current resource state event determination submodule is configured to extract resource state events in the preset message queue as current resource state events in sequence. The current resource id and first last event action acquisition submodule is configured to acquire a current resource id and a first last event action of the current resource state event. The matching submodule is configured to match the current resource id in the preset compression index. The second last event action acquisition submodule is configured to acquire a second last event action of the preset compression index if the matching is successful. The update submodule is configured to update a time of the current resource state event to the preset compression index when the first last event action is the same as the second last event action, to obtain a modified compression index. The first judgment submodule is configured to judge whether all resource state events are matched. The first return submodule is configured to return the modified compression index as the preset compression index if not, and return the step of extracting resource state events in the preset message queue as current resource state events in sequence. The first compression index generation submodule is configured to return the modified compression index as the compression index of the preset service if yes.

7. The apparatus of claim 6, wherein, The resource state event creation module comprises: The initial resource state event and resource state event format acquisition submodule is configured to acquire an initial resource state event and a resource state event format of the preset cluster resource. The resource information extraction submodule is configured to extract resource information from the initial resource state event according to the resource state event format. The resource state event generation submodule is configured to combine the resource information according to the resource state event format and generate a resource state event.

8. An electronic device, comprising: The device comprises a processor and a memory: The memory is configured to store program code and transmit the program code to the processor. The processor is configured to execute the resource state event aggregation method according to the instructions in the program code.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium is configured to store program code, and the program code is configured to execute the resource state event aggregation method. The computer readable storage medium is configured to store program code, and the program code is configured to execute the resource state event aggregation method.

Citation Information

Patent Citations

  • A large-scale human face retrieval method and device based on depth feature

    CN109241325A