A method and system for expanding a k8s cluster by hot push
By expanding the k8s cluster in advance during the unfinished push stage, combining the configuration center and message queue management strategies, the problem of user influx caused by push message push in the existing technology is solved, and the stability and resource efficiency of the system are improved.
Patent Information
- Application Number
- CN202111489002.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-08
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2041-12-08
AI Technical Summary
The existing k8s cluster automatic scaling method can only scale based on one indicator, and cannot effectively deal with the influx of users caused by push message push, resulting in system crash.
By expanding the k8s cluster in advance during the unfinished push stage, the expansion strategy is determined based on the issuance information and replica information of the hotspot push, the parallel expansion of multiple services is achieved, and policy management and communication is managed and communicated using the configuration center and message queue.
It effectively avoids system crashes, improves the accuracy and efficiency of capacity expansion, reduces resource investment, supports multi-service parallel capacity expansion, and solves the problem of lag in capacity expansion.
Smart Images

Figure CN114217960B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of hotspot demand expansion, and particularly to a method and system for expanding a k8s cluster by hotspot push. Background Art
[0002] Push, as a common message push means for mobile apps, can wake up users, improve user retention rate, and increase product activity. More and more messages are pushed to users in the form of push, and as a result, a large number of users pour into the app page instantaneously, leading to extremely high pressure on the app service and even the app service being unable to be opened. Currently, the solution in the industry is to use a large number of redundant servers as backup resources to cope with sudden access. In the process of implementing the present invention, the applicant found that the existing technology "hpa of the k8s cluster for automatic expansion" has the following disadvantages: it can only expand based on one indicator and cannot be used for the push scenario. Summary of the Invention
[0003] An embodiment of the present invention provides a method and system for expanding a k8s cluster by hotspot push, which can expand in advance and complete the expansion task during the unfinished stage of push, effectively avoiding system crashes caused by a large number of users pouring in, and is applicable to the scenario of hotspot push.
[0004] To achieve the above object, on the one hand, an embodiment of the present invention provides a method for expanding a k8s cluster by hotspot push, including:
[0005] When a topic is sent as a hotspot push, determine whether to load the expansion strategy of the hotspot push according to the sending information of the hotspot push;
[0006] When it is determined that the expansion strategy of the hotspot push needs to be loaded, load the expansion strategy of the hotspot push and obtain the replica information of the k8s cluster where the hotspot push is located;
[0007] Determine the number of expanded replicas of the k8s cluster according to the expansion strategy of the hotspot push and the replica information of the k8s cluster where the hotspot push is located, and expand the k8s cluster where the hotspot push is located according to the determined number of expanded replicas of the k8s cluster;
[0008] After the expansion of the k8s cluster where the hotspot push is located is completed, send the hotspot push to trigger users to access the hotspot push.
[0009] On the other hand, an embodiment of the present invention provides a system for expanding a k8s cluster by hotspot push, including:
[0010] The expansion judgment unit is used to determine whether to load the expansion policy of the hot push when pushing the topic as a hot push. When it is determined that the expansion policy of the hot push needs to be loaded, the expansion policy of the hot push is loaded, and the replica information of the k8s cluster where the hot push is located is obtained.
[0011] The expansion execution unit is used to determine the number of expanded replicas of the k8s cluster according to the expansion policy of the hot push and the replica information of the k8s cluster where the hot push is located, and expand the k8s cluster where the hot push is located according to the determined number of expanded replicas of the k8s cluster.
[0012] The hot push distribution unit is used to distribute the hot push after the expansion of the k8s cluster where the hot push is located is completed, so as to trigger users to access the hot push.
[0013] The above technical solution has the following beneficial effects: It can expand capacity in advance, complete the expansion task during the stage when the push is not completed, effectively avoid system crashes caused by a large number of users pouring in, and is applicable to the scenario of hot push. Description of the Drawings
[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0015] Figure 1 It is a flowchart of a method for expanding a k8s cluster for a hot push in an embodiment of the present invention;
[0016] Figure 2 It is a structural diagram of a system for expanding a k8s cluster for a hot push in an embodiment of the present invention;
[0017] Figure 3 It is a general flowchart of a method for expanding a k8s cluster for a hot push with centralized configuration in an embodiment of the present invention;
[0018] Figure 4 It is a step-by-step flowchart of a method for expanding a k8s cluster for a hot push with centralized configuration in an embodiment of the present invention. Detailed Embodiments
[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0020] As Figure 1 shown, in combination with the embodiments of the present invention, a method for expanding a k8s cluster by hot push is provided, including:
[0021] S101: When the topic is pushed as a hot push, determine whether to load the expansion policy of the hot push according to the distribution information of the hot push;
[0022] S102: When it is determined that the expansion policy of the hot push needs to be loaded, load the expansion policy of the hot push and obtain the replica information of the k8s cluster where the hot push is located;
[0023] S103: Determine the number of expanded replicas of the k8s cluster according to the expansion policy of the hot push and the replica information of the k8s cluster where the hot push is located, and expand the k8s cluster where the hot push is located according to the determined number of expanded replicas of the k8s cluster;
[0024] S104: After the expansion of the k8s cluster where the hot push is located is completed, issue the hot push to trigger users to access the hot push.
[0025] Preferably, it further includes:
[0026] S105: When the topic corresponding to the hot push is established, create an expansion policy on the policy construction page and write the expansion policy into the configuration center. The expansion policy is used as the basis for expanding the k8s cluster where the hot push is located when the topic becomes a hot push; wherein, the expansion policy includes: the k8s cluster where the hot push is located, the default hot push level and the corresponding expansion percentage, and the policy execution period;
[0027] In step 103, the determining the number of expanded replicas of the k8s cluster according to the expansion policy of the hot push and the replica information of the k8s cluster where the hot push is located specifically includes:
[0028] Determine the number of expanded replicas of the k8s cluster jointly according to the expansion percentage in the expansion policy and the replica information of the k8s cluster where the hot push is located;
[0029] The method for expanding the k8s cluster by hot push further includes:
[0030] S106: Before expansion, when the expansion percentage of the hot push does not match the current hot push level, modify the expansion policy of the hot push according to the change of the hot push level to a matching expansion policy with the current hot push level.
[0031] Preferably, it further includes:
[0032] S107: When sending a topic as a hot push, if it is determined that the expansion policy of the hot push needs to be loaded but the expansion policy of the hot push is not loaded, create the expansion policy of the hot push on the policy construction page and write the expansion policy of the hot push into the configuration center.
[0033] Preferably, the hot push includes at least one service;
[0034] In step 105, the creating the expansion policy on the policy construction page and writing the expansion policy into the configuration center specifically includes:
[0035] S1051: Create corresponding expansion policies for at least one service included in the topic corresponding to the hot push respectively, and associate the expansion policies corresponding to each service as the expansion policy of the hot push;
[0036] In step 102, when it is determined that the expansion policy of the hot push needs to be loaded, loading the expansion policy of the hot push specifically includes:
[0037] S1021: When it is determined that the expansion policy of the hot push needs to be loaded, load the expansion policies of each service associated with the hot push.
[0038] Preferably, it further includes:
[0039] S108: Take out the created expansion policy for the topic corresponding to the hot push from the configuration center and write it into the message queue;
[0040] S109: Before sending a topic as a hot push, write the sending information of the hot push into the message queue;
[0041] S110: When sending a topic as a hot push, obtain the sending information of the hot push from the message queue;
[0042] S111: Obtain the expansion policy of the hot push that needs to be loaded from the message queue according to the sending information of the hot push;
[0043] The method for expanding the k8s cluster based on hotspot push also includes:
[0044] S112: After expanding the k8s cluster where the hotspot push is located, obtain the replica expansion information of the k8s cluster, where the replica expansion information of the k8s cluster includes the number of expanded replicas of the k8s cluster;
[0045] S113: Write the obtained replica expansion information of the k8s cluster into the message queue;
[0046] S114: Read the replica expansion information of the k8s cluster in the message queue for display.
[0047] like Figure 2 As shown, in combination with an embodiment of the present invention, a system for hotspot push expansion of a k8s cluster is provided, including:
[0048] The expansion judgment unit 21 is used to determine whether it is necessary to load the expansion policy of the hotspot push according to the issuance information of the hotspot push when the topic is pushed as a hotspot push; when it is determined that the expansion policy of the hotspot push needs to be loaded, the expansion policy of the hotspot push is loaded and the copy information of the k8s cluster where the hotspot push is located is obtained;
[0049] The expansion execution unit 22 is used to determine the number of expansion copies of the k8s cluster according to the expansion strategy of the hot push and the replica information of the k8s cluster where the hot push is located, and expand the k8s cluster where the hot push is located according to the determined number of expansion copies of the k8s cluster;
[0050] The hotspot push sending unit 23 is used to send the hotspot push after the k8s cluster where the hotspot push is located is expanded, so as to trigger the user to access the hotspot push.
[0051] Preferably, it also includes:
[0052] The expansion strategy generation unit 24 is used to create an expansion strategy on the strategy construction page and write the expansion strategy to the configuration center when the topic corresponding to the hot push is established. The expansion strategy is used as a basis for expanding the k8s cluster where the hot push is located when the topic becomes a hot push; wherein the expansion strategy includes: the k8s cluster where the hot push is located, the default hot push level and the corresponding expansion percentage, and the strategy execution period;
[0053] The capacity expansion execution unit 22 includes:
[0054] The scale - out calculation subunit 21 is used to jointly determine the number of scale - out replicas of the k8s cluster according to the scale - out percentage in the scale - out policy and the replica information of the k8s cluster where the hot push is located;
[0055] The scale - out policy generation unit 24 includes:
[0056] The scale - out policy update subunit 241 is used to, before scale - out, when the scale - out percentage of the hot push does not match the current hot push level, modify the scale - out policy of the hot push according to the change of the hot push level to a scale - out policy that matches the current hot push level.
[0057] Preferably, the scale - out policy generation unit 24 includes:
[0058] The scale - out policy addition subunit 242 is used to, when issuing a topic as a hot push, if it is determined that the scale - out policy of the hot push needs to be loaded but the scale - out policy of the hot push has not been loaded, create the scale - out policy of the hot push on the policy construction page and write the scale - out policy of the hot push into the configuration center.
[0059] Preferably, the hot push includes at least one service;
[0060] The scale - out policy generation unit 24 includes a service scale - out policy construction subunit 243, where:
[0061] The service scale - out policy construction subunit 243 is used to respectively create corresponding scale - out policies for at least one service included in the topic corresponding to the hot push, and associate the corresponding scale - out policies of each service as the scale - out policy of the hot push;
[0062] The scale - out execution unit 22 is further used to, when it is determined that the scale - out policy of the hot push needs to be loaded, load the scale - out policies of each service associated with the hot push.
[0063] Preferably, it further includes a scale - out information acquisition unit 25, a communication unit 26, and a display unit 27, where:
[0064] The scale - out information acquisition unit 25 is specifically used for:
[0065] After the k8s cluster where the hot push is located is scaled out, obtain the replica scale - out information of the k8s cluster, and the replica scale - out information of the k8s cluster includes the number of scale - out replicas of the k8s cluster;
[0066] The communication unit 26 is specifically used for:
[0067] Take out the created scaling strategy corresponding to the hot topic push from the configuration center and write it into the message queue;
[0068] Before pushing the topic as a hot topic, write the push information of the hot topic into the message queue;
[0069] When pushing the topic as a hot topic, obtain the push information of the hot topic from the message queue;
[0070] According to the push information of the hot topic, obtain the scaling strategy of the hot topic to be loaded from the message queue;
[0071] Write the replica scaling information of the k8s cluster obtained by the scaling information acquisition unit into the message queue;
[0072] The display unit 27 is specifically used for:
[0073] Read the replica scaling information of the k8s cluster in the message queue for display.
[0074] The beneficial effects obtained by the present invention are as follows:
[0075] First: The system has an automatically configurable scaling strategy, which can match the scaling amount according to the level of the push volume, avoiding the problem that the scaling capacity is not easy to measure.
[0076] Second: The system can scale in advance and complete the scaling task during the stage when the push is not completed, effectively avoiding the system crash caused by a large number of users pouring in.
[0077] Third: The system has a message queue and a configuration center: The message queue can undertake the communication of the entire cluster and solve the information sharing problem among the scaling components; the configuration center can perform unified management and configuration of the scaling strategy and observe the scaling status.
[0078] Fourth: The system supports multiple services to perform parallel scaling according to the strategy, avoiding the problem of single resource shortage in the push hotspots, and at the same time reducing the time consumption of parallel scaling of multiple services.
[0079] The above technical solutions of the embodiments of the present invention will be described in detail below in combination with specific application examples. For technical details not introduced during the implementation process, reference can be made to the relevant descriptions above.
[0080] The technical terms and abbreviations involved in the present invention are defined as follows:
[0081] K8s cluster: Kubernetes is an open source platform for managing containerized applications on multiple hosts in a cloud platform. Kubernetes aims to make deploying containerized applications simple and powerful. Kubernetes provides a mechanism for application deployment, planning, updating, and maintenance.
[0082] Number of replicas: The number of services deployed in the k8s cluster, which can be understood as the capacity of the service.
[0083] Expansion strategy: The expansion strategy in this article refers to the method of expanding the replica capacity under a specific level of push.
[0084] Push hotspot: A mobile app operation method that arouses users through push messages.
[0085] Matching level: Calculates the number of replicas that need to be expanded by matching the expansion strategy level and push level.
[0086] The present invention provides a centralized configuration hotspot push capacity expansion k8s cluster method and system, belonging to the field of centralized configuration and capacity expansion according to hotspot demand. The technical problems that can be solved are as follows:
[0087] First, you can directly formulate expansion strategies in the policy center, and then determine the expansion capacity based on the hotspot push volume and hotspot level, effectively avoiding the problem of inaccurate expansion indicators.
[0088] Second point: Capacity expansion is directly triggered during the hotspot push delivery phase. The capacity expansion process is completed before users flock to the app, effectively avoiding the problem of capacity expansion lag.
[0089] Third point: The configuration center can directly observe the expansion progress and policy configuration, and can effectively observe service availability and make policy adjustments.
[0090] Fourthly, it enables multi-service capacity expansion. Simply by associating them in the configuration unit, multiple services can be expanded simultaneously. This prevents hotspots from causing a single resource shortage, which in turn affects all services.
[0091] The present invention is summarized as follows:
[0092] First: Through modular design and flexible configuration, this system greatly improves the scalability of the expansion system and simplifies the configuration of expansion strategies. It can adapt to the complex environment of multiple k8s clusters and multiple k8s replicas, and meet the overall carrying capacity of the production environment to cope with a large number of push hotspot visits as much as possible.
[0093] Second: The system associates with the k8s replicas through the scaling strategy and associates the scaling strategy level with the push hot spot level, reducing the difficulty of formulating the scaling strategy and effectively improving the scaling accuracy.
[0094] Third: A message queue is provided in the system to solve the communication problems of all servers and enable more efficient scaling synchronization information.
[0095] Fourth: The system provides an automatic scaling strategy, effectively reducing the service deployment resource investment in response to hot push and saving the service deployment resource cost.
[0096] The technical implementation solution of the present invention is described as follows:
[0097] The overall technical flow chart is as Figure 3 shown. This technical solution includes: a configuration center, a hot push distribution background, a message queue, an execution unit, and a k8s cluster, a total of 5 module units, which are executed in the numerical order of 1-10 in the figure.
[0098] Function explanation of each module unit:
[0099] Configuration center: Central configuration management, providing the function of configuring the scaling resource strategy, providing the functions of adding, modifying, deleting, and viewing the scaling resource strategy, and there is only one operation entry.
[0100] Hot push distribution background: The hot push distribution background triggers user access.
[0101] Execution unit: Trigger the cluster scaling action through calculation, and integrate the scaling strategy, push distribution level, and k8s cluster replica information to trigger the k8s cluster scaling.
[0102] Message queue: Provide the communication function during the scaling process, including information such as scaling strategy, push level, and cluster replica number.
[0103] k8s cluster: Responsible for providing the http service to users and maintaining multiple service replicas.
[0104] Flow chart explanation in steps:
[0105] When pushing the topic as a hot push, determine whether to load the scaling strategy of the hot push according to the distribution information of the hot push;
[0106] When it is determined that the scaling strategy of the hot push needs to be loaded, load the scaling strategy of the hot push and obtain the replica information of the k8s cluster where the hot push is located;
[0107] Determine the number of scaled - out replicas of the k8s cluster according to the scaling - out strategy of the hot push and the replica information of the k8s cluster where the hot push is located, and scale out the k8s cluster where the hot push is located according to the determined number of scaled - out replicas of the k8s cluster;
[0108] After the k8s cluster where the hot push is located is scaled out, issue the hot push to trigger users to access the hot push.
[0109] Such as Figure 4 As shown in step 201, the policy configuration module (the policy configuration module is located in the configuration center) provides a page for updating policies. When the topic corresponding to the hot push is created, write the update of the policy to the policy center (the policy center is the configuration center). Record how much to scale out. These scaling - out data are needed when restoring to the normal level later.
[0110] It is possible to set the policy execution period, the k8s cluster replicas associated with the policy, the push level corresponding to the policy scaling - out, and the policy scaling - out percentage (set the push level according to human judgment. When the push level cannot be set, the push level is default set to the lowest level), and provide functions such as policy query and executed policy query. Creating a new scaling - out policy is decoupled from the issuance of the hot push and the creation of the topic corresponding to the hot push. A complete scaling - out policy is described as follows:
[0112] Id: The unique Id of the policy
[0113] Name: The human - named name of the policy
[0114] Period: The policy execution period
[0115] Tagets: The k8s deployment replicas associated with the policy
[0116] Level: The push level corresponding to the policy scaling - out
[0117] Status: The policy execution status
[0118] Enable: Whether it can be executed
[0119] Createtime: The policy creation time
[0120] Updatatime: The policy modification time
[0121] Exectime: The policy execution time
[0123] It is also used to add, delete, modify, and query scaling - out policies. Specifically:
[0124] Before expansion, when the expansion percentage pushed by the hot topic does not match the current hot topic push level, modify the expansion strategy of the hot topic push according to the change of the hot topic push level to make it match the current hot topic push level.
[0125] When issuing a topic as a hot topic push, if it is determined that the expansion strategy for loading the hot topic push is required but not loaded, create the expansion strategy for the hot topic push on the policy construction page and write the expansion strategy for the hot topic push to the configuration center.
[0126] Multi-service expansion can be achieved by simply making associations in the configuration unit. Specifically:
[0127] The topic corresponding to the hot topic push includes at least one service; create corresponding expansion strategies for each of the at least one service included in the topic corresponding to the hot topic push, and associate the expansion strategies corresponding to each service as the expansion strategy for the hot topic push; when it is determined that the expansion strategy for the hot topic push needs to be loaded, load the expansion strategies of each service associated with the hot topic push.
[0128] As Figure 4 As shown in step 202, the execution unit obtains the policy configuration in the message queue, that is: take out the expansion strategy created for the topic corresponding to the hot topic push from the configuration center and write it into the message queue.
[0129] As Figure 4 As shown in step 203, before issuing a topic as a hot topic push, the push background triggers the push and writes the push information into the message queue to trigger the expansion action. A complete message description is as follows:
[0131] PushId: The unique ID of the push
[0132] PushCreatetime: The start time of the push
[0133] PushLevel: The heat level of the push hot topic
[0134] PushEnable: Whether the push triggers the expansion strategy
[0136] As Figure 4 As shown in step 204, when issuing a topic as a hot topic push, the execution unit obtains the push information from the message queue.
[0137] As Figure 4 As shown in step 205, when there is a push, according to the push information sent by the hotspot, the execution unit loads the push expansion policy from the message queue.
[0138] As Figure 4 As shown in step 206, when there is a push, the execution unit obtains the replica information in the k8s cluster.
[0139] As Figure 4 As shown in step 207, after the execution unit matches the push level sent and the expansion level of the k8s cluster, it executes the corresponding expansion policy to expand the number of replicas in the k8s cluster. Specifically, according to the expansion percentage in the expansion policy and the replica information of the k8s cluster where the hotspot push is located, the number of expanded replicas in the k8s cluster is jointly determined.
[0140] As Figure 4 As shown in step 208, the execution unit will obtain the expansion situation of the k8s cluster replicas.
[0141] As Figure 4 As shown in step 209, the execution unit writes the expansion information back to the message queue for easy display. A complete message description of the expansion information is as follows:
[0143] K8s_name: Name of the k8s service replica
[0144] K8s_num: Deployment quantity corresponding to the k8s service replica
[0145] K8s_time: Scheduling completion time
[0147] Finally, for the expansion status display, the expansion situation is read from the message queue for display.
[0148] The beneficial effects achieved by the present invention are as follows:
[0149] First: The system has an automatically configured expansion policy, which can match the expansion amount according to the level of the sent quantity, avoiding the problem that the expansion capacity is not easy to measure.
[0150] Second: The system can expand in advance and complete the expansion task during the stage when the push is not completed, effectively avoiding the system crash caused by a large number of users pouring in. Avoid the situation of "lagging expansion, where expansion will only occur after a certain time when the indicator reaches the threshold, and it is impossible to expand in time".
[0151] Third: The system has a message queue and a configuration center: the message queue can handle the communication of the entire cluster and solve the problem of information sharing between components during expansion; the configuration center can uniformly manage the configuration of expansion strategies and observe the expansion status.
[0152] Fourth, the system supports parallel scaling of multiple services based on policies, avoiding resource shortages in push hotspots and reducing the time required to scale multiple services in parallel. This avoids the issue of "being unable to scale multiple services simultaneously for a single service."
[0153] Fifth, avoid the situation where "it is difficult to observe whether the expansion is successful and it is impossible to judge the progress of the expansion."
[0154] It should be understood that the specific order or hierarchy of steps in the disclosed processes is an example of an exemplary method. Based on design preferences, it should be understood that the specific order or hierarchy of steps in the process can be rearranged without departing from the scope of the present disclosure. The accompanying method claims present elements of the various steps in an exemplary order and are not intended to be limited to the specific order or hierarchy described.
[0155] In the foregoing detailed description, various features are grouped together in a single embodiment to simplify the disclosure. This method of disclosure should not be interpreted as reflecting an intention that embodiments of the claimed subject matter require more features than are expressly recited in each claim. On the contrary, as reflected in the appended claims, the invention comprises less than all the features of any individual disclosed embodiment. The appended claims are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate preferred embodiment of the invention.
[0156] The above description of the disclosed embodiments is intended to enable any person skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other embodiments without departing from the spirit and scope of the present disclosure. Therefore, the present disclosure is not limited to the embodiments presented herein but is intended to be accorded the widest scope consistent with the principles and novel features disclosed herein.
[0157] The foregoing description includes examples of one or more embodiments. Of course, it is not possible to describe all possible combinations of components or methods for the purpose of describing the above embodiments, but those of ordinary skill in the art should recognize that the various embodiments can be further combined and arranged. Therefore, the embodiments described herein are intended to cover all such changes, modifications, and variations that fall within the scope of the appended claims. In addition, with respect to the term "comprising" used in the specification or claims, this term is inclusive in a manner similar to the term "including", as is explained when "including" is used as a transitional word in a claim. In addition, any use of the term "or" in the specification or claims is intended to mean "non-exclusive or".
[0158] Those skilled in the art can also understand that the various illustrative logical blocks, units, and steps listed in the embodiments of the present invention can be implemented by electronic hardware, computer software, or a combination of both. To clearly show the interchangeability of hardware and software, the functions of the above various illustrative components, units, and steps have been generally described. Whether such functions are implemented by hardware or software depends on the specific application and the design requirements of the entire system. Those skilled in the art can use various methods to implement the described functions for each specific application, but such implementation should not be construed as exceeding the scope of protection of the embodiments of the present invention.
[0159] The various illustrative logical blocks or units described in the embodiments of the present invention can be implemented or operated to perform the described functions by a general-purpose processor, a digital signal processor, an application specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of the above designs. The general-purpose processor can be a microprocessor, and optionally, the general-purpose processor can also be any conventional processor, controller, microcontroller, or state machine. The processor can also be implemented by a combination of computing devices, such as a digital signal processor and a microprocessor, multiple microprocessors, one or more microprocessors in conjunction with a digital signal processor core, or any other similar configuration.
[0160] In the embodiments of the present invention, the steps of the methods or algorithms described can be directly embedded in hardware, software modules executed by a processor, or a combination of the two. The software modules can be stored in a RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, register, hard disk, removable disk, CD-ROM, or any other form of storage medium in the art. Exemplarily, the storage medium can be connected to the processor so that the processor can read information from the storage medium and write information to the storage medium. Optionally, the storage medium can also be integrated into the processor. The processor and the storage medium can be provided in an ASIC, and the ASIC can be provided in a user terminal. Optionally, the processor and the storage medium can also be provided in different components of the user terminal.
[0161] In one or more exemplary designs, the above-described functions in the embodiments of the present invention can be implemented in hardware, software, firmware, or any combination of the three. If implemented in software, these functions can be stored on a computer-readable medium or transmitted on a computer-readable medium in the form of one or more instructions or codes. The computer-readable medium includes computer storage media and communication media that facilitate the transfer of a computer program from one place to another. The storage medium can be any available medium accessible by a general or special computer. For example, such a computer-readable medium can include, but is not limited to, RAM, ROM, EEPROM, CD-ROM, or other optical disk storage, magnetic disk storage, or other magnetic storage devices, or any other medium that can be used to carry or store program code in the form of instructions or data structures and other forms readable by a general or special computer, or a general or special processor. In addition, any connection can be appropriately defined as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote resource via a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless means such as infrared, wireless, and microwave, it is also included in the defined computer-readable medium. The disks (disk) and discs (disc) include compact disks, laser disks, optical discs, DVDs, floppy disks, and Blu-ray discs. Disks usually reproduce data magnetically, while discs usually reproduce data optically by laser. The above combinations can also be included in the computer-readable medium.
[0162] The specific embodiments described above further elaborate on the objectives, technical solutions, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for expanding a k8s cluster based on hotspot push, characterized in that, Including: When pushing a topic as a hot push, determine whether to load the scaling policy for the hot push according to the distribution information of the hot push. When it is determined that the scaling policy for the hot push needs to be loaded, load the scaling policy for the hot push and obtain the replica information of the k8s cluster where the hot push is located. According to the scaling policy of the hot push and the replica information of the k8s cluster where the hot push is located, determine the number of scaled-out replicas of the k8s cluster, and scale out the k8s cluster where the hot push is located according to the determined number of scaled-out replicas of the k8s cluster. After the k8s cluster where the hot push is located is scaled out, send the hot push to trigger users to access the hot push. The method for scaling out the k8s cluster based on the hot push further includes: When the topic corresponding to the hot push is created, create a scaling policy on the policy construction page and write the scaling policy into the configuration center. The scaling policy is used as the basis for scaling out the k8s cluster where the hot push is located when the topic becomes a hot push. Among them, the scaling policy includes: the k8s cluster where the hot push is located, the default hot push level and the corresponding scaling percentage, and the policy execution period.
2. The method for scaling out the k8s cluster based on the hot push according to claim 1, wherein The step of determining the number of scaled-out replicas of the k8s cluster according to the scaling policy of the hot push and the replica information of the k8s cluster where the hot push is located specifically includes: Jointly determine the number of scaled-out replicas of the k8s cluster according to the scaling percentage in the scaling policy and the replica information of the k8s cluster where the hot push is located. The method for scaling out the k8s cluster based on the hot push further includes: Before scaling out, when the scaling percentage of the hot push does not match the current hot push level, modify the scaling policy of the hot push according to the change of the hot push level to make it match the current hot push level.
3. The method for expanding a k8s cluster based on hotspot push according to claim 1, wherein It also includes: When pushing a topic as a hot push, if it is determined that the scaling policy for the hot push needs to be loaded but the scaling policy for the hot push is not loaded, create the scaling policy for the hot push on the policy construction page and write the scaling policy for the hot push into the configuration center.
4. The method for expanding a k8s cluster based on hotspot push according to claim 1, wherein The topic corresponding to the hot push includes at least one service. The step of creating a scaling policy on the policy construction page and writing the scaling policy into the configuration center specifically includes: Create corresponding scaling policies for at least one service included in the topic corresponding to the hot push respectively, and associate the corresponding scaling policies of each service as the scaling policy for the hot push. The step of loading the scaling policy for the hot push when it is determined that the scaling policy for the hot push needs to be loaded specifically includes: When it is determined that the scaling strategy for the hot push needs to be loaded, load the scaling strategies of each service associated with the hot push.
5. The method for expanding a k8s cluster based on hotspot push according to claim 1, characterized in that, It further includes: Take out the scaling strategy created for the topic corresponding to the hot push from the configuration center and write it into the message queue; Before sending the topic as a hot push, write the sending information of the hot push into the message queue; When sending the topic as a hot push, obtain the sending information of the hot push from the message queue; Obtain the scaling strategy of the hot push that needs to be loaded from the message queue according to the sending information of the hot push; The method for scaling the k8s cluster based on the hot push further includes: After scaling the k8s cluster where the hot push is located, obtain the replica scaling information of the k8s cluster, and the replica scaling information of the k8s cluster includes the number of scaled replicas of the k8s cluster; Write the obtained replica scaling information of the k8s cluster into the message queue; Read the replica scaling information of the k8s cluster in the message queue for display.
6. A system for expanding a k8s cluster by hot push, characterized in that, It includes: The scaling judgment unit is used to determine whether to load the scaling strategy of the hot push according to the sending information of the hot push when sending the topic as a hot push; When it is determined that the scaling strategy of the hot push needs to be loaded, load the scaling strategy of the hot push and obtain the replica information of the k8s cluster where the hot push is located; The scaling execution unit is used to determine the number of scaled replicas of the k8s cluster according to the scaling strategy of the hot push and the replica information of the k8s cluster where the hot push is located, and scale the k8s cluster where the hot push is located according to the determined number of scaled replicas of the k8s cluster; The hot push sending unit is used to send the hot push after scaling the k8s cluster where the hot push is located to trigger users to access the hot push; The hot push scaling k8s cluster system further includes: The scaling strategy generation unit is used to create a scaling strategy on the strategy construction page and write the scaling strategy into the configuration center when the topic corresponding to the hot push is established. The scaling strategy is used as the basis for scaling the k8s cluster where the hot push is located when the topic becomes a hot push; among them, the scaling strategy includes.
7. The hot push-expanded k8s cluster system according to claim 6, characterized in that, The scaling execution unit includes; The scaling calculation sub-unit is used to jointly determine the number of scaled replicas of the k8s cluster according to the scaling percentage in the scaling strategy and the replica information of the k8s cluster where the hot push is located; The scaling strategy generation unit includes: The scaling strategy update sub-unit is used to modify the scaling strategy of the hot push according to the change of the hot push level before scaling when the scaling percentage of the hot push does not match the current hot push level, and modify it into a scaling strategy that matches the current hot push level.
8. The system for expanding a k8s cluster by hot push according to claim 6, characterized in that, The scaling strategy generation unit includes: The scaling strategy adding subunit is used to create the scaling strategy for the hot push of the topic in the strategy construction page and write the scaling strategy for the hot push into the configuration center when it is determined that the scaling strategy for the hot push needs to be loaded but the scaling strategy for the hot push is not loaded when the topic is pushed as a hot topic for distribution.
9. The system for expanding a k8s cluster by hot push according to claim 6, wherein The hot push includes at least one service; The scaling strategy generating unit includes a service scaling strategy construction subunit, where: The service scaling strategy construction subunit is used to create corresponding scaling strategies for at least one service included in the topic corresponding to the hot push respectively, and associate the corresponding scaling strategies of each service as the scaling strategy for the hot push; The scaling execution unit is further used to load the scaling strategies of each service associated with the hot push when it is determined that the scaling strategy for the hot push needs to be loaded.
10. The system for expanding a k8s cluster by hot push according to claim 6, characterized in that, It further includes a scaling information acquisition unit, a communication unit and a display unit, where: The scaling information acquisition unit is specifically used for: After the k8s cluster where the hot push is located is scaled, obtaining the replica scaling information of the k8s cluster, and the replica scaling information of the k8s cluster includes the number of scaled replicas of the k8s cluster; The communication unit is specifically used for: Taking out the created scaling strategy for the topic corresponding to the hot push from the configuration center and writing it into the message queue; Before pushing the topic as a hot push for distribution, writing the distribution information of the hot push into the message queue; When pushing the topic as a hot push for distribution, obtaining the distribution information of the hot push from the message queue; Obtaining the scaling strategy for the hot push that needs to be loaded from the message queue according to the distribution information of the hot push; Writing the replica scaling information of the k8s cluster obtained by the scaling information acquisition unit into the message queue; The display unit is specifically used for: Reading and displaying the replica scaling information of the k8s cluster in the message queue.
Citation Information
Patent Citations
Capacity expansion method and device for service system
CN107911447A
Service-aware distributed video cluster high-efficiency scaling method and service-aware distributed video cluster high-efficiency scaling system
CN112543354A