Instance arrangement method and device, electronic equipment and storage medium
By obtaining the resource utilization time distribution data and attribute information of the target service instance, and using greedy algorithms to determine the target machine, the problem of operational instability in non-microservice instance deployment is solved, and more efficient instance deployment and stability are achieved.
Patent Information
- Application Number
- CN202510496946.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-29
AI Technical Summary
The existing instance deployment method cannot effectively adapt to non-microservice service instance deployment scenarios, resulting in unstable operation and lack of considerations for instance mutual exclusion, interdependence, partition isolation and other factors, resulting in unreasonable deployment.
By obtaining the resource usage time distribution data and attribute information of the target service instance, using greedy algorithms to determine the target machine, considering the mutually exclusive attributes, partition attributes and resource usage, avoiding abnormalities caused by instance mutual exclusion or excessive resource usage, and improving operational stability.
Improve the operation stability of service instances, avoid exceptions caused by instance mutual exclusion or excessive resource utilization, and improve deployment efficiency and stability.
Smart Images

Figure CN120567932A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software technology, and in particular to an instance arrangement method, device, electronic device, and storage medium. Background Art
[0002] Network services are typically implemented through multiple service instances, each of which can independently or collaboratively provide corresponding service functions. A service instance is a specific object of a class that can implement corresponding logical functions according to pre-written code, has dynamic memory, and can store operation results.
[0003] Service instances are deployed on machines and run using their CPU, storage, and other resources. In scenarios like data center reconstruction or migration, service instances need to be orchestrated, specifically determining which machines to deploy them on. Research on the deployment of microservice instances has typically focused on this. However, because microservice instances can run independently, while non-microservice instances cannot, existing instance deployment methods are not well-suited to non-microservice service instance deployment scenarios. This can lead to unstable operation of these service instances due to improper deployment. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide an instance orchestration method, apparatus, electronic device, and storage medium to improve instance operation stability.
[0005] According to one aspect of the present invention, a method for instance orchestration is provided, the method comprising:
[0006] Obtaining resource usage time distribution data of the target service instance to be deployed, wherein the resource usage time distribution data includes a corresponding relationship between resource usage and time;
[0007] Determine attribute information of the target service instance, the attribute information including a mutual exclusion attribute and a partition attribute, wherein the mutual exclusion attribute includes mutual exclusion instance information that cannot be deployed on the same machine as the target service instance, and the partition attribute includes network partition information of the target service instance;
[0008] A greedy algorithm is used to determine the target machine where the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data.
[0009] In a possible embodiment, obtaining resource usage time distribution data of the target service instance to be deployed includes:
[0010] Obtain resource usage history data of a target service to which the target service instance belongs, the resource usage history data including a historical resource usage of the target service and a usage time corresponding to the historical resource usage;
[0011] The resource usage time distribution data of the target service instance is determined based on the statistical values of the resource usage history data of the target service within a preset time period, wherein the statistical values include the average value, the median value and / or the maximum value.
[0012] In a possible embodiment, determining the resource usage time distribution data of the target service instance based on statistical values of historical data of resource usage of the target service within a preset duration includes:
[0013] Divide each time point according to the preset period;
[0014] For each of the time points, based on the resource utilization historical data of the target service, the resource utilization rates of each time point within the preset time length are obtained, and the statistical values of the resource utilization rates of each time point within the preset time length are used as the resource utilization historical data corresponding to the time point to obtain the resource utilization time distribution data of the target service instance.
[0015] In a possible embodiment, the mutually exclusive attribute is pre-set by the following steps:
[0016] Obtaining the port information and service file storage information of the target service instance;
[0017] Determine a service instance consistent with the port information of the target service instance and / or a service instance consistent with the service file storage information of the target service instance as a mutually exclusive instance of the target service instance;
[0018] The partition attributes are pre-set by following the steps below:
[0019] Obtain access rights to the target service instance;
[0020] The network partition information of the target service instance is configured based on the access permission of the target service instance. The network partition information includes an internal network partition or an isolation zone. The isolation zone is a network partition that can communicate with an external network, and the internal network partition is a network partition that cannot communicate with an external network.
[0021] In a possible embodiment, the method further includes:
[0022] Obtaining machine resource usage time distribution data of each machine in the cluster, wherein the machine resource usage time distribution data includes a correspondence between the machine resource usage and time;
[0023] The method of using a greedy algorithm to determine a target machine on which the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data includes:
[0024] Determine a target partition machine pool corresponding to the target service instance based on the partition attribute of the target service instance;
[0025] Based on the service instance information running on each machine in the target partition machine pool and the mutually exclusive attribute of the target service instance, eliminating machines running service instances mutually exclusive with the target service instance to obtain remaining machines;
[0026] Based on the peak data in the resource usage time distribution data of the target service instance, sorting the remaining machines in descending order of resource usage at the time points corresponding to the peak data; wherein the peak data is the resource usage and the corresponding time points at which the resource usage is higher than a preset usage threshold;
[0027] Determine the remaining machines with the lowest ranking as candidate machines;
[0028] When the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines, the candidate machine is determined to be the target machine to be deployed for the target service instance.
[0029] In a possible embodiment, the attribute information of the target service instance further includes a dependency attribute, where the dependency attribute is instance information on which the target service instance depends;
[0030] The step of removing machines running service instances mutually exclusive with the target service instance to obtain remaining machines includes:
[0031] Eliminate machines that run service instances that are mutually exclusive with the target service instance and machines that run service instances that are mutually exclusive with instances that the target service depends on, to obtain remaining machines;
[0032] The step of determining the candidate machine as a target machine to be deployed for the target service instance when the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines includes:
[0033] If the resource requirement of the candidate machine after deploying the target service instance and the dependent instances of the target service instance does not exceed the total resources of the candidate machines, the candidate machine is determined to be the target machine to be deployed for the target service instance.
[0034] In a possible embodiment, the method further includes:
[0035] If the resource demand of the candidate machine exceeds the total resources of the candidate machines after the target service instance is deployed, the candidate machine is eliminated, and the process returns to the step of determining the last remaining machine as the candidate machine.
[0036] According to another aspect of the present invention, there is provided an instance orchestration device, the device comprising:
[0037] An acquisition module, configured to acquire resource usage time distribution data of a target service instance to be deployed, wherein the resource usage time distribution data includes a correspondence between resource usage and time;
[0038] a determination module, configured to determine attribute information of the target service instance, the attribute information including mutually exclusive attributes and partition attributes, wherein the mutually exclusive attributes include mutually exclusive instance information that cannot be deployed on the same machine as the target service instance, and the partition attributes include network partition information of the target service instance;
[0039] The deployment module is used to determine the target machine where the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data by using a greedy algorithm.
[0040] According to another aspect of the present invention, there is provided an electronic device, comprising:
[0041] processor; and
[0042] Memory for storing programs,
[0043] The program includes instructions, which, when executed by the processor, enable the processor to execute any of the above-mentioned instance deployment methods.
[0044] According to another aspect of the present invention, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute any of the above-mentioned example deployment methods.
[0045] One or more technical solutions provided in the embodiments of the present invention obtain the resource utilization time distribution data of the target service instance and the mutual exclusion attributes and partition attributes configured for the target service instance, and determine the target machine where the target service instance needs to be deployed based on the obtained data. Since the mutual exclusion instance, partition information and resource utilization information of the target service instance are taken into account during the deployment process, abnormal operation of the service instance due to instance mutual exclusion or excessive resource utilization after the target service instance is deployed is avoided, thereby improving the operation stability of the service instance. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Further details, features and advantages of the present invention are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0047] Figure 1 A schematic diagram of a flow chart of an example arrangement method provided by an embodiment of the present invention;
[0048] Figure 2 A schematic diagram of resource usage time distribution data provided by an embodiment of the present invention;
[0049] Figure 3 A schematic diagram of another flow chart of the instance orchestration method provided in an embodiment of the present invention;
[0050] Figure 4 A schematic diagram of another flow chart of the instance orchestration method provided in an embodiment of the present invention;
[0051] Figure 5 A schematic diagram of the structure of an instance orchestration device provided by an embodiment of the present invention;
[0052] Figure 6 A block diagram of an exemplary electronic device capable of implementing the embodiments of the present invention is shown. DETAILED DESCRIPTION
[0053] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
[0054] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0055] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0056] It should be noted that the modifications of "one" and "multiple" mentioned in the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0057] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0058] The relevant technologies usually discuss the load balancing deployment of microservice instances, but not much research has been done on the load balancing deployment of non-microservice instances. Since each instance in a microservice instance can be deployed individually, but non-microservice instances are usually deployed as a whole, the existing microservice instance orchestration method cannot be directly transferred to the deployment of non-microservice instances.
[0059] Furthermore, existing research considers relatively simple factors in the formulation of instance deployment plans, and does not consider factors such as mutual exclusion, mutual dependence, and isolation between different types of services, resulting in unreasonable instance deployment and affecting the stability of instance operation.
[0060] Based on this, an embodiment of the present invention provides an instance orchestration method, apparatus, electronic device, and storage medium. The instance orchestration method provided by the embodiment of the present invention can be applied to any electronic device with an instance deployment function, such as a server, a computer, or a mobile terminal. In one possible embodiment, the instance orchestration method can be applied to a cluster. Exemplarily, the cluster can be a non-microservice cluster, that is, a cluster for deploying non-microservices. The cluster can include multiple electronic devices that jointly implement the instance orchestration method. The following describes the solution of the present invention with reference to the accompanying drawings:
[0061] Figure 1 A flowchart of a method for orchestrating an instance provided in an embodiment of the present invention is provided. The method may include:
[0062] S101. Obtain resource usage time distribution data of a target service instance to be deployed, wherein the resource usage time distribution data includes a correspondence between resource usage and time;
[0063] S102. Determine attribute information of the target service instance, where the attribute information includes a mutually exclusive attribute and a partition attribute, wherein the mutually exclusive attribute includes mutually exclusive instance information that cannot be deployed on the same machine as the target service instance, and the partition attribute includes network partition information of the target service instance;
[0064] S103 : Determine the target machine on which the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data by using a greedy algorithm.
[0065] By applying the embodiment of the present invention, the resource utilization time distribution data of the target service instance and the mutual exclusion attributes and partition attributes configured for the target service instance are obtained, and the target machine where the target service instance needs to be deployed is determined based on the obtained data. Since the mutual exclusion instance, partition information and resource utilization information of the target service instance are taken into consideration during the deployment process, abnormal operation of the service instance due to instance mutual exclusion or excessive resource utilization after the target service instance is deployed is avoided, thereby improving the operation stability of the service instance.
[0066] The above S101-S103 are exemplarily described below:
[0067] In S101, the target service's resource usage time distribution data includes a correspondence between resource usage and time. The resource usage may include CPU usage, memory usage, and disk usage. The time may be a discrete time point, such as a time point within a 24-hour period or a week. Each time point may be specifically divided according to the actual application scenario. For example, the time points may be divided into time intervals of 1 minute, 1 hour, etc., and the resource usage corresponding to each time point may be determined.
[0068] In a possible embodiment, resource usage time distribution data of a target service instance to be deployed may be obtained by the following steps:
[0069] Obtain resource usage history data of a target service to which the target service instance belongs, the resource usage history data including a historical resource usage of the target service and a usage time corresponding to the historical resource usage;
[0070] The resource usage time distribution data of the target service instance is determined based on the statistical values of the resource usage history data of the target service within a preset time period, wherein the statistical values include the average value, the median value and / or the maximum value.
[0071] The above-mentioned preset duration can be the previous day, that is, the resource utilization rate corresponding to each time point can be determined based on the resource utilization rate of the previous day. For example, the resource utilization rate corresponding to each time point in the day before the current time can be obtained as the resource utilization rate time distribution data.
[0072] In practice, resource usage data for each machine in the cluster is monitored using a monitoring tool and stored in a database. This monitoring tool can be flexibly selected based on the specific application scenario, such as Prometheus. Accordingly, full resource usage data for the previous day can be obtained from the database or monitoring tool's API, and resource usage data for the same time points on the previous day can be obtained by dividing the time points.
[0073] In one possible embodiment, the preset duration may also include multiple days, i.e., the resource usage time distribution data may be determined based on multiple days of historical resource usage data. For example, for each time point, based on the target service's historical resource usage data, the resource usage at that time point within the preset duration may be obtained, and the statistical value of the resource usage at that time point within the preset duration may be used as the resource usage historical data corresponding to that time point. The statistical value may be set based on the actual business scenario, such as an average, median, maximum value, etc.
[0074] After obtaining the resource usage time distribution data, it can be stored in the form of an array. Specifically, the array can include resource usage data and its corresponding time point, such as the [resource usage, time point] format. Figure 2 As shown, Figure 2 This is a schematic diagram of resource utilization time distribution data, specifically a schematic diagram of a discrete model of CPU utilization time distribution. By describing the CPU time distribution of the target service as discrete values within 24 hours, the time distribution of CPU utilization can be described using an array. This reduces the amount of stored data, simplifies queries, and improves the efficiency of subsequent instance deployment.
[0075] It is understandable that before a service occupies machine resources to run, it needs to purchase a CPU package from the corresponding cluster management platform. This is the total amount of CPU that the service can use. By combining the above resource utilization data group with the service's CPU package, the CPU usage of the service in the machine can be accurately described.
[0076] In a possible embodiment, resource usage time distribution data of each machine in the cluster may also be obtained. The acquisition process is the same as the process of obtaining resource usage time distribution data of the target service, and will not be repeated here.
[0077] Currently, in data center migration scenarios, instance orchestration generally lacks a specific design. Instead, operations personnel manually select machines for deployment. This lack of consideration for instance and port mutual exclusion, as well as for de-hotspotting of resources like the CPU, often leads to resource preemption. For example, manual deployment of a large number of service instances with peak morning CPU usage on the same machine can lead to CPU resource preemption in the morning, while machine resource utilization is low during other times. This not only poses a risk to service stability but also hinders improved machine resource utilization.
[0078] Furthermore, manual deployment by operations personnel, without guidance from a specific orchestration plan, often leads to startup failures due to port conflicts or mutually exclusive services, or to the lack of deployment of dependent services when a service instance handles online traffic. This leads to rework and the time required to resolve mutually exclusive conditions. These factors make manual deployment inefficient and can easily cause stability issues during the migration process.
[0079] Therefore, in the present invention, attribute information can be configured in advance for each service instance. This attribute information includes mutual exclusion attributes, partition attributes, isolation attributes, and load balancing attributes. The mutual exclusion attribute includes instance information that cannot be deployed on the same machine as the target service instance, specifically instance identification information. The mutual exclusion attribute can be determined based on the target service instance's port information, file storage information, and so on.
[0080] Multiple services may need to be deployed on each machine in the cluster to improve the resource utilization of the machine. Among the multiple services, there may be services that use the same port. If the service instances using the same port are deployed on the same machine, machine port preemption will occur, which will cause the service instances to fail to run normally. Therefore, these service instances with mutually exclusive ports cannot be deployed on the same machine.
[0081] In one possible embodiment, some services are heterogeneous services derived from the same code base, such as services derived from the same code using different programming languages or technical frameworks. Because the underlying code is the same, these services typically share the same service file deployment paths and names. Deploying these services on the same machine can lead to file query errors, potentially impacting the normal operation of the service instance. Therefore, service instances with identical file storage information cannot be deployed on the same instance.
[0082] In actual business scenarios, clusters are usually divided into different network partitions, such as demilitarized zones and internal network zones. The demilitarized zone is a network partition that can provide access to the external network, while the internal network zone is a network partition that cannot provide access to the external network. Different network partitions can be managed separately to improve data security.
[0083] For example, it is possible to determine whether the IP bound to each machine in the cluster can be accessed by the external network. If the IP can be accessed by the external network, the machine corresponding to the IP can be divided into an isolation area. If the IP cannot be accessed by the external network, the machine corresponding to the IP can be divided into an internal network partition.
[0084] To meet the need for network isolation between services of different natures, different services often need to be deployed in different network partitions. For example, services that directly provide external network access should be deployed in an isolation zone, while services that do not provide external access, such as storage services, should be deployed in an internal network partition. Therefore, in one possible embodiment, a service partition attribute can be pre-set based on the service's access rights. This partition attribute can indicate the service's deployment partition information, specifically a network partition identifier. This network partition information can include an internal network partition or an isolation zone.
[0085] In a possible embodiment, some services in actual applications must rely on other component services to operate normally, such as the various service instances included in the above-mentioned non-microservices. For example, an online service website includes multiple services, such as order management and product management services. For the order management service, it needs to rely on the product management service to obtain product inventory information and then determine whether an order can be generated. Therefore, these dependent service instances need to be deployed on the same machine. As a possible implementation method, the service instance that generates these parameters can be determined based on the parameters contained in the code of the target service instance and pre-stored as the dependency attribute of the target service instance.
[0086] In a possible embodiment, the attributes of the target service instance may further include resource usage attributes, which are resource usage time distribution data of the target service instance.
[0087] Various attribute information of the target service instance can be determined and stored based on the target service instance's port information, file storage information, network partition information, dependency information, and resource usage time distribution data. As one possible implementation, the service instance and its attribute information can be represented in a key-value format. Specifically, the key can be the service instance identifier, and the value can be the attribute information. When deploying a service instance, the attribute information can be queried based on the service instance identifier and deployed based on this attribute information.
[0088] In a possible embodiment, the target machine where the target service instance needs to be deployed can be determined by the following steps:
[0089] S301: Determine a target partition machine pool corresponding to the target service instance based on the partition attribute of the target service instance.
[0090] As a possible implementation, the cluster management platform can record the network partition identifier corresponding to each machine. Therefore, based on the partition identifier of the target service instance, machines with the same network partition identifier can be determined as the target partition machine pool. The above-mentioned cluster management platform can be Kubernetes, etc.
[0091] S302: Based on the service instance information running on each machine in the target partition machine pool and the mutually exclusive attribute of the target service instance, eliminate machines running service instances that are mutually exclusive with the target service instance to obtain remaining machines;
[0092] As a possible implementation, the cluster management platform can be used to obtain information about the service instances currently running on each machine in the target machine partition. The mutually exclusive attributes of the target service instance are then used to query the currently running service instances on each machine. If a matching service instance is found, the machine running the corresponding service instance is removed.
[0093] S303. Based on the peak data in the time distribution data of the resource usage of the target service instance, sort the remaining machines in ascending order of resource usage at the time points corresponding to the peak data; wherein the peak data is the resource usage and the corresponding time points at which the resource usage exceeds a preset usage threshold;
[0094] S304: Determine the remaining machine with the lowest ranking as a candidate machine;
[0095] In one possible embodiment, a peak resource usage period of the target service instance can be determined based on the time distribution data of the resource usage of the target service instance. The peak resource usage period can be a time point when the resource usage exceeds a preset threshold, or can be a preset number of time points at which the resource usage is highest. For example, the five time points at which the resource usage is highest can be determined based on the time distribution data of the resource usage of the target service instance.
[0096] After determining the peak period of resource usage, the remaining machines can be sorted based on the peak period of resource usage. Specifically, the resource usage corresponding to the time point of the peak period of resource usage among the remaining machines, that is, the resource utilization rate, can be determined, and the remaining machines can be sorted in order from high to low or from low to high according to the resource utilization rate of the remaining machines at that time point.
[0097] Taking the high-to-low ranking as an example, if the time point corresponding to the peak resource usage period is 1, then based on the ranking, the remaining machines ranked first can be determined as candidate machines. If the time point corresponding to the peak resource usage period is greater than 1, then the machine with the highest overall ranking among the machine rankings corresponding to each time point can be determined as a candidate machine. The overall ranking can be the average, median, or minimum value of the ranking of the machine in each ranking corresponding to each time point.
[0098] S305: When the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines, determine the candidate machine as the target machine to be deployed for the target service instance.
[0099] The resource demand can be determined by summing the target service instance's resource usage time distribution data at each point in time and the candidate machine's resource usage time distribution data. Specifically, the target service instance's resource demand time distribution data can be determined based on the target service instance's resource usage time distribution data and the CPU package purchased by the target service, and the machine's current resource usage time distribution data can be determined based on the machine's resource usage time distribution data and the total resources owned by the machine. That is, if the sum of the resource usage at each point in time is lower than a preset resource usage threshold for the candidate machine, the candidate machine can be determined as the target machine. The resource usage threshold can be the total resource amount of the machine or a portion of the total resource amount of the machine.
[0100] For example, Figure 3 As shown, after the deployment process starts, you can perform the following steps:
[0101] S31. Determine the target machine partition based on the partition attribute of the target service instance.
[0102] In actual applications, machine pools corresponding to different network partitions are usually divided in the cluster, such as the isolation zone machine pool and the intranet zone machine pool. Therefore, in this step, the target partition machine pool can be determined based on the partition attributes of the target service instance.
[0103] S32. Eliminate machines that deploy mutually exclusive services based on the mutually exclusive attribute of the target service instance.
[0104] S33. Sort the remaining machines using a greedy algorithm based on the resource usage time distribution data of the target service instance.
[0105] S34. Determine whether the resources required by the candidate machine after loading the instance exceed the total resources of the machine. If not, the candidate machine can be determined as the target machine. If so, the candidate machine can be eliminated and S33 is executed again until the target machine is selected.
[0106] S35. Load the target service instance and update the global demand structure and deployment structure.
[0107] S36: Determine whether the deployment requirements are completed. If so, end the process; if not, return to S31.
[0108] The global requirements structure refers to a data structure used to define and manage shared data and configuration information for the entire service process during service orchestration. It stores all key parameters and variables required by the service process, typically including information such as input parameters, output results, intermediate status, and possible error codes. In this embodiment, the deployment status and deployment structure of the target service instance can be updated.
[0109] The deployment structure is a data structure used to define and manage the data and configuration information required during service deployment. It typically includes all key parameters related to service deployment, such as deployment targets, configuration options, and environment variables. This structure allows developers to organize and communicate this information in a structured manner, thereby simplifying the service deployment process. In this embodiment, the target machine information corresponding to the target service instance and the environment variables of the target service instance can be updated.
[0110] In a possible embodiment, when deploying the target service instance, the target service instance and the instances on which the target service instance depends may be deployed as a whole based on the dependency attributes of the target service instance.
[0111] As a possible implementation manner, removing machines running service instances mutually exclusive with the target service instance to obtain remaining machines includes:
[0112] Eliminate machines that run service instances that are mutually exclusive with the target service instance and machines that run service instances that are mutually exclusive with instances that the target service depends on, to obtain remaining machines;
[0113] The step of determining the candidate machine as a target machine to be deployed for the target service instance when the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines includes:
[0114] If the resource requirement of the candidate machine after deploying the target service instance and the dependent instances of the target service instance does not exceed the total resources of the candidate machines, the candidate machine is determined to be the target machine to be deployed for the target service instance.
[0115] In a possible embodiment, after the target service instance is deployed, the next service instance may be deployed according to the above deployment process until all instances are deployed.
[0116] like Figure 4 As shown, Figure 4 A flowchart of a method for orchestrating an instance provided in an embodiment of the present invention may include the following steps:
[0117] S41. Obtain a data source, which refers to service demand data. Specifically, it may include information of each target service instance that needs to be deployed. The information may include resource usage information, attribute information, and service instance identifier of the service instance.
[0118] S42. Initialize the global deployment requirement structure, which includes the number of service instances to be deployed, data center information, network partitions for service deployment, service ports, and resource requirements for the service, including CPU, memory, disk, and other resources.
[0119] S43. Initialize the deployment result structure, that is, whether the deployment is successful or not, and related data information. 1. If unsuccessful, return the reason for the unsuccessful deployment, such as system interaction abnormality or insufficient cluster resources. 2. If partially successful, also return the reason for the failure to be fully successful, and return the information of the machines that can be deployed to execute the deployment action. 3. If successful, also return the deployment result information, that is, the mapping relationship between the server and the deployment service instance.
[0120] S44: For each target service instance that needs to be deployed, a single service instance is loaded based on the above instance orchestration method, and after the target machines that need to be deployed for all target service instances are determined, the orchestration is ended.
[0121] By applying an embodiment of the present invention, a discrete service instance CPU usage description model is provided, which conveniently describes the time distribution of CPU usage. Furthermore, in the instance deployment algorithm, factors that need to be considered in the actual deployment process, such as mutual exclusion factors, dependency factors, and partition isolation, are taken into account. In combination with the CPU usage description information, a service instance deployment orchestration method with CPU resource load balancing is designed to improve manual deployment efficiency, which is also a necessary condition for one-click website building. One-click website building refers to an engineering implementation in which the scaling system automatically completes all deployment work by inputting an instance orchestration plan based on stable automatic expansion capabilities and a high success rate.
[0122] Based on the same inventive concept, the embodiment of the present invention also provides an instance arrangement device, such as Figure 5 As shown, the apparatus 500 may include:
[0123] An acquisition module 501 is configured to acquire resource usage time distribution data of a target service instance to be deployed, wherein the resource usage time distribution data includes a correspondence between resource usage and time;
[0124] Determining module 502, configured to determine attribute information of the target service instance, the attribute information including mutually exclusive attributes and partition attributes, wherein the mutually exclusive attributes include mutually exclusive instance information that cannot be deployed on the same machine as the target service instance, and the partition attributes include network partition information of the target service instance;
[0125] The deployment module 503 is configured to determine the target machine where the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data by using a greedy algorithm.
[0126] In a possible embodiment, obtaining resource usage time distribution data of the target service instance to be deployed includes:
[0127] Obtain resource usage history data of a target service to which the target service instance belongs, the resource usage history data including a historical resource usage of the target service and a usage time corresponding to the historical resource usage;
[0128] The resource usage time distribution data of the target service instance is determined based on the statistical values of the resource usage history data of the target service within a preset time period, wherein the statistical values include the average value, the median value and / or the maximum value.
[0129] In a possible embodiment, determining the resource usage time distribution data of the target service instance based on statistical values of historical data of resource usage of the target service within a preset duration includes:
[0130] Divide each time point according to the preset period;
[0131] For each of the time points, based on the resource utilization historical data of the target service, the resource utilization rates of each time point within the preset time length are obtained, and the statistical values of the resource utilization rates of each time point within the preset time length are used as the resource utilization historical data corresponding to the time point to obtain the resource utilization time distribution data of the target service instance.
[0132] In a possible embodiment, the mutually exclusive attribute is pre-set by the following steps:
[0133] Obtaining the port information and service file storage information of the target service instance;
[0134] Determine a service instance consistent with the port information of the target service instance and / or a service instance consistent with the service file storage information of the target service instance as a mutually exclusive instance of the target service instance;
[0135] The partition attributes are pre-set by following the steps below:
[0136] Obtain access rights to the target service instance;
[0137] The network partition information of the target service instance is configured based on the access permission of the target service instance. The network partition information includes an internal network partition or an isolation zone. The isolation zone is a network partition that can communicate with an external network, and the internal network partition is a network partition that cannot communicate with an external network.
[0138] In a possible embodiment, the acquisition module is configured to acquire machine resource usage time distribution data of each machine in the cluster, wherein the machine resource usage time distribution data includes a correspondence between the machine resource usage and time;
[0139] The method of using a greedy algorithm to determine a target machine on which the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data includes:
[0140] Determine a target partition machine pool corresponding to the target service instance based on the partition attribute of the target service instance;
[0141] Based on the service instance information running on each machine in the target partition machine pool and the mutually exclusive attribute of the target service instance, eliminating machines running service instances mutually exclusive with the target service instance to obtain remaining machines;
[0142] Based on the peak data in the resource usage time distribution data of the target service instance, sorting the remaining machines in descending order of resource usage at the time points corresponding to the peak data; wherein the peak data is the resource usage and the corresponding time points at which the resource usage is higher than a preset usage threshold;
[0143] Determine the remaining machines with the lowest ranking as candidate machines;
[0144] When the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines, the candidate machine is determined to be the target machine to be deployed for the target service instance.
[0145] In a possible embodiment, the attribute information of the target service instance further includes a dependency attribute, where the dependency attribute is instance information on which the target service instance depends;
[0146] The step of removing machines running service instances mutually exclusive with the target service instance to obtain remaining machines includes:
[0147] Eliminate machines that run service instances that are mutually exclusive with the target service instance and machines that run service instances that are mutually exclusive with instances that the target service depends on, to obtain remaining machines;
[0148] The step of determining the candidate machine as a target machine to be deployed for the target service instance when the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines includes:
[0149] If the resource requirement of the candidate machine after deploying the target service instance and the dependent instances of the target service instance does not exceed the total resources of the candidate machines, the candidate machine is determined to be the target machine to be deployed for the target service instance.
[0150] In a possible embodiment, the deployment module is configured to, if the resource demand of the candidate machine exceeds the total resources of the candidate machines after the target service instance is deployed, eliminate the candidate machine and return to the step of determining the last-ranked remaining machine as the candidate machine.
[0151] Among them, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the present invention are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0152] An exemplary embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by the at least one processor, wherein the computer program, when executed by the at least one processor, causes the electronic device to perform a method according to an embodiment of the present invention.
[0153] Exemplary embodiments of the present invention further provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform a method according to an embodiment of the present invention.
[0154] An exemplary embodiment of the present invention further provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor of a computer, the computer is configured to cause the computer to perform a method according to an embodiment of the present invention.
[0155] refer to Figure 6 , a block diagram of an electronic device 600 that can serve as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0156] like Figure 6 As shown, the electronic device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. Various programs and data required for the operation of the electronic device 600 can also be stored in the RAM 603. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0157] Multiple components within electronic device 600 are connected to I / O interface 605, including an input unit 606, an output unit 607, a storage unit 608, and a communication unit 609. Input unit 606 can be any type of device capable of inputting information into electronic device 600. Input unit 606 can receive input numeric or character information and generate key input signals related to user settings and / or function control of the electronic device. Output unit 607 can be any type of device capable of presenting information and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. Storage unit 608 may include, but is not limited to, a magnetic disk or an optical disk. Communication unit 609 allows electronic device 600 to exchange information / data with other devices via computer networks such as the Internet and / or various telecommunication networks and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0158] The computing unit 601 can be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above. For example, in some embodiments, the above-mentioned example deployment method can be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 600 via the ROM 602 and / or the communication unit 609. In some embodiments, the computing unit 601 can be configured to perform the above-mentioned example deployment method by any other appropriate means (e.g., by means of firmware).
[0159] The program code for implementing the method of the present invention can be written in any combination of one or more programming languages. Such program code can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0160] In the context of the present invention, machine-readable medium can be a tangible medium that can contain or store a program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0161] As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and / or device (e.g., a magnetic disk, an optical disk, a memory, a programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and / or data to a programmable processor.
[0162] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0163] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0164] Computer systems may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The client and server relationship arises through computer programs running on the respective computers and having a client-server relationship to each other.
Claims
1. An instance arrangement method, characterized in that: The method comprises: Obtaining resource usage time distribution data of the target service instance to be deployed, wherein the resource usage time distribution data includes a corresponding relationship between resource usage and time; Determine attribute information of the target service instance, the attribute information including a mutual exclusion attribute and a partition attribute, wherein the mutual exclusion attribute includes mutual exclusion instance information that cannot be deployed on the same machine as the target service instance, and the partition attribute includes network partition information of the target service instance; A greedy algorithm is used to determine the target machine where the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data.
2. The method according to claim 1, characterized in that The obtaining of resource usage time distribution data of the target service instance to be deployed includes: Obtain resource usage history data of a target service to which the target service instance belongs, the resource usage history data including a historical resource usage of the target service and a usage time corresponding to the historical resource usage; The resource usage time distribution data of the target service instance is determined based on the statistical values of the resource usage history data of the target service within a preset time period, wherein the statistical values include the average value, the median value and / or the maximum value.
3. The method according to claim 2, characterized in that The determining of the resource usage time distribution data of the target service instance based on the statistical value of the resource usage history data of the target service within a preset time period includes: Divide each time point according to the preset period; For each of the time points, based on the resource utilization historical data of the target service, the resource utilization rates of each time point within the preset time length are obtained, and the statistical values of the resource utilization rates of each time point within the preset time length are used as the resource utilization historical data corresponding to the time point to obtain the resource utilization time distribution data of the target service instance.
4. The method according to claim 1, wherein The mutually exclusive attribute is pre-set by the following steps: Obtaining the port information and service file storage information of the target service instance; Determine a service instance consistent with the port information of the target service instance and / or a service instance consistent with the service file storage information of the target service instance as a mutually exclusive instance of the target service instance; The partition attributes are pre-set by following the steps below: Obtain access rights to the target service instance; The network partition information of the target service instance is configured based on the access permission of the target service instance. The network partition information includes an internal network partition or an isolation zone. The isolation zone is a network partition that can communicate with an external network, and the internal network partition is a network partition that cannot communicate with an external network.
5. The method according to claim 1, characterized in that The method further comprises: Obtaining machine resource usage time distribution data of each machine in the cluster, wherein the machine resource usage time distribution data includes a correspondence between the machine resource usage and time; The method of using a greedy algorithm to determine a target machine on which the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data includes: Determine a target partition machine pool corresponding to the target service instance based on the partition attribute of the target service instance; Based on the service instance information running on each machine in the target partition machine pool and the mutually exclusive attribute of the target service instance, eliminating machines running service instances mutually exclusive with the target service instance to obtain remaining machines; Based on the peak data in the resource usage time distribution data of the target service instance, sorting the remaining machines in descending order of resource usage at the time points corresponding to the peak data; wherein the peak data is the resource usage and the corresponding time points at which the resource usage is higher than a preset usage threshold; Determine the remaining machines with the lowest ranking as candidate machines; When the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines, the candidate machine is determined to be the target machine to be deployed for the target service instance.
6. The method according to claim 5, characterized in that The attribute information of the target service instance further includes a dependency attribute, where the dependency attribute is instance information that the target service instance depends on; The step of removing machines running service instances mutually exclusive with the target service instance to obtain remaining machines includes: Eliminate machines that run service instances that are mutually exclusive with the target service instance and machines that run service instances that are mutually exclusive with instances that the target service depends on, to obtain remaining machines; The step of determining the candidate machine as a target machine to be deployed for the target service instance when the resource requirement of the candidate machine after the target service instance is deployed does not exceed the total resources of the candidate machines includes: If the resource requirement of the candidate machine after deploying the target service instance and the dependent instances of the target service instance does not exceed the total resources of the candidate machines, the candidate machine is determined to be the target machine to be deployed for the target service instance.
7. The method according to claim 5, characterized in that The method further comprises: If the resource demand of the candidate machine exceeds the total resources of the candidate machines after the target service instance is deployed, the candidate machine is eliminated, and the process returns to the step of determining the last remaining machine as the candidate machine.
8. An instance arrangement device, characterized in that: The device comprises: An acquisition module, configured to acquire resource usage time distribution data of a target service instance to be deployed, wherein the resource usage time distribution data includes a correspondence between resource usage and time; a determination module, configured to determine attribute information of the target service instance, the attribute information including mutually exclusive attributes and partition attributes, wherein the mutually exclusive attributes include mutually exclusive instance information that cannot be deployed on the same machine as the target service instance, and the partition attributes include network partition information of the target service instance; The deployment module is used to determine the target machine where the target service instance needs to be deployed based on the attribute information of the target service instance and the resource usage time distribution data by using a greedy algorithm.
9. An electronic device comprising: processor; as well as Memory for storing programs, The program includes instructions, which, when executed by the processor, cause the processor to perform the method according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to enable a computer to execute the method according to any one of claims 1 to 7.