Application copy processing method, device and server

By comparing and updating the variable values ​​in the resource files of the target application, it is decided whether to restart the Kubernetes replica, and the number of replicas is increased or reduced as needed. This solves the problem in the existing technology that frequent replica restarts affect service efficiency, and improves service quality and efficiency. .

CN113971054BActive Publication Date: 2024-09-24BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111270731.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2024-09-24
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

When an application deployed in Kubernetes is updated, the existing technology requires restarting all replicas, which results in an unreasonable method of restarting all replicas for relatively simple updates (such as increasing or decreasing the number of replicas), affecting the efficiency of the service in processing external requests.

Method used

By receiving and comparing the specified variable values ​​in the resource file of the target application, it decides whether to restart the application copy, and increases or decreases the number of copies according to the update parameters to avoid restarting all copies for each update.

Benefits of technology

It improves the service quality and efficiency of processing external requests, avoids unnecessary restart operations, and flexibly controls the update method of replicas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113971054B
    Figure CN113971054B
Patent Text Reader

Abstract

The present invention provides a method, device and electronic device for processing application copies, which receive a first resource file corresponding to a target application, obtain the value of a specified variable in the first resource file; the value of the specified variable is a string; obtain the value of a specified variable in a second resource file corresponding to the target application, determine the comparison result of the value of the specified variable in the second resource file and the value of the specified variable in the first resource file; if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the application copy of the target application is not restarted. In this way, when the target application updates the configuration, it can determine whether to restart the copy of the target application based on the value of the specified variable in the first resource file and the value of the specified variable in the second resource file, thereby avoiding the situation where all copies are restarted every time the application updates the configuration, and improving the service quality and service efficiency of processing external requests.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of container clusters, and in particular to a method, device and server for processing application copies. Background Art

[0002] Applications deployed in kubernetes are generally in the form of multiple copies. When an application is updated, it is necessary to restart the multiple copies corresponding to the application to update each copy of the application. In the related art, the value of the target variable in the resource file of kubernetes is usually updated using the kubernetes package manager. Each time the application is updated, the value of the target variable is controlled to increase by one, so that Kubernetes can restart all the copies corresponding to the application according to the updated value of the target variable. In this way, each application update will restart all the copies. However, in actual application scenarios, for simpler updates, such as increasing or decreasing the copies corresponding to the application, it is not reasonable to restart all the copies corresponding to the application at this time. If all the copies are restarted frequently, it may affect the service processing of external requests and reduce service efficiency. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide a method, device and server for processing application copies, which can control whether the copy of the target application is restarted when the target application updates its configuration, so as to improve the service quality and service efficiency of processing external requests.

[0004] In a first aspect, an embodiment of the present invention provides a method for processing an application copy, which is applied to a container cluster; an application copy of a target application is running in the container cluster; the method comprises: receiving a first resource file corresponding to the target application, obtaining the value of a specified variable in the first resource file; the value of the specified variable is a string; obtaining the value of a specified variable in a second resource file corresponding to the target application, determining a comparison result between the value of the specified variable in the second resource file and the value of the specified variable in the first resource file; if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the application copy of the target application is not restarted.

[0005] Furthermore, the above method also includes: if the comparison result indicates that the value of the specified variable in the second resource file is different from the value of the specified variable in the first resource file, restarting the application copy of the target application.

[0006] Furthermore, if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the step of not restarting the application copy of the target application also includes: if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, and the number of copies in the first resource file is different from the number of copies in the second resource file, increasing or decreasing the number of application copies according to the number of copies in the first resource file.

[0007] Furthermore, the first resource file is obtained by updating the server based on the update parameters of the target application when the target application updates its configuration; wherein the update parameters are used to indicate whether to restart the application copy of the target application.

[0008] In a second aspect, an embodiment of the present invention provides a method for processing an application copy, which is applied to a server; the server is connected to a container cluster; an application copy of a target application is running in the container cluster; the method comprises: when the target application updates its configuration, obtaining update parameters for the target application; wherein the update parameters are used to indicate whether to restart the application copy of the target application; based on the update parameters, updating a first resource file corresponding to the target application; and sending the updated first resource file to the container cluster so that the application copy of the target application is processed by the container cluster based on the updated first resource file.

[0009] Further, processing the application copy of the target application includes: restarting the application copy of the target application, or not restarting the application copy of the target application.

[0010] Furthermore, not restarting the application copy of the target application also includes: increasing or decreasing the number of the application copies of the target application.

[0011] Furthermore, based on the update parameters, the step of updating the first resource file of the target application includes: obtaining a target string corresponding to the update parameters; and updating the value of a specified variable in the first resource file to the target string.

[0012] Furthermore, the step of obtaining a target string corresponding to the update parameter includes: if the update parameter indicates restarting the application copy, generating a target string of specified bits according to a preset algorithm; if the update parameter indicates not to restart the application copy, extracting the target string generated when the application copy was last restarted from the target database.

[0013] Furthermore, after the step of updating the first resource file corresponding to the target application based on the update parameters, the method further includes: saving the application identifier of the current version of the target application and the value of the specified variable in the updated first resource file into the target database.

[0014] In a third aspect, an embodiment of the present invention provides a device for processing an application copy, wherein the device is arranged in a container cluster; an application copy of a target application is running in the container cluster; the device comprises: a first acquisition module, for receiving a first resource file corresponding to the target application, and obtaining the value of a specified variable in the first resource file; the value of the specified variable is a string; a determination module, for obtaining the value of a specified variable in a second resource file corresponding to the target application, and determining a comparison result between the value of the specified variable in the second resource file and the value of the specified variable in the first resource file; and a first processing module, for not restarting the application copy of the target application if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file.

[0015] In a fourth aspect, an embodiment of the present invention provides a device for processing an application copy, wherein the device is arranged on a server; the server is connected to a container cluster; an application copy of a target application is running in the container cluster; the device comprises: a second acquisition module, for acquiring update parameters for the target application when the target application updates its configuration; wherein the update parameters are used to indicate whether to restart the application copy of the target application; an update module, for updating a first resource file corresponding to the target application based on the update parameters; and a second processing module, for sending the updated first resource file to the container cluster, so that the application copy of the target application is processed based on the updated first resource file through the container cluster.

[0016] In a fifth aspect, an embodiment of the present invention provides a server, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the processing method of the application copy of any one of the first aspects.

[0017] In a sixth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the processing method of the application copy of any one of the first aspects.

[0018] The embodiments of the present invention bring the following beneficial effects:

[0019] The present invention provides a method, device and electronic device for processing application copies, which receive a first resource file corresponding to a target application, obtain the value of a specified variable in the first resource file; the value of the specified variable is a string; obtain the value of a specified variable in a second resource file corresponding to the target application, determine the comparison result of the value of the specified variable in the second resource file and the value of the specified variable in the first resource file; if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the application copy of the target application is not restarted. In this way, when the target application updates the configuration, it can determine whether to restart the copy of the target application based on the value of the specified variable in the first resource file and the value of the specified variable in the second resource file, thereby avoiding the situation where all copies are restarted every time the application updates the configuration, and improving the service quality and service efficiency of processing external requests.

[0020] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0021] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1 A flowchart of a method for processing an application copy provided by an embodiment of the present invention;

[0024] Figure 2 A flowchart of another method for processing application copies provided by an embodiment of the present invention;

[0025] Figure 3 A flowchart of another method for processing application copies provided by an embodiment of the present invention;

[0026] Figure 4 A schematic diagram of the structure of a device for processing application copies provided by an embodiment of the present invention;

[0027] Figure 5 A schematic diagram of the structure of another device for processing application copies provided by an embodiment of the present invention;

[0028] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0030] As the number of microservices increases, it becomes increasingly difficult to implement requirements such as configuration, management, expansion, and high availability. For example, how the operation and maintenance team can better utilize hardware resources and reduce server costs, automate deployment, and handle faults has become increasingly difficult. Kubernetes can solve these problems better. Service applications deployed in Kubernetes generally exist in multiple copies. When the application changes or the number of copies needs to be scaled, the application needs to be reconfigured. However, for Kubernetes, if the resource file has not changed, the service will not be restarted.

[0031] In the related technology, the package manager of kubernetes is used to update the value of the target variable in the resource file of kubernetes. Specifically, a target variable rollingVersion is added to the resource file spec.template.metadata.lables of deployment (used to deploy stateless services in kubernetes) and statefulset (used to deploy stateful services in kubernetes), which will be updated every time the application updates the configuration. The value of the target variable is {{.Release.Revision}}. The variable value of Release.Revision is controlled by helm (representing the package manager of Kubernetes). The value of this target variable will increase by 1 every time the application updates the configuration. In this way, every time the application updates the configuration, Kubernetes will restart all the replicas corresponding to the changed application. However, in actual application scenarios, for simpler updates, such as increasing or decreasing the replicas corresponding to the application, it is not reasonable to restart all the replicas corresponding to the application at this time. If all the replicas are restarted frequently, it may affect the service's processing of external requests and reduce service efficiency.

[0032] Based on this, an embodiment of the present invention provides a method, device and electronic device for processing application replicas. The technology can be applied to a server and a container cluster deployed with application replicas.

[0033] To facilitate understanding of this embodiment, a method for processing an application copy disclosed in an embodiment of the present invention is first described in detail. The method is applied to a server, and the server is connected to a container cluster; an application copy of a target application is running in the container cluster; the container cluster is generally kubernetes. Figure 1 As shown, the method comprises the following steps:

[0034] Step S102, when the target application updates its configuration, obtaining update parameters for the target application; wherein the update parameters are used to indicate whether to restart the application copy of the target application;

[0035] The target application mentioned above usually refers to a service application deployed in a container cluster. Specifically, the target variable can be controlled by deploying the service of the target application (i.e., a third-party program). The target variable can be expressed as isUpgrade, and the value of the target variable is the above-mentioned update parameter. In general, if the target application needs to restart the copy of the target application when updating the configuration, the update parameter of the target variable can be set to true on the front end. If the target application does not need to restart the copy of the target application when updating the configuration, the update parameter of the target variable can be set to false on the front end.

[0036] Specifically, the user can set the target application update configuration information on the front end, and set the update parameters of the target application according to the interface of the business scenario, and then upload the update parameters by deploying the target application service. When the target application updates the configuration, the server can obtain the update parameters for the target application by calling the target application update configuration interface.

[0037] Step S104, updating the first resource file corresponding to the target application based on the update parameter;

[0038] The above-mentioned first resource file is pre-set in the server. The first resource file is an application resource file of the container cluster, which includes multiple variables, and the values ​​of the variables can be used to indicate the processing of the copy of the target application. Specifically, different data can be selected to update the first resource file corresponding to the target application according to the value of the update parameter. When the update parameter indicates to restart the application copy of the target application, the variable value in the first resource file corresponding to the target application can be updated according to the first method corresponding to the update parameter; when the update parameter indicates not to restart the application copy of the target application, the variable value in the first resource file corresponding to the target application can be updated according to the second method corresponding to the update parameter.

[0039] Step S106: Send the updated first resource file to the container cluster, so that the container cluster processes the application copy of the target application based on the updated first resource file.

[0040] The above container cluster usually also includes the resource file of the target application, which is used to manage the copy of the target application. The copy of the target application is deployed in the container cluster, and the processing of the copy needs to be processed by the container cluster, and any processing of the copy by the container cluster needs to be processed according to the resource file of the target application. Therefore, in this embodiment, after the first resource file of the target application is updated in the server, it is sent to the container cluster, so that the container cluster can process the application copy of the target application according to the updated variable value in the first resource file.

[0041] Specifically, if the updated first resource file indicates that the copy is restarted, the application copy of the target application is restarted; if the updated first resource file indicates that the copy is not restarted, the application copy of the target application is not restarted. Of course, if the updated first resource file also includes information, the container cluster will also perform other processing on the copy of the target file according to the updated first resource file, such as increasing or decreasing the number of copies.

[0042] An embodiment of the present invention provides a method for processing an application copy. When a target application updates its configuration, an update parameter for the target application is obtained; the update parameter is used to indicate whether to restart the application copy of the target application; based on the update parameter, the first resource file corresponding to the target application is updated; the updated first resource file is sent to a container cluster, so that the application copy of the target application is processed by the container cluster based on the updated first resource file. In this method, when the target application updates its configuration, the update parameter can be set according to the actual requirements of the updated configuration to control whether the copy of the target application is restarted, thereby avoiding the situation where all copies are restarted every time the application program updates its configuration, thereby improving the service quality and service efficiency of processing external requests.

[0043] The embodiment of the present invention provides another method for processing an application copy. This embodiment mainly describes the specific implementation process of the step of updating the first resource file of the target application based on the update parameter (implemented by steps 2-3), and the specific implementation process of the step after the step of updating the first resource file corresponding to the target application based on the update parameter (implemented by step 4), which specifically includes:

[0044] Step 1, when the target application updates its configuration, obtaining update parameters for the target application; wherein the update parameters are used to indicate whether to restart the application copy of the target application;

[0045] Step 2, obtain the target string corresponding to the update parameter;

[0046] Specifically, different target strings can be obtained according to the value of the update parameter. For example, when the value of the update parameter is true, a new target string is generated; when the value of the update parameter is false, a previously generated target string is directly read. The above target string can be a string with a specified number of digits, and the characters of each digit will not be repeated.

[0047] A possible implementation:

[0048] (1) if the update parameter indicates restarting the application copy, generating a target string of a specified number of digits according to a preset algorithm;

[0049] The above-specified number of bits can be 32 bits or 34 bits, etc., and can be set according to actual needs. In actual implementation, if the update parameter isUpgrade is true, a 32-bit random non-repeating string can be generated according to a preset algorithm.

[0050] (2) If the update parameter indicates not to restart the application copy, extract the target string generated when the application copy was last restarted from the target database.

[0051] Usually, the string generated each time the replica is restarted is saved in the target database, which is connected to the server. Therefore, in order to prevent the replica from restarting, the target string generated when the replica of the target application was last restarted can be extracted from the target database, or the target string when the target application last updated its configuration can be extracted from the target database.

[0052] Step 3, updating the value of the specified variable in the first resource file to the target string;

[0053] The specified variable is the variable rollingVersion under spec.template.metadata.lables of the first resource file of the target application of the container cluster kubernetes, and the value of the specified variable is updated. Specifically, the value of the specified variable rollingVersion under spec.template.metadata.lables of the first resource file is updated to the target string.

[0054] Step 4, saving the application identifier of the current version of the target application and the value of the specified variable in the updated first resource file into the target database;

[0055] In order to save the information involved in each target application configuration update process, so as to facilitate the search for historical update data, the application identifier of the current version of the target application and the value of the specified variable in the updated first resource file can be saved in the target database. For example, the application identifier can be V0, V1, V2, etc. V0 can represent the initial version of the target application, V1 represents the first version of the target application after one update configuration, and V2 represents the second version of the target application after two updates configuration.

[0056] Step 5: Send the updated first resource file to the container cluster, so that the container cluster processes the application copy of the target application based on the updated first resource file.

[0057] At this time, the resource file of the target application in the container cluster is still the resource file corresponding to the target application when the configuration is not updated. Therefore, the updated first resource file can be used to obtain the difference information between the resource file corresponding to the current target application when the configuration is not updated, and finally the application copy of the target application is processed according to the difference information. Specifically, in this embodiment, the difference between the value of the specified variable in the updated first resource file and the value of the specified variable in the resource file corresponding to the current target application in the container cluster indicates whether the copy of the target application is restarted.

[0058] The above-mentioned processing of the application copy of the target application includes: restarting the application copy of the target application, or not restarting the application copy of the target application. Specifically, it can be determined according to the value of the variable specified in the first resource file; in actual implementation, the value of the variable specified in the first resource file can be compared with the value of the variable specified in the second resource file corresponding to the target application in the container cluster through the container cluster, and according to the comparison result, it is determined whether to restart the application copy of the target application or not.

[0059] Wherein, not restarting the application copy of the target application also includes increasing or decreasing the number of application copies of the target application. Specifically, if the comparison result indicates restarting or not restarting the application copy of the target application, the number of copies in the first resource file can be obtained through the container cluster, and if it is different from the number of copies in the second resource file, the number of application copies can be increased or decreased so that the number of copies after increase or decrease is the same as the number of copies in the first resource file.

[0060] In the above method, when the target application is updated and configured, different update parameters can be set according to the actual business scenario to control whether all copies corresponding to the service in kubernetes are restarted. Compared with the method in which the value of the specified variable is controlled by the Kubernetes package manager helm, and all copies are restarted each time the configuration is updated, the embodiment of the present invention can control whether all copies need to be restarted according to the actual situation, avoiding the situation in which all copies are restarted every time the application program updates the configuration, thereby improving the service quality and service efficiency of processing external requests. In addition, in the related art, {{.Release.Revision}} is generated by helm, and cannot be used if helm deployment is not used. The present invention changes the variable {{.Release.Revision}} controlled by helm to a variable controlled by the service of the deployed application, and the control method is more flexible.

[0061] An embodiment of the present invention provides another method for processing an application copy, which is applied to a container cluster; an application copy of a target application is running in the container cluster; Figure 2 As shown, the method comprises the following steps:

[0062] Step S202, receiving a first resource file corresponding to the target application, and obtaining a value of a specified variable in the first resource file; the value of the specified variable is a string;

[0063] The first resource file corresponding to the above-mentioned target application is the updated first resource file. After the server updates the first resource file, it sends the updated first resource file to the container cluster. After the container cluster receives the first resource file corresponding to the target application, it first obtains the value of the specified variable rollingVersion in the first resource file, that is, the aforementioned target string.

[0064] Step S204, obtaining the value of the specified variable in the second resource file corresponding to the target application, and determining a comparison result between the value of the specified variable in the second resource file and the value of the specified variable in the first resource file;

[0065] The second resource file is a resource file of the target application in the container cluster. The second resource file also includes a specified variable, namely, the specified variable rollingVersion of spec.template.metadata.lables in the second resource file. In this step, the value of the specified variable in the second resource file is the target string generated when the target application last updated its configuration.

[0066] Specifically, the value of the specified variable in the second resource file can be compared with the value of the specified variable in the first resource file. The comparison result usually includes that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, and the value of the specified variable in the second resource file is different from the value of the specified variable in the first resource file.

[0067] Step S206: If the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the application copy of the target application is not restarted.

[0068] If the value of the variable specified in the second resource file is the same as the value of the variable specified in the first resource file, it means that the value of the variable specified in the first resource file is not a newly generated string. Further, if the update parameter indicates that the copy of the target application does not need to be restarted, the application copy of the target application will not be restarted. Specifically, if the value of the variable specified in the second resource file is the same as the value of the variable specified in the first resource file, it means that the container cluster does not need to restart the application copy of the target application. At this time, the container cluster will not restart all copies of the target application.

[0069] The above-mentioned method for processing an application copy receives a first resource file corresponding to a target application, obtains the value of a specified variable in the first resource file; the value of the specified variable is a string; obtains the value of a specified variable in a second resource file corresponding to the target application, determines the value of the specified variable in the second resource file, and compares it with the value of the specified variable in the first resource file; if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the application copy of the target application is not restarted. In this method, when the target application updates its configuration, it can determine whether to restart the copy of the target application based on the value of the specified variable in the first resource file and the value of the specified variable in the second resource file, thereby avoiding the situation where all copies are restarted every time the application updates its configuration, and improving the service quality and efficiency of processing external requests.

[0070] The embodiment of the present invention further provides another method for processing an application copy. This embodiment mainly describes the specific implementation process of the step of restarting the application copy according to the comparison result (implemented by steps 303-304), which specifically includes:

[0071] Step 301, receiving a first resource file corresponding to a target application, and obtaining a value of a specified variable in the first resource file; the value of the specified variable is a string;

[0072] The above-mentioned first resource file is obtained by updating the update parameters of the target application through the server when the target application updates the configuration; wherein the update parameters are used to indicate whether to restart the application copy of the target application. Specifically, when the target application updates the configuration, the update parameters for the target application are obtained; the target string corresponding to the update parameters is obtained, wherein if the update parameters indicate restarting the application copy, a target string of a specified number of digits is generated according to a preset algorithm, and if the update parameters indicate not to restart the application copy, the target string generated when the application copy was last restarted is extracted from the target database. The value of the specified variable in the first resource file is updated to the target string to obtain the updated first resource file.

[0073] Step 302, obtaining the value of a specified variable in a second resource file corresponding to the target application, and determining a comparison result between the value of the specified variable in the second resource file and the value of the specified variable in the first resource file;

[0074] Step 303: if the comparison result indicates that the value of the specified variable in the second resource file is different from the value of the specified variable in the first resource file, restart the application copy of the target application;

[0075] If the value of the variable specified in the second resource file is different from the value of the variable specified in the first resource file, it means that the value of the variable specified in the first resource file is a newly generated string, and further indicates that the update parameter indicates that the copy of the target application needs to be restarted, so the application copy of the target application is restarted. Specifically, if the value of the variable specified in the second resource file is different from the value of the variable specified in the first resource file, it means that the container cluster needs to restart the application copy of the target application, which can be specifically restarting all copies of the target application according to the updated configuration information in the first resource file.

[0076] Step 304: If the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the application copy of the target application is not restarted;

[0077] Specifically, if the value of the variable specified in the second resource file is the same as the value of the variable specified in the first resource file, it means that the container cluster does not need to restart the application copy of the target application, and the container cluster will not restart all copies of the target application.

[0078] In addition, the above step 304 also includes another possible implementation:

[0079] If the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, and the number of copies in the first resource file is different from the number of copies in the second resource file, increase or decrease the number of application copies according to the number of copies in the first resource file.

[0080] Specifically, if the value of the variable specified in the second resource file is the same as the value of the variable specified in the first resource file, it is also necessary to determine whether the value of the variable indicating the number of copies in the first resource file is the same as the number of all copies of the current target application, or the same as the value of the variable indicating the number of copies in the second resource file. If they are the same, then no operation is performed. If they are different, then according to the indicated number of copies, the number of copies of the target application is increased or decreased so that the final number of copies is the same as the number of copies in the first resource file.

[0081] In the above method, when the target application updates the configuration, the update parameters can be set according to the actual needs of the updated configuration, so as to control whether the copy of the target application is restarted through the value of the variable specified in the first resource file and the value of the variable specified in the second resource file. In addition, the number of copies can be increased or decreased according to the number of copies in the first resource file, thereby avoiding the situation where all copies are restarted every time the application updates the configuration, thereby improving the service quality and service efficiency of processing external requests.

[0082] See also Figure 3 The flowchart of a method for processing an application copy is shown. First, when the application is updated (i.e., when the target application is updated, the configuration is updated), whether to restart the service (corresponding to the copy of the target application) is determined according to the update parameters. If a restart is required, a string of 32 random strings is generated, and then the value corresponding to the parameter rollingVersion in the resource file is replaced with the generated string (corresponding to the aforementioned updating of the value of the specified variable in the first resource file to the target string). After reviewing each line of the string, the string needs to be saved in the database. If a restart is not required, the value of the last update is read (corresponding to the aforementioned extraction of the target string generated when the copy of the target application was last restarted from the target database), wherein the value of the last update is the string saved in the database when the application was last updated, and then the value corresponding to the parameter rollingVersion in the resource file is replaced with the read value. Finally, the first resource file is passed to Kubernetes (corresponding to the aforementioned container cluster).

[0083] Corresponding to the above method embodiment, the embodiment of the present invention further provides a processing device for an application copy, the device is arranged on a server; the server is connected to a container cluster; an application copy of a target application is running in the container cluster; Figure 4 As shown, the device comprises:

[0084] The second acquisition module 41 is used to acquire update parameters for the target application when the target application updates its configuration; wherein the update parameters are used to indicate whether to restart the application copy of the target application;

[0085] An updating module 42, configured to update a first resource file corresponding to a target application based on an update parameter;

[0086] The second processing module 43 is configured to send the updated first resource file to the container cluster, so that the container cluster processes the application copy of the target application based on the updated first resource file.

[0087] The present invention provides a method for processing application copies. When a target application updates its configuration, update parameters for the target application are obtained; the update parameters are used to indicate whether to restart the application copy of the target application; based on the update parameters, a first resource file corresponding to the target application is updated; the updated first resource file is sent to a container cluster, so that the application copy of the target application is processed by the container cluster based on the updated first resource file. In this method, when the target application updates its configuration, the update parameters can be set according to the actual requirements for updating the configuration to control whether the copy of the target application is restarted, thereby avoiding the situation where all copies are restarted every time the application program updates its configuration, and improving the service quality and service efficiency of processing external requests.

[0088] Furthermore, the processing of the application copy of the target application includes: restarting the application copy of the target application, or not restarting the application copy of the target application.

[0089] Furthermore, the above-mentioned not restarting the application copy of the target application also includes: increasing or decreasing the number of the application copies of the target application.

[0090] Furthermore, the above-mentioned update module is also used to: obtain a target string corresponding to the update parameter; and update the value of the specified variable in the first resource file to the target string.

[0091] Furthermore, the update module is also used to: if the update parameters indicate restarting the application copy, generate a target string of specified bits according to a preset algorithm; if the update parameters indicate not restarting the application copy, extract the target string generated when the application copy was last restarted from the target database.

[0092] Furthermore, the above-mentioned device also includes a saving module, which is used to save the application identifier of the current version of the target application and the value of the specified variable in the updated first resource file into the target database.

[0093] Corresponding to the above method embodiment, the embodiment of the present invention further provides a processing device for an application copy, the device is arranged in a container cluster; an application copy of a target application is running in the container cluster; Figure 5 As shown, the device comprises:

[0094] The first acquisition module 51 is used to receive a first resource file corresponding to the target application, and obtain the value of a specified variable in the first resource file; the value of the specified variable is a string;

[0095] A determination module 52, configured to obtain a value of a specified variable in a second resource file corresponding to the target application, and determine a comparison result between the value of the specified variable in the second resource file and the value of the specified variable in the first resource file;

[0096] The first processing module 53 is configured to not restart the application copy of the target application if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file.

[0097] An embodiment of the present invention provides a processing device for an application copy, which receives a first resource file corresponding to a target application, obtains the value of a specified variable in the first resource file; the value of the specified variable is a string; obtains the value of a specified variable in a second resource file corresponding to the target application, determines the comparison result of the value of the specified variable in the second resource file and the value of the specified variable in the first resource file; if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the application copy of the target application is not restarted. In this way, when the target application updates its configuration, it can determine whether to restart the copy of the target application based on the value of the specified variable in the first resource file and the value of the specified variable in the second resource file, thereby avoiding the situation where all copies are restarted every time the application updates its configuration, and improving the service quality and service efficiency of processing external requests.

[0098] Furthermore, the above-mentioned device also includes a third processing module for: if the comparison result indicates that the value of the specified variable in the second resource file is different from the value of the specified variable in the first resource file, restarting the application copy of the target application.

[0099] Furthermore, the above-mentioned second processing module is also used to: if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, and the number of copies in the first resource file is different from the number of copies in the second resource file, increase or decrease the number of application copies according to the number of copies in the first resource file.

[0100] Furthermore, the first resource file is obtained by updating the server based on the update parameters of the target application when the target application updates its configuration; wherein the update parameters are used to indicate whether to restart the application copy of the target application.

[0101] The device for processing application copies provided in the above-mentioned embodiment of the invention has the same technical features as the method for processing application copies provided in the above-mentioned embodiment, and therefore can solve the same technical problems and achieve the same technical effects.

[0102] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method for processing application copies.

[0103] See also Figure 6 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above-mentioned method for processing application copies.

[0104] Further, Figure 6 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0105] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0106] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.

[0107] An embodiment of the present invention further provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned method for processing application copies.

[0108] The application copy processing method, device and computer program product of the electronic device provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.

[0109] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0110] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0111] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0112] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0113] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for processing an application copy, characterized in that: The method is applied to a container cluster; An application copy of a target application is running in the container cluster; the method comprises: Receive a first resource file corresponding to the target application, and obtain a value of a specified variable in the first resource file; the value of the specified variable is a string; wherein the first resource file is an updated first resource file, and after the server updates the first resource file, the updated first resource file is sent to the container cluster; Obtain the value of a specified variable in a second resource file corresponding to the target application, and determine a comparison result between the value of the specified variable in the second resource file and the value of the specified variable in the first resource file; wherein the second resource file is a resource file of the target application in the container cluster, and the value of the specified variable in the second resource file is a target string generated when the target application last updated its configuration; If the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, no restart processing is performed on the application copy of the target application.

2. The method according to claim 1, characterized in that The method further comprises: If the comparison result indicates that the value of the specified variable in the second resource file is different from the value of the specified variable in the first resource file, restart processing is performed on the application copy of the target application.

3. The method according to claim 1, characterized in that If the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, the step of not restarting the application copy of the target application further includes: If the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file, and the number of copies in the first resource file is different from the number of copies in the second resource file, increase or decrease the number of application copies according to the number of copies in the first resource file.

4. The method according to claim 1, characterized in that: The first resource file is obtained by updating the server based on the update parameters of the target application when the target application updates its configuration; wherein the update parameters are used to indicate whether to restart the application copy of the target application.

5. A method for processing application copies, characterized in that: The method is applied to a server; the server is connected to a container cluster; An application copy of a target application is running in the container cluster; the method comprises: When the target application updates its configuration, obtaining update parameters for the target application; wherein the update parameters are used to indicate whether to restart the application copy of the target application; Based on the update parameter, update the first resource file corresponding to the target application; wherein the first resource file is pre-set in the server; The updated first resource file is sent to a container cluster, so that the container cluster processes the application copy of the target application based on the updated first resource file.

6. The method according to claim 5, characterized in that The processing of the application copy of the target application includes: restarting the application copy of the target application, or not restarting the application copy of the target application.

7. The method according to claim 6, characterized in that Not restarting the application copy of the target application also includes: increasing or decreasing the number of the application copies of the target application.

8. The method according to claim 5, characterized in that The step of updating the first resource file of the target application based on the update parameter includes: Obtaining a target character string corresponding to the update parameter; Update the value of the specified variable in the first resource file to the target string.

9. The method according to claim 8, characterized in that The step of obtaining a target character string corresponding to the update parameter comprises: If the update parameter indicates restarting the application copy, generating a target character string of a specified number of digits according to a preset algorithm; If the update parameter indicates not to restart the application copy, the target character string generated when the application copy was last restarted is extracted from the target database.

10. The method according to claim 5, characterized in that After the step of updating the first resource file corresponding to the target application based on the update parameter, the method further includes: The application identifier of the target application of the current version and the value of the specified variable in the updated first resource file are saved in the target database.

11. A device for processing application copies, characterized in that: The device is arranged in a container cluster; An application copy of the target application is running in the container cluster; The device comprises: A first acquisition module is used to receive a first resource file corresponding to a target application, and obtain a value of a specified variable in the first resource file; the value of the specified variable is a string; wherein the first resource file is an updated first resource file, and after the server updates the first resource file, the updated first resource file is sent to the container cluster; A determination module, used to obtain the value of a specified variable in a second resource file corresponding to the target application, and determine a comparison result between the value of the specified variable in the second resource file and the value of the specified variable in the first resource file; wherein the second resource file is a resource file of the target application in the container cluster, and the value of the specified variable in the second resource file is a target string generated when the target application last updated its configuration; The first processing module is configured to not restart the application copy of the target application if the comparison result indicates that the value of the specified variable in the second resource file is the same as the value of the specified variable in the first resource file.

12. A device for processing application copies, characterized in that: The device is arranged on a server; the server is connected to a container cluster; An application copy of a target application is running in the container cluster; the device comprises: A second acquisition module, configured to acquire update parameters for the target application when the target application updates its configuration; wherein the update parameters are used to indicate whether to restart the application copy of the target application; An updating module, configured to update a first resource file corresponding to the target application based on the updating parameter; wherein the first resource file is pre-set in the server; The second processing module is configured to send the updated first resource file to a container cluster, so that the container cluster processes the application copy of the target application based on the updated first resource file.

13. A server, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for processing application copies as described in any one of claims 1-10.

14. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for processing an application copy according to any one of claims 1-10.