Event dispatching optimization method and device under super-large-scale kubernetes cluster

By only distributing to watchers who care about the event in a hyper-large kubernetes cluster, and using WatcherMap and EventsMap component units for event classification push, the problem of low event distribution efficiency in the existing technology is solved, and efficient event push and stable large-scale container base are achieved.

WO2025124475A1PCT designated stage expired Publication Date: 2025-06-19CHINA TELECOM CLOUD TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/138790
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-13
Filing Date
2024-12-12
Publication Date
2025-06-19

AI Technical Summary

Technical Problem

In hyper-large kubernetes clusters, the current technology event distribution strategy is extremely inefficient and has high time complexity, resulting in serious waste of computing power.

Method used

By only distributing to watchers who care about the event when the event is distributed, and using WatcherMap and EventsMap component units, events are classified by key and pushed to watchers who care about the key, reducing the complexity of event push.

Benefits of technology

It greatly reduces the complexity of event push, reduces the waste of computing power, improves the stability of large-scale container bases, and improves the efficiency of event message notification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024138790_19062025_PF_FP_ABST
    Figure CN2024138790_19062025_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of cloud computing. Disclosed are an event dispatching optimization method and device under a super-large-scale Kubernetes cluster. The device comprises: an event dispatching unit, configured to only dispatch an event to a watcher interested in the event; a channel creation unit, configured to, when viewing a resource by means of apiserver, create a corresponding channel under a corresponding watcherKey; a parsing and matching unit, configured to parse the key of the event by means of a Dispatcher and then perform matching to determine whether the key is present in a watcherMap, and if so, append the event to an EventsMap corresponding to the eventKey; and a WatcherMap unit and an EventsMap component. According to the present invention, by means of data models of the watcherMap and the eventsMap, the event pushing complexity is greatly reduced, and the stability of a large-scale container platform is improved; an accurate and efficient event matching and pushing process reduces a large amount of computing power.
Need to check novelty before this filing date? Find Prior Art

Description

A method and device for optimizing event distribution in ultra-large-scale Kubernetes clusters

[0001] This application claims priority to Chinese patent application No. 2023117073615, filed on December 13, 2023, entitled “A method and device for optimizing event distribution in an ultra-large-scale Kubernetes cluster,” the entire text of which is hereby incorporated by reference. Technical Field

[0002] The present application relates to the field of cloud computing technology, and in particular to a method and device for optimizing event distribution in an ultra-large-scale Kubernetes cluster. Background Art

[0003] In the existing technology, the architecture that uses etcd (a KV database frequently used in small-scale Kubernetes clusters) as the database only supports 5,000 nodes. In the construction of ultra-large-scale clusters with 30,000+ nodes, tikv (an open source domestic KV database) is used as the underlying storage, but the API server does not support tikv. Therefore, we use the open source kubebrain (an open source data adaptation layer of tikv that supports etcd's API protocol and converts it into tikv's API calls, making the Kubernetes API server component open source and directly changing from calling etcd to calling kubebrain) as our data adapter layer.

[0004] The current event distribution strategy of the KubeBrain component is that the dispatcher sends all events to all watchers (kube-apiserver), and then each watcher starts a Goroutine to match strings and filter out events that are not its own. This is extremely inefficient and time-consuming. Summary of the Invention

[0005] The purpose of this section is to summarize some aspects of the embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the abstract and title of this application to avoid obscuring the purpose of this section, the abstract and the title of the invention, and such simplifications or omissions should not be used to limit the scope of the present invention.

[0006] In view of the above problems in the prior art, the present invention is proposed.

[0007] Therefore, the purpose of the present invention is to provide a method and device for optimizing event distribution in a super-large-scale Kubernetes cluster, whose precise and efficient event matching step process and push process reduce a lot of computing power.

[0008] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0009] A method for optimizing event distribution in a super-large-scale Kubernetes cluster, comprising the following steps:

[0010] Step 1: When an event is distributed, it will only be distributed to the watchers that care about this event;

[0011] Step 2: When viewing resources through the apiserver, a corresponding channel will be created under the corresponding watcherKey;

[0012] Step 3: Use Dispatcher to parse the event key and check whether it exists in the watcherMap. If it exists, append it to the EventsMap corresponding to the eventKey.

[0013] Step 4: Finally, we implement the transition from “pushing everything to all watchers” to “classifying events by key and pushing them to the watchers that follow this key” through the WatcherMap component unit and the EventsMap component unit.

[0014] As a preferred solution of the method for optimizing event distribution in an ultra-large-scale Kubernetes cluster described in the present invention, the watcher is a hash table, which contains the message reading channel and event version of the event received by the watcher.

[0015] As a preferred solution of the method for optimizing event distribution in an ultra-large-scale Kubernetes cluster described in the present invention, the WatcherMap component unit is a multi-level hash table.

[0016] As a preferred solution of the method for optimizing event distribution in a super-large-scale Kubernetes cluster described in the present invention, the EventsMap component unit is a hash table. When all generated events come out of the Event Dispatcher, the event keys are split and parsed.

[0017] As a preferred solution of the method for optimizing event distribution in a super-large-scale Kubernetes cluster described in the present invention, the splitting and parsing method is:

[0018] Parse / registry / services / specs / xxxx events into key1: / registry / services / and key2: / registry / services / specs / .

[0019] As a preferred solution of the method for optimizing event distribution in a super-large-scale Kubernetes cluster described in the present invention, if the key2 exists in the watcherKey in the WatcherMap, the event is appended to the eventsMap, and finally all events corresponding to the key / registry / services / specs / in the eventsMap are pushed to all watchers with the watchKey of / registry / services / specs / . Of course, if the watcherKey of key2 does not exist in the WatcherMap, it will be lost.

[0020] As a preferred solution of the method for optimizing event distribution in a super-large-scale Kubernetes cluster described in the present invention, the judgment logic of key1 and key2 is the same.

[0021] An event distribution optimization device in a super-large-scale Kubernetes cluster, the device being applied to the above-mentioned method for optimizing event distribution in a super-large-scale Kubernetes cluster, comprising: an event distribution unit, configured to distribute events only to watchers that are interested in the event;

[0022] The channel creation unit is used to create a corresponding channel under the corresponding watcherKey when viewing resources through the apiserver;

[0023] Parsing matching unit, after parsing the event key through Dispatcher, matches whether it exists in the watcherMap. If it exists, it is appended to the EventsMap corresponding to the eventKey.

[0024] As well as the WatcherMap unit and EventsMap components, they are used to implement the transition from “pushing everything to all watchers” to “classifying events by key and pushing them to the watchers that follow this key”.

[0025] As a preferred solution for the event distribution optimization device under an ultra-large-scale Kubernetes cluster described in the present invention, the WatcherMap component unit is a multi-level hash table; the EventsMap component unit is a hash table. When all generated events come out of the Event Dispatcher, the event keys are split and parsed.

[0026] A storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for optimizing event distribution in an ultra-large-scale Kubernetes cluster.

[0027] The beneficial effects of the present invention are as follows: the present invention significantly reduces the complexity of event push events through the watcherMap and eventsMap data models, and improves the stability of large-scale container bases; the precise and efficient event event matching step process and push process reduce a lot of computing power. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. Those skilled in the art can also derive other drawings based on these drawings without inventive effort. Among them:

[0029] FIG1 is a timing diagram of a method for optimizing event distribution in a super-large-scale Kubernetes cluster proposed by the present invention. DETAILED DESCRIPTION

[0030] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0031] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0032] Secondly, the term "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in various places throughout this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive of other embodiments.

[0033] Furthermore, the present invention is described in detail with reference to schematic diagrams. For ease of illustration, when describing the embodiments of the present invention, cross-sectional views illustrating device structures may be partially enlarged and not to scale. Furthermore, the schematic diagrams are merely illustrative and should not limit the scope of protection of the present invention. Furthermore, in actual production, the three-dimensional dimensions of length, width, and depth should be included.

[0034] 1 , an embodiment of the present invention provides a method and device for optimizing event distribution in a large-scale Kubernetes cluster. The method includes the following steps:

[0035] Step 1: When an event is distributed, it will only be distributed to the watchers that care about this event;

[0036] The watcher is a hash table, which contains the message reading channel and event version of the event received by the watcher.

[0037] Step 2: When viewing resources through the apiserver, a corresponding channel will be created under the corresponding watcherKey;

[0038] Step 3: Use Dispatcher to parse the event key and check whether it exists in the watcherMap. If it exists, append it to the EventsMap corresponding to the eventKey (key is the prefix of the event);

[0039] Step 4: Finally, the WatcherMap component unit and the EventsMap component unit are used to realize the transition from "pushing all events to all watchers" to "classifying events by key and pushing them to the watchers that pay attention to this key". The WatcherMap component unit is a multi-level hash table, where wathchKey is the key of the event watched by the watcher. For example, if watch1 (apiserver1) receives the pods event (key is / registry / pods / ) and requires version>100, then watcher1 is stored as <eventchannel1:100>, and then store it in WatcherMap.

[0040] The EventsMap component unit is a hash table. When all generated events come out of the Event Dispatcher, the event keys are split and parsed.

[0041] The splitting and parsing method is as follows: as shown in Figure 1, the / registry / services / specs / xxxx event is parsed into key1: / registry / services / and key2: / registry / services / specs / . If the key2 exists in the watcherKey in the WatcherMap, the event is appended to the eventsMap. Finally, all events corresponding to the key / registry / services / specs / in the eventsMap are pushed to all watchers with the watchKey of / registry / services / specs / . Of course, if the watcherKey of key2 does not exist in the WatcherMap, it will be lost (an event that no one pays attention to), and the judgment logic of key1 and key2 is the same.

[0042] The device used in the above-mentioned method for optimizing event distribution in a super-large-scale Kubernetes cluster includes: an event distribution unit, which is used to distribute events only to watchers that are interested in the event;

[0043] The channel creation unit is used to create a corresponding channel under the corresponding watcherKey when viewing resources through the apiserver;

[0044] Parsing matching unit, after parsing the event key through Dispatcher, matches whether it exists in the watcherMap. If it exists, it is appended to the EventsMap corresponding to the eventKey.

[0045] The WatcherMap unit and EventsMap component are used to achieve the transition from "pushing everything to all watchers" to "classifying events by key and pushing them to the watchers that pay attention to this key". Specifically, the WatcherMap component unit is a multi-level hash table; the EventsMap component unit is a hash table. When all generated events come out of the Event Dispatcher, the event keys are split and parsed.

[0046] In addition, the present invention also discloses a storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for optimizing event distribution in an ultra-large-scale Kubernetes cluster as described above.

[0047] In summary, the present invention can reduce the CPU load of tikv's data conversion layer kubebrain, improve the message notification efficiency of event events, and reduce time complexity; it greatly reduces the calculation amount of kubebrain and saves CPU resources.

[0048] On large-scale container infrastructure (Kubernetes with 30,000+ nodes), this change significantly improves the message notification capabilities of the Kubernetes component, ensuring that events received by the API server are handled promptly by the API server's operators and controllers.

[0049] The watcherMap and eventsMap data models significantly reduce the complexity of event push and improve the stability of large-scale container bases. The precise and efficient event matching and push processes reduce a lot of computing power.

[0050] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A method for optimizing event distribution in a super-large-scale kubernetes cluster, characterized in that: The method comprises the following steps: Step 1: When an event is distributed, it will only be distributed to the watchers that care about this event; Step 2: When viewing resources through apiserver, the corresponding channel will be created under the corresponding watcherKey; Step 3: Use Dispatcher to parse the event key and check whether it exists in the watcherMap. If it exists, append it to the EventsMap corresponding to the eventKey. Step 4: Finally, the WatcherMap component unit and the EventsMap component unit are used to implement the transition from "pushing all events to all watchers" to "classifying events by key and pushing them to the watchers that pay attention to this key".

2. According to claim 1, a method for optimizing event distribution in a super-large-scale kubernetes cluster is characterized in that: The watcher is a hash table, which contains the message reading channel and event version of the event received by the watcher.

3. The method for optimizing event distribution in a super-large-scale kubernetes cluster according to claim 1, characterized in that: The WatcherMap component unit is a multi-level hash table.

4. The method for optimizing event distribution in a super-large-scale kubernetes cluster according to claim 1, characterized in that: The EventsMap component unit is a hash table. When all generated events come out of the Event Dispatcher, the event keys are split and parsed.

5. The method for optimizing event distribution in a super-large-scale kubernetes cluster according to claim 4 is characterized in that: The splitting and parsing method is: parsing the / registry / services / specs / xxxx event into key1: / registry / services / and key2: / registry / services / specs / .

6. The method for optimizing event distribution in a super-large-scale kubernetes cluster according to claim 5, characterized in that: If the key2 exists in the watcherKey in WatcherMap, the event is appended to eventsMap, and finally all events corresponding to the key / registry / services / specs / in eventsMap are pushed to all watchers with watchKey / registry / services / specs / . Of course, if the watcherKey of key2 in WatcherMap does not exist, it will be lost.

7. The method for optimizing event distribution in a super-large-scale kubernetes cluster according to claim 6, characterized in that: The judgment logic of key1 and key2 is the same.

8. A device for optimizing event distribution in a super-large-scale kubernetes cluster, the device being applied to the method for optimizing event distribution in a super-large-scale kubernetes cluster as claimed in any one of claims 1 to 7, characterized in that: include: The event distribution unit is used to distribute events only to watchers that care about this event; The channel creation unit is used to create the corresponding channel under the corresponding watcherKey when viewing resources through the apiserver; Parsing and matching unit, through Dispatcher, parses the event key and matches whether it exists in the watcherMap. If it exists, it is appended to the EventsMap corresponding to the eventKey; As well as the WatcherMap unit and EventsMap components, they are used to implement the transition from "pushing everything to all watchers" to "classifying events by key and pushing them to the watchers that follow this key".

9. The device for optimizing event distribution in a super-large-scale kubernetes cluster according to claim 8, characterized in that: The WatcherMap component unit is a multi-level hash table; the EventsMap component unit is a hash table. When all events generated come out of the Event Dispatcher, the event keys are split and parsed.

10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for optimizing event distribution in an ultra-large-scale Kubernetes cluster are implemented as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Universe event distribution method and system in distributed cloud scene

    CN114584555A

  • Method and device for event distribution optimization under super-large scale kubernetes cluster

    CN117827482A

  • Event distribution pattern for use with a distributed data grid

    US20120278817A1

  • Event handling system and method

    US20140201762A1