Resource Scheduling Method and Apparatus for Elasticsearch Cluster and System

The resource scheduling method for ES clusters dynamically adjusts resources to match data writing and reading rates, improving flexibility and resource utilization while maintaining shard counts, thus enhancing data storage and writing performance.

JP2025515212AActive Publication Date: 2025-05-13HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
JP2024566638
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-06-29
Filing Date
2022-12-06
Publication Date
2025-05-13
Estimated Expiration
2042-12-06

AI Technical Summary

Technical Problem

ElasticSearch (ES) clusters face low data writing flexibility due to the inability to modify the number of shards in an index after creation, limiting data storage capacity and writing rate adjustments.

Method used

A resource scheduling method and apparatus that dynamically adjusts the resources allocated to shards in an ES cluster by adding or removing nodes and adjusting node specifications based on data write and read rates to match the current demand, without changing the number of shards.

Benefits of technology

Enhances data writing flexibility and resource utilization by optimizing data storage capacity and writing rates, reducing costs through efficient use of spot resources and node specification adjustments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025515212000001_ABST
    Figure 2025515212000001_ABST
Patent Text Reader

Abstract

The present application provides a resource scheduling method and apparatus for an ElasticSearch cluster, and a system, and relates to the field of data storage technology. According to the solution provided in the present application, the data writing rate of a target index can be calculated, and when the data writing rate falls outside the target rate range, the amount of resources of a node occupied by multiple shards of the target index can be dynamically adjusted. Since both the data storage capacity of the target index and the maximum data writing rate supported by the target index are related to the amount of resources occupied by multiple shards, the solution provided in the present application can dynamically adjust the data storage capacity and the maximum data writing rate of the target index without changing the amount of shards included in the target index. In this way, the flexibility of data writing is effectively increased, and the utilization of cluster resources is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] This application claims priority to Chinese Patent Application No. 202210510751.2, filed on May 11, 2022, entitled "DATA PROCESSING METHOD AND COMPUTER," and Chinese Patent Application No. 202210764591.4, filed on June 29, 2022, entitled "RESOURCE SCHEDULING METHOD AND APPARATUS FOR ELASTIC-SEARCH CLUSTER AND SYSTEM," which are hereby incorporated by reference in their entireties.

[0002] The present application relates to the field of data storage technology, and in particular to a resource scheduling method and apparatus, and system for ElasticSearch clusters. [Background technology]

[0003] Elastic-search (ES) is a distributed, highly scalable, highly real-time data search engine that can provide data search services within a cluster. A cluster typically includes multiple nodes, and each node may be a physical machine or a virtual machine (VM).

[0004] In an ES cluster, the smallest unit of data storage and retrieval is a document. A logical space (i.e., a container) used to store a document is called an index. An index may be divided into multiple shards, and at least one corresponding replica is created for each shard to increase the data storage capacity of the index and achieve high availability. Each shard and the at least one replica corresponding to the shard are distributed to different nodes. When a document needs to be stored in an index, a target shard for storing the document needs to be calculated first based on the identity (ID) of the document and the amount of shards included in the index, and then the document may be stored in the target shard, such that the target shard synchronizes the document to at least one replica corresponding to the target shard. When a document needs to be read from an index, a target shard where the document is stored may be determined based on the ID of the document and the amount of shards included in the index, and the document is read from the target shard.

[0005] Since the target shard needs to be calculated based on the amount of shards included in the index, the amount of shards included in the index needs to be determined in order to store documents in the index and read documents from the index. In other words, the amount of shards included in the index cannot be modified after the index is created. As a result, data writing flexibility is low. Summary of the Invention [Means for solving the problem]

[0006] The present application provides a resource scheduling method and apparatus, and system for ES clusters to solve the technical problem of low flexibility of data writing in ElasticSearch clusters.

[0007] According to a first aspect, a resource scheduling method for an ES cluster is provided. The ES cluster includes a plurality of first nodes, and the plurality of first nodes are configured to carry a plurality of shards of a target index. The method includes calculating a data write rate of the target index, and adjusting an amount of resources of the node occupied by the plurality of shards of the target index when the data write rate of the target index falls outside a target rate range.

[0008] Because both the data storage capacity of a target index and the maximum data writing rate supported by the target index are related to the amount of resources occupied by multiple shards, the solution provided in the present application can dynamically adjust the data storage capacity and the maximum data writing rate of a target index without changing the amount of shards included in the target index. In this way, the flexibility of data writing is effectively increased, and the utilization of cluster resources is effectively improved.

[0009] Optionally, the process of adjusting the amount of resources of a node occupied by the plurality of shards when the data write rate of the target index falls outside the target rate range may include adding at least one new second node to the ES cluster when the data write rate of the target index is higher than an upper limit of the target rate range, and migrating at least one shard among the plurality of shards to the at least one second node.

[0010] At least one second node is newly added to the ES cluster, and thus the ES cluster can be scaled out, and the amount of resources occupied by the target index increases. In this way, the data storage capacity and maximum data writing rate of the target index can be effectively improved, so that the data writing performance of the target index can match the current actual data writing rate.

[0011] Optionally, before the at least one second node is newly added to the ES cluster, the method may further include determining an amount of the at least one second node to be newly added based on a difference between a data write rate of the target index and an upper limit of a target rate range, the amount being positively correlated with the difference, and the node specification of the at least one second node being a preset specification.

[0012] In the solution provided in this application, at least one second node with preset specifications may be newly added to the ES cluster based on the difference in write rate. The method of newly adding the second node is simple and highly efficient.

[0013] Optionally, before the at least one second node is newly added to the ES cluster, the method may further include determining an amount of the at least one second node to be newly added and a node specification of each second node based on a plurality of different candidate node specifications and a difference between a data write rate of the target index and an upper limit of a target rate range. The node specification of each second node is selected from the plurality of candidate node specifications.

[0014] When the available nodes in the resource pool have multiple different node specifications, in the solution provided in the present application, at least one second node may be determined from the available nodes of multiple different node specifications based on the difference in write rate. The method of newly adding the second node is flexible. For example, in the solution provided in the present application, at least one second node may be determined based on the cost of the specifications of each candidate node and according to a cost-first policy. In this way, the cost of the newly added node may be effectively reduced.

[0015] Optionally, a total amount m1 of processor cores included in at least one second node may satisfy m1≧(s1−s2) / s0, where s1 is a data write rate of a target index, s2 is an upper limit of a target rate range, and s0 is a data write rate threshold of each processor core.

[0016] According to the above formula, it can be guaranteed that after at least one second node is newly added, the data write performance of the multiple first nodes and at least one second node configured to carry the target index can match the data write rate of the target index.

[0017] Optionally, the resource used by at least one second node may be a spot resource. Since the cost of spot resources is low, in the solution provided in this application, spot resources may be preferentially used as resources of newly added nodes.

[0018] Optionally, at least one shard may satisfy at least one of the following conditions: an amount of data written to the shard is less than a first threshold, and a total amount of the shard distributed to the first node on which the shard is located is greater than a second threshold.

[0019] In the solution provided in the present application, it can be known from the condition that a shard with a small amount of written data may be selected for migration, and / or a shard in a first node with a large amount of shards may be selected for migration. In this way, the efficiency of shard migration can be effectively increased, the cost of migration can be reduced, and the amount of shards in all first nodes is guaranteed to be balanced.

[0020] Optionally, the process of adjusting the amount of resources of a node occupied by a plurality of shards when the data write rate of the target index falls outside a target rate range may include determining at least one first target node to be removed from the plurality of first nodes when the data write rate of the target index is below a lower limit of the target rate range, migrating all shards distributed to the at least one first target node to first nodes other than the at least one first target node, and removing the at least one first target node.

[0021] If the data write rate of the target index is less than the lower limit of the target rate range, it indicates that the data write performance of multiple first nodes in the ES cluster is not fully utilized. Therefore, at least one first node is removed to reduce the capacity of the ES cluster, so as to effectively improve the resource utilization of the ES cluster and reduce the cost of the ES cluster.

[0022] Optionally, the total amount of shards distributed to each first target node is less than a third threshold. In other words, in the solution provided in the present application, a first node with a small amount of shards may be removed. In this way, it can be ensured that the shards in the at least one first target node can be quickly migrated to another first node before the at least one first target node is removed.

[0023] Optionally, the process of adjusting the amount of node resources occupied by the plurality of shards when the data write rate of the target index falls outside a target rate range may include adjusting a node specification of at least one first node among the plurality of first nodes when the data write rate of the target index falls outside a target rate range.

[0024] According to the solution provided in the present application, the node specification of the first node can be dynamically adjusted to adjust the amount of resources occupied by the target index without changing the first node to which the shard belongs.

[0025] Optionally, the process of adjusting the node specification of at least one first node among the plurality of first nodes when the data write rate of the target index falls outside a target rate range may include increasing the node specification of at least one second target node among the plurality of first nodes when the data write rate of the target index is higher than the upper limit of the target rate range. The at least one second target node may be a first node with a large amount of shards in the ES cluster.

[0026] Optionally, the process of adjusting the node specification of at least one first node among the plurality of first nodes when the data write rate of the target index falls outside a target rate range may include decreasing the node specification of at least one third target node among the plurality of first nodes when the data write rate of the target index is below a lower limit of the target rate range. The at least one third target node may be a first node with a low amount of shards in the ES cluster.

[0027] Optionally, the resource used by a fourth target node among the plurality of first nodes is a spot resource. The method may further include, when a remaining available duration of the spot resource used by the fourth target node is less than a duration threshold, newly adding at least one third node to the ES cluster, migrating all shards distributed to the fourth target node to the at least one third node, and deleting the third target node.

[0028] Since the cost of spot resources is low, in the solution provided in this application, the spot resources may be used as the resources of the fourth target node, and when the remaining usage duration of the spot resources is less than the duration threshold, the shards in the fourth target node may be migrated to the newly added third node in time. In this way, the cost of the ES cluster may be effectively reduced while the data read / write performance of the ES cluster is guaranteed.

[0029] Optionally, the resources used by the at least one third node may include on-demand resources and / or spot resources. On-demand resources are resources purchased based on service requirements, and the cost of on-demand resources is higher than the cost of spot resources. For example, in the solution provided in this application, the type of resources used by the at least one third node may be determined according to a cost-first policy.

[0030] Optionally, the ES cluster may further include a plurality of fourth nodes, the plurality of fourth nodes being configured to carry a plurality of replicas of the target index. The method may further include calculating a data read frequency of the target index, and adjusting an amount of replicas included in the target index when the data read frequency of the target index falls outside a target frequency range.

[0031] In the solution provided in this application, the amount of replicas included in the target index is adjusted so that the amount of replicas included in the target index can be consistent with the data read frequency.In this way, the resource utilization of the ES cluster can be effectively improved while the data read performance is guaranteed.

[0032] Optionally, the process of adjusting the amount of replicas included in the target index when the data read frequency of the target index falls outside the target frequency range may include adding at least one new fifth node to the ES cluster when the data read frequency of the target index is higher than an upper limit of the target frequency range, and adding at least one new replica of the target index to each fifth node.

[0033] A fifth node is newly added to the ES cluster, and at least one replica is newly added to the fifth node, so that the data reading performance of the ES cluster can be effectively improved.

[0034] Optionally, the process of adjusting the amount of replicas included in the target index when the data read frequency of the target index falls outside the target frequency range may include removing replicas distributed to at least one fifth target node among the plurality of fourth nodes when the data read frequency of the target index is below a lower limit of the target frequency range, and removing the at least one fifth target node.

[0035] If the data read frequency of the target index is less than the lower limit of the target frequency range, it indicates that the data read performance of multiple fourth nodes in the ES cluster is not fully utilized. Therefore, at least one fifth target node is deleted to reduce the capacity of the ES cluster, so as to effectively improve the resource utilization of the ES cluster and reduce the cost of the ES cluster.

[0036] According to a second aspect, a resource scheduling apparatus for an ES cluster is provided. The resource scheduling apparatus may include at least one module, and the at least one module may be configured to implement the resource scheduling method for the ES cluster according to the previous aspect.

[0037] According to a third aspect, a cluster of computing devices is provided. The cluster of computing devices includes at least one computing device, each computing device including a processor and a memory. The processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device such that the cluster of computing devices performs the resource scheduling method for an ES cluster according to the aforementioned aspect.

[0038] According to a fourth aspect, a computer-readable storage medium is provided, the computer-readable storage medium storing computer program instructions, which, when executed by a cluster of computing devices, cause the cluster of computing devices to perform a resource scheduling method for an ES cluster according to the aforementioned aspect.

[0039] According to a fifth aspect, there is provided a computer program product comprising instructions which, when executed by a cluster of computing devices, enable the cluster of computing devices to perform a resource scheduling method for an ES cluster according to the preceding aspect.

[0040] According to a sixth aspect, there is provided an ES system, which includes an ES cluster and a resource scheduling device for the ES cluster, and the resource scheduling device may be configured to implement the resource scheduling method for the ES cluster according to the previous aspect.

[0041] In conclusion, the present application provides a resource scheduling method and apparatus for elasticsearch clusters and a system, which belongs to the field of data storage technology. According to the solution provided in the present application, the data write rate of a target index can be calculated, and when the data write rate falls outside the target rate range, the amount of resources of a node occupied by multiple shards of the target index can be dynamically adjusted. Since both the data storage capacity of a target index and the maximum data write rate supported by the target index are related to the amount of resources occupied by multiple shards, the solution provided in the present application can dynamically adjust the data storage capacity and the maximum data write rate of the target index without changing the amount of shards included in the target index. In this way, the flexibility of data writing is effectively increased, and the utilization of cluster resources is effectively improved. [Brief description of the drawings]

[0042] [Figure 1] FIG. 2 is a diagram of the structure of an ES cluster according to an embodiment of the present application. [Diagram 2] FIG. 1 is a diagram of an application scenario of a resource scheduling method for an ES cluster according to an embodiment of the present application. [Diagram 3] 2 is a flow chart of a resource scheduling method for an ES cluster according to an embodiment of the present application; [Figure 4] 2 is a flow chart of a method for scaling out an ES cluster according to an embodiment of the present application. [Diagram 5] FIG. 2 illustrates the addition of a second node to the AASS component according to an embodiment of the present application. [Figure 6] FIG. 1 illustrates a diagram of migrating shards by a client proxy component according to an embodiment of the present application. [Figure 7] FIG. 2 is a diagram of a scaled-out ES cluster according to an embodiment of the present application. [Figure 8]2 is a flow chart of a method for scaling in an ES cluster according to an embodiment of the present application. [Figure 9] FIG. 13 illustrates a client proxy component in which the AASS component initiates a deletion procedure according to an embodiment of the present application. [Figure 10] FIG. 13 is another diagram of migrating shards by a client proxy component according to an embodiment of the present application. [Figure 11] FIG. 2 illustrates deleting a first target node by an AASS component according to an embodiment of the present application. [Figure 12] FIG. 11 illustrates data write performance of a first node with different node specifications according to an embodiment of the present application. [Figure 13] 4 is another flow chart of a resource scheduling method for an ES cluster according to an embodiment of the present application; [Figure 14] FIG. 2 is a diagram illustrating a node replacement policy determined by a resource scheduling apparatus according to an embodiment of the present application; [Figure 15] FIG. 13 illustrates the addition of a third node to the AASS component according to an embodiment of the present application. [Figure 16] FIG. 13 illustrates the deletion of a fourth goal node by the AASS component according to an embodiment of the present application. [Figure 17] FIG. 13 illustrates the addition of a fifth node to the AASS component according to an embodiment of the present application. [Figure 18] FIG. 2 is a diagram of data read frequency of a target index according to an embodiment of the present application. [Figure 19] FIG. 2 is a diagram of data write frequency of a target index according to an embodiment of the present application. [Figure 20] FIG. 2 is a structural diagram of a resource scheduling device for an ES cluster according to an embodiment of the present application; [Figure 21] FIG. 2 is a diagram of the structure of a computing device according to an embodiment of the present application. [Figure 22]1 is a diagram of a structure of a cluster of computing devices according to an embodiment of the present application. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0043] The following describes in detail the resource scheduling method and apparatus and system for ES cluster provided in the embodiments of the present application with reference to the accompanying drawings.

[0044] First, the following terms in the embodiments of the present application will be explained.

[0045] ES: ES is a distributed, highly scalable, and highly real-time data search engine developed based on Lucene (a full-text search engine) that can provide data search services within a cluster.

[0046] ES Cluster: An ES cluster is a set of multiple nodes that can independently provide search services. For example, as shown in Figure 1, an ES cluster may include a total of three nodes, namely, node 1 to node 3.

[0047] Node: A node may also be called an ES server, ES instance, or computing instance, and contains basic physical resources such as processors, memory, and disks. A node can be a physical machine, a VM, or a container within a physical machine.

[0048] Index: An index is a logical space used to store data and is comparable to a database.

[0049] Shard: A shard is obtained by splitting an index and is used to carry data in the index. Each index may be split into multiple shards, and the multiple shards may be distributed to different nodes. This can effectively increase the data storage capacity of the index. Each shard may be a Lucene instance. For example, as shown in Figure 1, an index may be split into a total of five shards, namely, shard S1 to shard S5. Shard S1 and shard S3 are distributed to node 1, shard S2 and shard S4 are distributed to node 2, and shard S5 is distributed to node 3.

[0050] Replica: A replica is obtained by replicating a shard and is a backup of the shard. Each shard may have one or more replicas, and each replica and its corresponding shard are distributed to different nodes. For example, as shown in FIG. 1, shards S1 to S5 each have one replica, and the replicas of shards S1 to S5 are replicas R1 to R5, respectively. Replicas R1 and R3 are distributed to node 3, replicas R2 and R4 are distributed to node 1, and replica R5 is distributed to node 2.

[0051] Since the data stored in the replica is the same as the data stored in the shard, and the replica can process data query requests, i.e., provide data query services, the throughput of the data query can be effectively increased and high availability can be achieved. In a scenario in which a replica is created for a shard, the shard may also be called a primary shard, and the replica may also be called a replica shard.

[0052] FIG. 2 is a diagram of an application scenario of the resource scheduling method for an ES cluster according to an embodiment of the present application. As shown in FIG. 2, the application scenario includes an ES cluster and an application hosting component. Furthermore, the application scenario may be divided into a management plane and a data plane. The management plane of the ES cluster may include a master node, a client node, and a request cache. The master node is configured to maintain the status of the ES cluster, for example, to create and delete indexes. The client node is mainly responsible for storing data and processing data index requests and data read requests of applications (also called clients). It will be understood that the master node may also have the function of a client node. The request cache is used to cache data index requests and data read requests. The data index request is used to request to write data to an index and may also be called a data write request. The data read request is used to request to read data in an index and may also be called a data query request.

[0053] The data plane of the ES cluster may include a reader cluster and a writer cluster. The reader cluster has a total of N nodes (node ​​N r1 to node N rN ), where N is an integer greater than 1. One or more replicas of the index may be distributed to each node of the reader cluster, which may be used to process data read requests. The writer cluster may include a total of M nodes (nodes N w1 to node N wM), where M is an integer greater than 1. One or more shards of the index may be distributed to each node of the writer cluster, and the writer cluster may be used to process data write requests. In other words, when data needs to be written to the index, the data may be written only to the shards distributed to the writer cluster, and the shards of the writer cluster synchronize the data to one or more replicas of the reader cluster. When data is read from the index (data is queried), the data may be read only from the replicas distributed to the reader cluster. In this way, data read / write splitting may be implemented. This effectively improves the efficiency of data read / write.

[0054] The application hosting component may also be referred to as a smart cloud APP elastic engine (Scase) service component, which may provide global application hosting services. As also shown in FIG. 2, the application hosting component may include a global scheduling component and an application queue management component located in the management plane, and a client proxy component, an application gateway (AGW), an application autoscale service (AASS) component, and a server software development kit (SDK) located in the data plane. In the application scenario shown in FIG. 2, each shard of the writer cluster and each replica of the reader cluster may be hosted by a search process (also called a Lucene process or application process). The search process integrates the server SDK. The functions of the components of the application hosting component are as follows:

[0055] Server SDK: The Server SDK is used to control starting or stopping the search process and to report monitoring data for the search service, which may include the amount of reads / writes per second, the status of the search process, the amount of threads involved in the search process, etc.

[0056] Application Queue Management Component: The application queue management component is responsible for hosting the search processes and managing the queue size of the search processes.

[0057] AGW: The AGW is used to control the search process, for example to collect monitoring data collected by the server SDK and deliver control instructions to the server SDK to enable the server SDK to control starting and stopping the search process as well as migration of shards or replicas.

[0058] AASS component: The AASS component monitors the traffic of the search process (including the amount of data written and the amount of requests to read data) and adjusts the application metrics and underlying resources of the cluster to implement application-driven elastic services.

[0059] Client proxy component: The client proxy component is used to execute distribution control of data write requests and data read requests, i.e., to distribute data write requests to each node of the writer cluster and distribute data read requests to each node of the reader cluster.

[0060] Global Scheduling Component: The global scheduling component provides a global resource view of the resource pool and determines the combination mode of nodes in the ES cluster based on the node specifications of the available nodes in the resource pool and according to a pre-configured policy (e.g., cost-first policy).

[0061] As also shown in Figure 2, the application scenario may further include a storage service component, for example an object storage service (OBS) component, which is used to perform data synchronization between shards and replicas.

[0062] An embodiment of the present application provides a resource scheduling method for an ES cluster. The ES cluster includes a plurality of first nodes, and a plurality of shards of a target index are distributed to the plurality of first nodes. At least one shard of the target index may be distributed to each of the first nodes. It will be understood that the ES cluster may be responsible for at least one index, and the target index may be any one of the at least one index. Furthermore, it will be understood that the plurality of shards of the target index may all be primary shards, and the plurality of first nodes may form a writer cluster of the target index. For example, the plurality of first nodes may be node N in FIG. 2 . w1 to node N wM may be also possible.

[0063] The method provided in the embodiment of the present application may be applied to a resource scheduling device. The resource scheduling device may be an application hosting component in the application scenario shown in Fig. 2. As shown in Fig. 3, the resource scheduling method includes the following steps:

[0064] Step 101: Calculate the data write rate of the target index.

[0065] In this embodiment of the present application, the resource scheduling device may calculate the data writing rate of the target index in real time or periodically. The data writing rate calculated by the resource scheduling device at each statistical moment may be the average data writing rate in the first target duration before that statistical moment, i.e., the ratio of the total amount of data received in the first target duration and required to be written to the target index to the first target duration. The unit of the data writing rate may be bits per second (bps).

[0066] Optionally, the resource scheduling device may collect statistics on an amount of data write requests for the target index received in the first target duration, and collect statistics on an amount of data to be written requested by each data write request. The resource scheduling device may accumulate the amount of data requested by the data write requests received in the first target duration to obtain a total amount of data received in the first target duration and that needs to be written to the target index. The resource scheduling device may then calculate a ratio of the total amount of data to the first target duration, and determine the ratio as a data write rate for the target index.

[0067] For example, if the resource scheduling apparatus is the application hosting component shown in Figure 2, the AGW or client proxy component may collect statistics regarding an amount of data write requests for the target index received in a first target duration and collect statistics regarding an amount of data to be written requested by each data write request. The AASS component may calculate a data write rate for the target index based on the data collected by the AGW or client proxy component.

[0068] Step 102: Adjust the amount of node resources occupied by the multiple shards when the data write rate of the target index falls outside the target rate range.

[0069] The resource scheduling device pre-stores a target rate range, and the target rate range may be a range of data write rates that can be currently supported by the target index. Since the target index is currently carried by the multiple first nodes, the target rate range may be understood as a range of data write rates that can be supported by the multiple first nodes. Furthermore, the target rate range may be determined based on the node specifications of the multiple first nodes.

[0070] The measurement index of the node specification may include at least the amount of processor cores included in the node. Alternatively, the measurement index may further include the memory size of the node. If the node has x processor cores and y gigabytes (G) of memory, the node specification of the node may be expressed as xUyG, where x and y are positive integers. U is an abbreviation of unit, which is a unit indicating the external size of the server, and may indicate the amount of processor cores in the embodiment of the present application.

[0071] It will be understood that a higher node specification of the first node indicates a higher maximum data write rate that can be supported by the first node, i.e., a better data write performance of the first node. Therefore, the resource scheduling device may determine a target rate range based on the node specifications of the multiple first nodes.

[0072] Optionally, the resource scheduling device may obtain a preset data write rate threshold s0 of each processor core, i.e., a single-core data write rate. Then, the target rate range may be determined based on the product of the data write rate threshold s0 and the total number m of processor cores included in the multiple first nodes. For example, the target rate range may be (s0×m)±Δs. Here, Δs is a fluctuation value of the preset write rate and may be a number equal to or greater than 0. The data write rate threshold s0 may be configured by an application (client) and may be obtained by testing the data write performance of a single processor core by the application.

[0073] For example, if the amount of resources that need to be occupied when a single search process of an application is executed is 1U4G and the maximum data write rate supported by the node when the single search process is executed on a 1U4G node is 2 Megabits per second (Mbps), the application may configure the data write rate threshold s0 of each processor core to be 2 Mbps. If the amount of resources that need to be occupied when a single search process of an application is executed is 2U8G and the maximum data write rate supported by the node when the single search process is executed on a 2U8G node is 2 Mbps, the application may configure the data write rate threshold s0 of each processor core to be 1 Mbps.

[0074] It is assumed that the data write rate threshold s0 of each processor core configured in the resource scheduling device is 2 Mbps. The ES cluster includes 10 first nodes, and each first node includes 4 processor cores, that is, the total amount m of processor cores included in the 10 first nodes is 40. Correspondingly, the resource scheduling device may determine that the target rate range is (80±Δs) Mbps. When the preset write rate fluctuation value Δs is 0, the target rate range may be equal to 80 Mbps.

[0075] When the data write rate of the target index falls outside the target rate range, the resource scheduling device may determine that the data write performance of the plurality of first nodes does not match the data write rate of the target index. When the data write rate of the target index is higher than the upper limit of the target rate range, the resource scheduling device may determine that the data write performance of the plurality of first nodes cannot support the current actual data write rate of the target index, i.e., data may be clogged and cannot be effectively written to the target index in time. When the data write rate of the target index is less than the lower limit of the target rate range, the resource scheduling device may determine that the data write performance of the plurality of first nodes is underutilized, i.e., the resource utilization of the ES cluster is low.

[0076] Based on this, the resource scheduling device may dynamically adjust the amount of resources occupied by the multiple shards of the target index, so that the amount of resources occupied by the multiple shards can match the current actual data writing rate of the target index. In this way, the data writing performance is high, and at the same time, the resource utilization of the ES cluster can be effectively improved, that is, an elastic policy based on the quality of service (QoS) of writing is implemented.

[0077] In a first optional implementation, the resource scheduling device may adjust an amount of nodes occupied by the multiple shards of the target index to adjust an amount of resources occupied by the multiple shards. In a second optional implementation, the resource scheduling device may adjust a node specification of at least one first node of the multiple first nodes to adjust an amount of resources occupied by the multiple shards.

[0078] The following uses the first implementation as an example to describe the implementation process of step 102. As shown in FIG. 4, step 102 may include the following steps:

[0079] Step 102a1: When the data write rate of the target index is higher than the upper limit of the target rate range, at least one second node is newly added to the ES cluster.

[0080] When the data write rate of the target index is higher than the upper limit of the target rate range, in order to increase the amount of resources occupied by the target index, the resource scheduling device may newly add at least one second node configured to carry a shard of the target index to the ES cluster.

[0081] In a first example, the resource scheduling device may determine the amount of at least one newly added second node based on the difference between the data write rate of the target index and the upper limit of the target rate range. The amount of the at least one second node is positively correlated with the difference. Furthermore, the node specification of each of the at least one second node is a preset specification, that is, the at least one second node has the same node specification. In the first example, the node specification of each of the newly added nodes is a preset specification. Therefore, the resource scheduling device may directly determine the amount of the at least one newly added second node based on the difference in the write rate. The method of newly adding the second node is simple and highly efficient.

[0082] In a first example, when the amount of processor cores in the preset specifications is m0, the amount of at least one second node to be newly added n1 is: n1≧(s1 - s2) / (s0×m0) Equation (1) may be satisfied.

[0083] Here, s1 is the data write rate of the target index, s2 is the upper limit of the target rate range, and s0 is the data write rate threshold of each processor core. Equation (1) may be modified to (n1×m0)≧(s1−s2) / s0, where (n1×m0) is the total amount of processor cores included in at least one second node.

[0084] In a second example, when the available nodes in a resource pool (e.g., a cloud platform) have multiple different candidate node specifications, the resource scheduling device may determine the amount of at least one newly added second node and the node specification of each second node based on the multiple candidate node specifications and the difference between the data write rate of the target index and the upper limit of the target rate range. The node specification of each second node is selected from the multiple candidate node specifications, and the node specifications of different second nodes may be the same or different. In the second example, the total amount m1 of processor cores included in the at least one newly added second node is: m1≧(s1 - s2) / s0 Equation (2) may be satisfied.

[0085] Optionally, the resource scheduling device may determine the quantity of at least one second node and the node specification of each second node based on the cost of the specification of each candidate node and according to a cost-first policy. In this way, the cost of newly added nodes can be effectively reduced while the data writing performance of the ES cluster is improved.

[0086] For example, the resource scheduling apparatus may first determine multiple node combination methods that can satisfy formula (2) from available nodes in a resource pool, where different node combination methods have different amounts of second nodes and / or different specifications of at least one second node. Then, the resource scheduling apparatus may select a node combination method with the lowest cost from the multiple node combination methods, and newly add at least one second node with the node combination method with the lowest cost.

[0087] It is assumed that the data write rate s1 of the target index is 100 Mbps, the upper limit s2 of the target rate range is 80 Mbps, and the data write rate threshold s0 of each processor core is 2 Mbps. The resource scheduling device may determine that the total amount m1 of processor cores included in at least one second node to be newly added must be 10 or more according to formula (2). If the node specification of each second node to be newly added is the preset specification 2U8G, that is, the amount m0 ​​of processor cores of each second node is 2, the resource scheduling device may newly add five second nodes of 2U8G to the ES cluster.

[0088] It is assumed that the available nodes in the resource pool have two candidate node specifications, 2U8G and 4U16G, and the cost of one node of 4U16G is lower than the cost of two nodes of 2U8G. The resource scheduling device may newly add two second nodes of 4U16G and one second node of 2U8G to the ES cluster according to the cost priority policy.

[0089] Optionally, if the available nodes in the resource pool include a node that uses spot resources, in step 102a1, the resource scheduling device may preferentially select the node that uses spot resources as the second node to be newly added, because the cost of spot resources is low. In other words, the resource used by at least one second node may be a spot resource. The node that uses spot resources may also be called a spot instance.

[0090] Step 102a2: Migrate at least one shard of the plurality of shards to at least one second node.

[0091] After the at least one second node is newly added to the ES cluster, the resource scheduling device may migrate at least one shard of the target index to the at least one second node, where each second node may bear one or more shards of the target index.

[0092] Optionally, at least one shard migrated by the resource scheduling device may satisfy at least one of the following conditions: an amount of data written to the shard is less than a first threshold, and a total amount of the shard distributed to the first node on which the shard is located is greater than a second threshold.

[0093] It may be known from the condition that the resource scheduling device may select a shard with a small amount of written data for migration, and / or select a shard in a first node with a large amount of shards for migration. In this way, the efficiency of shard migration can be effectively increased, the cost of migration can be reduced, and the amount of shards in all first nodes can be ensured to be balanced.

[0094] The first threshold and the second threshold may be pre-configured fixed values ​​in the resource scheduling device. Alternatively, the first threshold may be determined based on the amount of data written to each shard of the target index, for example, the average value or the lower quartile of the amount of data written to all shards of the target index. The second threshold may be determined based on the amount of shards in all first nodes, for example, the average value or the upper quartile of the amount of shards in all first nodes.

[0095] It will be understood that the resource scheduling apparatus may alternatively determine the at least one to-be-migrated shard in another manner, for example, the resource scheduling apparatus may randomly select the at least one to-be-migrated shard from the multiple shards of the target index.

[0096] It will be further understood that after determining the at least one shard to be migrated, the resource scheduling device may migrate the at least one shard to the at least one newly added second node according to a load balancing policy.

[0097] The following describes the implementation process of step 102a1 and step 102a2 by using an example in which the resource scheduling device is the application hosting component shown in FIG.

[0098] First, after detecting that the data write rate of the target index is higher than the upper limit of the target rate range, the AASS component may determine a scale-out policy. The scale-out policy includes an amount of at least one second node to be newly added and a node specification of each second node to be newly added. For example, the AASS component may determine the scale-out policy based on a difference between the data write rate and the upper limit of the target rate range. Alternatively, the AASS component may report the difference to a global scheduling component, and the global scheduling component may determine a scale-out policy based on the difference and multiple candidate node specifications in the resource pool, and deliver the scale-out policy to the AASS component.

[0099] Then, according to the scale-out policy, the AASS component can newly add at least one second node to the ES cluster and adjust the shard deployment policy, which may be a correspondence between each shard of the target index and the nodes on which the shard is distributed, i.e., a mapping relationship between shards and nodes.

[0100] For example, as shown in FIG. 5, it is assumed that the target index includes a total of four shards, i.e., shard S1 to shard S4, and the leader cluster used to serve the four shards includes a total of two first nodes, i.e., node 1 and node 2. Shard S1 and shard S3 are distributed to node 1, and shard S2 and shard S4 are distributed to node 2. If the AASS component determines that the data write rate of the target index is higher than the upper limit of the target rate range, a total of two second nodes, i.e., node 3 and node 4, may be newly added to the leader cluster. Furthermore, the AASS component may adjust the deployment policy of the shards as follows: shard S3 is deployed to node 3, and shard S4 is deployed to node 4.

[0101] Further, the client proxy component may interconnect with the AASS component in real time to obtain the service status of the newly added second nodes and synchronize the deployment policies of the shards. After determining that the service statuses of all the newly added second nodes are ready, the client proxy component may migrate at least one shard to the at least one newly added second node according to the deployment policies of the shards. For example, as shown in FIG. 6, the client proxy component may migrate shard S3 to node 3 and migrate shard S4 to node 4.

[0102] After completing the migration of the shards, the client proxy component further needs to update the distribution policy and distribute the data write requests according to the updated distribution policy. The distribution policy is a policy that distributes the data write requests to each node configured to bear the target index. For example, as shown in FIG. 6, before migrating shards S3 and S4, the client proxy component may distribute the data write requests to nodes 1 and 2 according to the distribution policy. Furthermore, it can be known from FIG. 6 that in the process of migrating shards S3 and S4, the client proxy component does not distribute the data write requests to nodes 3 and 4. As shown in FIG. 7, after completing the migration of shards S3 and S4, the client proxy component may distribute the data write requests to nodes 1, 2, 3, and 4 according to the updated distribution policy.

[0103] In the scale-out process described above, adding at least one new second node takes approximately 3 to 5 minutes, and performing shard migration and traffic switching takes approximately 1 minute.

[0104] 8 is a flow chart of a method for scaling in an ES cluster according to an embodiment of the present application. As shown in FIG. 8, step 102 may alternatively include the following steps:

[0105] Step 102b1: Determine at least one first target node to be removed from the multiple first nodes when the data writing rate of the target index is less than the lower limit of a target rate range.

[0106] When the data write rate of the target index is less than the lower limit of the target rate range, in order to improve resource utilization of the ES cluster and reduce the cost of the ES cluster, the resource scheduling device may determine at least one first target node to be removed from the multiple first nodes.

[0107] Optionally, the total amount of shards distributed to each first target node may be less than a third threshold. In other words, the resource scheduling device may remove a first node with a small amount of shards. In this way, it can be ensured that the shards in the at least one first target node can be quickly migrated to another first node before the at least one first target node is removed.

[0108] The third threshold may be a fixed value preconfigured in the resource scheduling device. Alternatively, the third threshold may be determined based on the amount of shards in all the first nodes, for example, the average value or the lower quartile of the amount of shards in all the first nodes.

[0109] In a first example, when the node specification of each first node in the ES cluster is a preset specification, the resource scheduling device may determine an amount of at least one first target node to be deleted based on a difference between the data writing rate of the target index and the lower limit of the target rate range, and the amount of the at least one first target node is positively correlated with the difference.

[0110] When the amount of processor cores in the preset specifications is m0, the amount n2 of at least one first target node to be deleted may satisfy the following formula (3): n2≦(s3−s1) / (s0×m0).

[0111] Here, s1 is the data write rate of the target index, s3 is the lower limit of the target rate range, and s0 is the data write rate threshold of each processor core. Equation (3) may be modified to (n2×m0)≦(s3−s1) / s0, where (n2×m0) is the total amount of processor cores included in at least one first target node.

[0112] It will be understood that the lower limit s3 of the target rate range may be less than the upper limit s2 of the target rate range, or the lower limit s3 of the target rate range may be equal to the upper limit s2, i.e., the target rate range may be a rate threshold.

[0113] In a second example, when the node specifications of all the first nodes are not completely the same, the resource scheduling device may determine at least one first target node to be deleted based on the node specifications of all the first nodes and the difference between the data write rate of the target index and the lower limit of the target rate range. Furthermore, the total amount m2 of the processor cores included in the at least one first target node may satisfy m2≦(s3−s1) / s0 Equation (4).

[0114] Optionally, in a second example, the resource scheduling device may further determine at least one first target node to be removed based on the cost of the first node of a different node specification according to a cost priority policy, so as to effectively reduce the cost of the ES cluster.

[0115] For example, the resource scheduling apparatus may first determine a plurality of node combination methods that can satisfy formula (4), where different node combination methods have different amounts of first nodes and / or different specifications of at least one first node. Then, the resource scheduling apparatus may select a node combination method with the highest cost from the plurality of node combination methods, and determine the node combination method with the highest cost as a combination method of at least one first target node to be deleted.

[0116] Step 102b2: Migrate all shards distributed to the at least one first target node to a first node other than the at least one first target node.

[0117] After determining the at least one first target node to be removed, the resource scheduling apparatus may migrate all shards distributed to the at least one first target node to a first node other than the at least one first target node. For example, the resource scheduling apparatus may migrate the shards according to a load balancing policy to ensure that the amounts of the shards in all first nodes other than the at least one first target node are balanced after the shards are migrated.

[0118] Step 102b3: Delete at least one first target node.

[0119] After completing the migration of the shard, the resource scheduling device may delete at least one first target node. In this way, the capacity of the ES cluster can be effectively reduced, that is, the ES cluster is scaled in to effectively reduce the cost of the ES cluster.

[0120] The following describes the implementation process of steps 102b1 to 102b3 by using an example where the resource scheduling device is the application hosting component shown in FIG.

[0121] First, after detecting that the data write rate of the target index is less than the lower limit of the target rate range, the AASS component may determine a scale-in policy. The scale-in policy includes at least one first target node to be removed and a deployment policy of the shards in the at least one first target node. Then, as shown in FIG. 9, the AASS component may send a node removal notification to the client proxy component to indicate to the client proxy component to initiate a removal procedure. After receiving the node removal notification, the client proxy component may synchronize the scale-in policy of the AASS component and migrate each shard in the at least one first target node to another first node according to the scale-in policy. For example, as shown in FIG. 10, the client proxy component may migrate shard S3 in node 3 to node 1 and shard S4 in node 4 to node 2.

[0122] After completing the migration of the shards, the client proxy component may terminate the service flows of node 3 and node 4. Furthermore, the client proxy component may notify the AASS component that the at least one first target node may be deleted. The AASS component may monitor the service status of the at least one first target node by using the AGW. After determining that the data and processes in the at least one first target node are deleted, the AASS component may delete the at least one first target node. For example, as shown in FIG. 10 and FIG. 11, the AASS component may delete node 3 and node 4.

[0123] It will be understood that in this embodiment of the present application, the AASS component may directly call the interface of an elastic computer service (ECS) or an autoscaling service (AS) of the ES cluster to newly add a second node or delete the first target node. Since a deletion script may be executed in the process of deleting a node by calling the interface of the ECS, the ECS may execute a deletion callback preset in the server SDK to delete the data and processes in the first target node. The AGW may update the service status of the node by using the server SDK. The service status includes the status of the processes and the amount of sessions in the node. After determining that the data and processes in the node are deleted by monitoring the AGW, the AASS component calls the interface of the ECS to automatically delete the first target node. Alternatively, the AGW may call a delete function to delete the data and processes in the first target node. After the data and processes in the node are deleted, the interface of the ECS is called to delete the first target node.

[0124] The following describes the implementation process of step 102 by using the aforementioned second implementation (adjusting the node specification of at least one first node among multiple first nodes occupied by the target index) as an example.

[0125] In a second implementation, the multiple first nodes in the ES cluster may all use a serverless architecture. When detecting that the data write rate of the target index falls outside the target rate range, the resource scheduling device may adjust the node specification of at least one first node among the multiple first nodes. In other words, the resource scheduling device can dynamically adjust the node specification of the at least one first node to adjust the amount of resources occupied by the target index without needing to adjust the amount of nodes used to carry the target index and without needing to migrate shards of the target index.

[0126] As described above, the measurement index of the node specification may include at least the amount of processor cores of the node. In this manner, the adjustment of the node specification of the second target node by the resource scheduling device may be to adjust the amount of processor cores included in the second target node. If the measurement index of the node specification further includes the memory size of the node, the adjustment of the node specification of the second target node may be to adjust the memory size and the amount of processor cores included in the second target node.

[0127] In a second implementation, when the resource scheduling device determines that the data write rate of the target index is higher than an upper limit of the target rate range, the node specification of at least one second target node among the multiple first nodes may be increased.

[0128] The total amount of shards distributed to each second target node may be greater than the fourth threshold. In other words, the resource scheduling device may increase the node specification of the first node with a large amount of shards. The fourth threshold may be a fixed value preconfigured in the resource scheduling device. Alternatively, the fourth threshold may be determined based on the amount of shards in all the first nodes, and may be, for example, the average value or the upper quartile of the amount of shards in all the first nodes.

[0129] It will be understood that the at least one second target node may alternatively be determined in another manner. For example, the resource scheduling apparatus may randomly select the at least one second target node from the plurality of first nodes. Alternatively, the resource scheduling apparatus may determine all of the plurality of first nodes as the second target nodes, i.e., the resource scheduling apparatus may increase the node specification of each first node.

[0130] In a second implementation, when the resource scheduling device determines that the data write rate of the target index is less than a lower limit of the target rate range, the node specifications of at least one third target node among the multiple first nodes may be reduced.

[0131] The total amount of shards distributed to each third target node may be less than a fifth threshold. In other words, the resource scheduling device may reduce the node specification of the first node with a small amount of shards. The fifth threshold may be a fixed value preconfigured in the resource scheduling device. Alternatively, the fifth threshold may be determined based on the amount of shards in all the first nodes, and may be, for example, the average value or the lower quartile of the amount of shards in all the first nodes.

[0132] It will be understood that the at least one third target node may alternatively be determined in another manner. For example, the resource scheduling apparatus may randomly select the at least one third target node from the plurality of first nodes. Alternatively, the resource scheduling apparatus may determine all of the plurality of first nodes as the third target node, i.e., the resource scheduling apparatus may reduce the node specification of each first node.

[0133] It will be further understood that the resource scheduling device may adjust the node specification of at least one second target node (or at least one third target node) based on the data writing rate s1 of the target index. In addition, the total amount m3 of processor cores included in the multiple first nodes whose node specifications are adjusted may satisfy m3≧s1 / s0 (5).

[0134] For example, it is assumed that the data write rate threshold s0 of each processor core is 2 Mbps, and the ES cluster includes 10 first nodes with a node specification of 4U16G. In this way, the total amount of processor cores included in the 10 first nodes is 40. If the data write rate s1 of the target index is 100 Mbps, the resource scheduling device may determine according to formula (5) that the requirement of the data write rate s1 of the target index can be met only when the total amount of processor cores included in the 10 first nodes is equal to or greater than 50. Based on this, the resource scheduling device may adjust the node specifications of three first nodes in the ES cluster from 4U16G to 8U32G. In this case, the total amount m3 of processor cores included in the multiple first nodes whose node specifications are adjusted is 52.

[0135] When the data write rate s1 of the target index is 40 Mbps, the resource scheduling device may determine, according to formula (5), that the requirement of the data write rate s1 of the target index can be met when the total amount of processor cores included in the 10 first nodes is equal to or greater than 20. Based on this, the resource scheduling device may adjust the node specifications of the 10 first nodes in the ES cluster from 4U16G to 2U8G. In this case, the total amount m3 of processor cores included in the multiple first nodes whose node specifications are adjusted is 20.

[0136] Optionally, when detecting that the data write rate of the target index falls outside the target rate range, the resource scheduling device may adjust the amount of resources occupied by the multiple shards of the target index in either the first implementation or the second implementation. Alternatively, the resource scheduling device may combine the two implementations to adjust the amount of resources occupied by the multiple shards of the target index. In other words, the resource scheduling device may adjust the amount of nodes used to carry the target index and adjust the node specifications of at least one first node.

[0137] In this embodiment of the present application, a correspondence relationship between node specifications and node performance may be pre-configured in the resource scheduling device, and the node performance corresponding to different node specifications is recorded in the correspondence relationship. The node performance may be represented by using the following parameters: the amount of shards that can be carried by the node and the maximum data write rate supported by the node. When detecting that the data write rate of the target index is out of the target rate range, based on the correspondence relationship, the resource scheduling device may determine the node specification of the second node to be newly added and / or adjust the node specification of the first node.

[0138] It should be understood that for search processes (including index processes and read processes) of different types of applications, the amount of resources required by a node to execute the search process is different. For example, the amount of resources required to execute a single search process of application 1 may be 1U2G, and the amount of resources required to execute a single search process of application 2 may be 2U4G. Based on this, for each type of application, a correspondence relationship related to the type of application may be configured in the resource scheduling device, and the performance of the node in the correspondence relationship may be obtained by testing the type of application.

[0139] For example, the correspondence associated with a certain type of application and configured in the resource scheduling device may be shown in Table 1. As shown in Table 1, a node with a node specification of 2U8G can carry one shard, and the maximum data write rate supported by the node is 4Mbps. A node with a node specification of 8U32G can also carry one shard, but the maximum data write rate supported by the node can reach 16Mbps.

[0140] [Table 1]

[0141] As shown in FIG. 12, it is assumed that the resource scheduling device adjusts the node specifications of node 1 and node 2 in the ES cluster to 32U, newly adds node 3 and node 4 with node specifications of 4U to the ES cluster, migrates shard S3 to node 3, and migrates shard S4 to node 4. With reference to Table 1, it can be known that the maximum data write rate supported by node 1 and node 2 is 64Mbps, respectively, and the maximum data write rate supported by node 3 and node 4 is 8Mbps, respectively. The total data write rate supported by the four nodes can reach 144Mbps.

[0142] Optionally, the resource used by the fourth target node among the plurality of first nodes may be a spot resource, which is a resource with a low cost (price) and varies according to supply and demand.

[0143] In a first possible example, the resource scheduling device may purchase a spot resource of a fixed duration for a specific time period (e.g., overnight) to use the spot resource as a resource for the fourth target node. When the execution duration of the spot resource reaches the fixed duration, the spot resource is automatically released, i.e., the spot resource is reclaimed by the resource pool.

[0144] In a second possible example, the resource scheduling device may purchase a spot resource based on a preset target price and use the spot resource as a resource of the fourth target node. If the target price is higher than the market price of the spot resource and the resource pool has sufficient resources, the ES cluster can continuously occupy the spot resource. If the target price is lower than the market price of the spot resource or the resource pool has no resource inventory, the resource pool will send a pre-warning notification to the resource scheduling device and automatically release (reclaim) the spot resource after a certain duration.

[0145] 13 is another flow chart of a resource scheduling method according to this embodiment of the present application. As shown in FIG. 13, the resource scheduling method may further include the following steps:

[0146] Step 103: When the remaining available duration of the spot resource used by the fourth target node is less than the duration threshold, newly add at least one third node into the ES cluster.

[0147] When the remaining available duration of the spot resource is less than the duration threshold, the resource scheduling device may newly add at least one third node to the ES cluster (e.g., the writer cluster) so that the shards in the fourth target node are migrated to the at least one third node. The duration threshold may be longer than the duration required to migrate the shards in the fourth target node. In this way, it may be ensured that the migration of the shards in the fourth target node can be completed before the spot resource used by the fourth target node is released to avoid impact on the service.

[0148] Optionally, the resources used by the at least one third node newly added by the resource scheduling apparatus may include on-demand resources and / or spot resources. For example, the resource scheduling apparatus may select on-demand resources and / or spot resources from a resource pool as resources used by the at least one third node according to a cost-first policy. The on-demand resources are resources purchased based on service requirements, and the cost of the on-demand resources is higher than the cost of the spot resources.

[0149] In a first example, when the resource scheduling device purchases spot resources based on a fixed duration, the resource scheduling device may monitor the remaining available duration of the spot resources used by the fourth target node in real time. The remaining available duration may be equal to the difference between the fixed duration and the used duration of the spot resources. When the remaining available duration is less than a duration threshold preconfigured in the resource scheduling device, the resource scheduling device may newly add at least one third node to the ES cluster.

[0150] For example, if the fixed duration of the spot resource purchased by the resource scheduling device for the fourth target node is 2 hours and the duration threshold is 20 minutes, the resource scheduling device may newly add at least one third node to the ES cluster when the used duration of the spot resource reaches 1 hour and 40 minutes. If the target index is used to store live streaming log data, the live streaming log data is generally packaged, uploaded and indexed in the ES cluster with a granularity of 5 minutes, so that the migration process of the shard is started when the remaining available duration of the spot resource is 20 minutes, and ample migration time is reserved for the shard. This can prevent the impact on service performance.

[0151] When the resource scheduling device purchases the spot resource based on the target price, when receiving the advance warning notification sent by the resource pool, the resource scheduling device may determine that the remaining available duration of the spot resource is less than a duration threshold, and may newly add at least one third node to the ES cluster. The duration threshold may be a reserved duration from the time when the resource pool sends the advance warning notification to the time when the spot resource is automatically released.

[0152] It should be understood that when at least one third node is newly added to the ES cluster, the resource scheduling device may determine the amount of at least one third node to be newly added and the specification of each third node according to the data writing rate of the target index. For example, the total amount of processor cores included in at least one third node and the first node other than the fourth target node in the ES cluster may satisfy formula (5).

[0153] Step 104: Migrate each shard in the fourth target node to at least one third node.

[0154] In this embodiment of the present application, after newly adding at least one third node, the resource scheduling apparatus may migrate each shard in the fourth target node to at least one third node. For example, the resource scheduling apparatus may migrate the shard to at least one third node according to a load balancing policy. For the implementation process of step 104, please refer to the implementation process of step 102a2 and step 102b2. Details will not be described again in this specification.

[0155] Step 105: Delete the fourth goal node.

[0156] When the migration of the shard is completed and the remaining available duration of the spot resource used by the fourth target node is zero, the resource scheduling device may delete the fourth target node to release the spot resource used by the fourth target node. For the implementation process of step 105, please refer to the implementation process of step 102b3. The details will not be described again in this specification.

[0157] The following describes the implementation process of step 103 to step 105 by using an example in which the resource scheduling device is the application hosting component shown in FIG.

[0158] As shown in FIG. 14, when detecting that the remaining available duration of the spot resource used by the fourth target node (e.g., node 3 or node 4 in FIG. 14) is less than the duration threshold, the AASS component may determine a node replacement policy, where the node replacement policy includes an amount of at least one newly to be added third node and a node specification of each newly to be added third node. For example, the AASS component may report the node requirement information to the global scheduling component, and the global scheduling component may determine a node replacement policy based on the node requirement information and the multiple candidate node specifications, and deliver the node replacement policy to the AASS component. The node requirement information may indicate a total amount of processor cores to be newly added.

[0159] Then, according to the node replacement policy, the AASS component may newly add at least one third node to the ES cluster and adjust the deployment policies of the shards. For example, as shown in FIG. 15, the AASS component may newly add a total of two third nodes, namely, node 5 and node 6. In addition, the AASS component may adjust the deployment policies of the shards as follows: shard S3 is deployed to node 5, and shard S4 is deployed to node 6.

[0160] Further, the client proxy component may migrate at least one shard to at least one newly added third node according to the adjusted shard deployment policy. For example, as shown in FIG. 15, the client proxy component may migrate shard S3 in node 3 to node 5 and shard S4 in node 4 to node 6. When the remaining available duration of the spot resource used by node 3 or node 4 is zero, the AASS component may remove node 3 or node 4, as shown in FIG. 16.

[0161] From the above analysis, it can be known that in the method provided in this embodiment of the present application, the amount of resources occupied by multiple shards of a target index can be adjusted to implement flexible adjustment of data writing performance of the target index, that is, the writing elasticity of an ES cluster can be implemented. Based on this, the solution provided in this embodiment of the present application can be applied to a scenario in which a large amount of written data is stored and the amount of written data fluctuates greatly over time. For example, the target index can be used to store media log data and transaction data of a transaction system. The media log data may include live streaming log data, on-demand log data, etc.

[0162] The above is explained by using an example in which the resource scheduling device adjusts the amount of resources occupied by multiple shards of a target index based on the data writing rate of the target index. In this embodiment of the present application, the ES cluster may alternatively include multiple fourth nodes, and the target index may further include multiple replicas, and the multiple replicas are carried by the multiple fourth nodes. The multiple fourth nodes may form a leader cluster of the target index. For example, the multiple fourth nodes may be the node N in FIG.r1 to node N rN The resource scheduling device may further flexibly adjust the amount of replicas included in the target index according to the data reading frequency of the target index, so as to implement the reading elasticity of the ES cluster. As also shown in Figure 13, the resource scheduling method provided in this embodiment of the present application may further include the following steps.

[0163] Step 106: Calculate the data read frequency of the target index.

[0164] In this embodiment of the present application, the resource scheduling device may calculate the data read frequency of the target index in real time or periodically. The data read frequency may be the amount of data read requests received in a unit time for the target index. Optionally, the data read frequency calculated by the resource scheduling device at each statistical instant may be the ratio of the amount of data read requests received in a second target duration that ends before the statistical instant to the second target duration. For example, if the unit of the statistics of the second target duration is seconds, the data read frequency may be queries per second (QPS).

[0165] The second target duration may be equal to or different from the first target duration for collecting the data writing rate, for example, the second target duration and the first target duration may each be 5 minutes.

[0166] Step 107: When the data read frequency of the target index is out of the target frequency range, the amount of replicas included in the target index is adjusted.

[0167] Each replica in a target index is obtained by replicating a shard of the target index, i.e., the data stored in each replica is the same as the data stored in the shard corresponding to the replica. Furthermore, the amount of replicas of different shards of the target index may be the same or different.

[0168] It will be understood that replicas of a target index may provide data query services, and a larger amount of replicas included in the target index indicates a higher maximum data read frequency supported by the target index. In this embodiment of the present application, the resource scheduling device pre-stores a target frequency range, and the target frequency range may be determined based on the amount of replicas currently included in the target index.

[0169] Furthermore, it will be understood that when a document (a document is the smallest unit for storing data) is stored in a target index, the identity of the target shard used to store the document needs to be calculated based on the amount of shards included in the target index. For example, the identity of the target shard, shard_num, may be calculated according to the following formula: shard_num = hash (routing) %num_primary_shards Formula (6)

[0170] Here, hash denotes a hash operation, routing denotes a preset routing key, and num_primary_shards is the amount of shards included in the target index. When a document is read from the target index, the identity of the target shard in which the document is stored also needs to be determined according to formula (6). From the above analysis, it can be known that in order to ensure accurate data query, the amount of shards included in the target index cannot be modified after the target index is created.

[0171] Since the amount of shards included in the target index cannot be adjusted, and the amount of replicas may be flexibly adjusted, a larger amount of replicas included in the target index indicates a higher maximum data read frequency that can be supported by the target index, that is, a better data read performance of the multiple fourth nodes. Furthermore, since the amount of replicas that can be carried by each fourth node in the ES cluster is positively correlated with the node specifications of the fourth nodes, in this embodiment of the present application, the target frequency range may be determined based on the node specifications of the multiple fourth nodes in the ES cluster.

[0172] There may be a common set between the plurality of fourth nodes and the plurality of first nodes, or the plurality of fourth nodes may be independent of the plurality of first nodes. For example, as shown in FIG. 2, when an ES cluster is deployed with separate read / write, the plurality of first nodes may be nodes of a writer cluster, and the plurality of fourth nodes may be nodes of a reader cluster.

[0173] Optionally, the resource scheduling device may obtain a preset data read frequency threshold r0 of each processor core, i.e., a single-core data read frequency. At that time, the target frequency range may be determined based on the product of the data read frequency threshold r0 and the total number m4 of processor cores included in the plurality of fourth nodes. For example, the target frequency range may be (r0×m4)±Δr. Here, Δr is a preset fluctuation value of the read rate, and may be a number equal to or greater than 0.

[0174] For example, it is assumed that the data read frequency threshold r0 of each processor core is 5 QPS, and the ES cluster includes 10 fourth nodes of 4U16G. In this way, the total amount m4 of processor cores included in the 10 fourth nodes is 40. Correspondingly, the resource scheduling device may determine that the target frequency range is (200±Δr) QPS. When the preset read rate fluctuation value Δr is 0, the target frequency range may be equal to 200 QPS.

[0175] When the data read frequency of the target index is out of the target frequency range, the resource scheduling apparatus may determine that the data read performance of the plurality of fourth nodes does not match the data read frequency of the target index. When the data read frequency of the target index is higher than the upper limit of the target frequency range, the resource scheduling apparatus may determine that the data read performance of the plurality of fourth nodes cannot support the data read frequency. When the data read frequency of the target index is lower than the lower limit of the target frequency range, the resource scheduling apparatus may determine that the data read performance of the plurality of fourth nodes is not fully utilized, that is, the resource utilization of the ES cluster is low.

[0176] Based on this, the resource scheduling device may adjust the amount of replicas included in the target index, so that the amount of replicas included in the target index can be consistent with the data read frequency. In this way, the resource utilization of the ES cluster can be effectively improved while the data read performance is guaranteed.

[0177] In this embodiment of the present application, when the data reading frequency of the target index is higher than the upper limit of the target frequency range, the resource scheduling device may newly add at least one fifth node to the ES cluster, and may newly add at least one replica of the target index to each fifth node. The amount of the replica newly added to each fifth node may be positively correlated with the node specification of the fifth node. In other words, a higher node specification of the fifth node indicates a larger amount of the replica newly added to the fifth node.

[0178] In a first possible example, the node specification of the at least one fifth node is a preset specification. Correspondingly, the quantity of the at least one fifth node may be determined based on a difference between a data read frequency and an upper limit of a target frequency range, and the quantity of the at least one fifth node is positively correlated with the difference.

[0179] In the first example, when the amount of processor cores in the preset specifications is m0, the amount of at least one newly added fifth node, n3, is: n3≧(r1 - r2) / (r0×m0) Equation (7) may be satisfied.

[0180] Here, r1 is the data read frequency of the target index, r2 is the upper limit of the target frequency range, and r0 is the data read frequency threshold of each processor core. Equation (7) may be modified to (n3×m0)≧(r1−r2) / r0, where (n3×m0) is the total amount of processor cores included in at least one newly added fifth node.

[0181] It is assumed that the data read frequency threshold r0 of each processor core is 5 QPS, the upper limit r2 of the target frequency range is 200 QPS, and the node specification of each available node in the resource pool is 4U16G. Thus, m0 = 4. As shown in FIG. 17, if the AASS component detects that the data read frequency r1 of the target index is 210 QPS by using the AGW, the AASS component may determine a fifth node to be newly added, whose node specification is 4U16G, according to formula (7). Correspondingly, as shown in FIG. 17, the AASS component may newly add node 3 to the ES cluster and newly add a replica to node 3. The replica is hosted by the search process, and the search process is integrated with the server SDK.

[0182] In a second possible example, the available nodes in the resource pool have a plurality of different candidate node specifications. The resource scheduling device may determine the amount of at least one newly added fifth node and the node specification of each fifth node based on the plurality of different candidate node specifications and the difference between the data reading frequency and the upper limit of the target frequency range. The node specification of each fifth node is selected from the plurality of candidate node specifications, and the node specifications of different fifth nodes may be the same or different.

[0183] In a second example, the total number m5 of processor cores included in at least one fifth node is: m5≧(r1 - r2) / r0 Equation (8) may be satisfied.

[0184] Optionally, the resource scheduling device may determine the quantity of at least one fifth node and the node specification of each fifth node based on the cost of the specification of each candidate node and according to a cost-first policy. In this way, the cost of the newly added node can be reduced while ensuring that the data reading performance of the ES cluster is effectively improved.

[0185] In this embodiment of the present application, when the data reading frequency of the target index is less than the lower limit of the target frequency range, the resource scheduling apparatus may determine at least one fifth target node from the multiple fourth nodes, and may delete the replicas distributed to each fifth target node. Then, the resource scheduling apparatus may delete the at least one fifth target node.

[0186] At least one fifth target node may satisfy at least one of the following conditions: the amount of replicas distributed to the node is less than a sixth threshold, and the data read frequency of the node is less than a seventh threshold. In other words, the resource scheduling device may remove a fourth node with a small amount of shards and / or remove a fourth node with a small amount of received data read requests. The sixth threshold and the seventh threshold may be preconfigured fixed values ​​in the resource scheduling device. Alternatively, the sixth threshold may be determined based on the amount of replicas in all fourth nodes, for example, the average value or the lower quartile of the amount of replicas in all fourth nodes. The seventh threshold may be determined based on the data read frequency of all fourth nodes, for example, the average value or the lower quartile of the data read frequency of all fourth nodes.

[0187] FIG. 18 is a diagram of the data read frequency of the target index according to an embodiment of the present application. In FIG. 18, an example in which the target index is used to store media log data is used for explanation. In FIG. 18, the horizontal axis is time, the unit is time, and the vertical axis is data read frequency, the unit is times / minute. As shown in FIG. 18, it can be known that the overall data read frequency of the target index is low, and the peak value is about 7 times / minute. If the data read frequency supported by the fourth node in the ES cluster is 20QPS, good data read performance can be guaranteed.

[0188] FIG. 19 is a diagram of the data write frequency of a target index according to an embodiment of the present application. In FIG. 19, an example in which the target index is used to store media log data is used for explanation. In FIG. 19, the horizontal axis is time, the unit is time, and the vertical axis is the data write frequency, the unit is times / minute. As shown in FIG. 19, it can be known that the peak value of the data write frequency of the target index ranges from about 5,600 times / minute to 137,000 times / minute. Since the data write frequency of the target index is high, the data write rate of the target index is also high. In addition, it can be known from FIG. 19 that the data write rate of the target index fluctuates greatly over time. According to the solution provided in the embodiment of the present application, the amount of resources occupied by the target index can be dynamically adjusted based on the data write rate of the target index. Therefore, the dynamic elasticity of the data write performance can be implemented, and the resource utilization of the ES cluster is effectively improved while the data write performance is guaranteed.

[0189] It should be understood that the sequence of steps of the resource scheduling method for ES cluster provided in the embodiment of the present application may be appropriately adjusted based on the situation, or steps may be added or deleted correspondingly. For example, step 103 to step 105 may be deleted based on the situation, or step 106 and step 107 may be deleted based on the situation, or step 106 and step 107 may be performed before step 105, or step 103 to step 105 may be performed before step 102.

[0190] In conclusion, the embodiment of the present application provides a resource scheduling method for ES cluster. According to the method, the data write rate of a target index can be calculated, and when the data write rate falls outside the target rate range, the amount of resources of a node occupied by multiple shards of the target index can be dynamically adjusted. Since both the data storage capacity of the target index and the maximum data write rate supported by the target index are related to the amount of resources occupied by multiple shards, the method provided in this embodiment of the present application can dynamically adjust the data storage capacity and the maximum data write rate of the target index without changing the amount of shards included in the target index. In this way, the flexibility of data writing is effectively increased, and the utilization of cluster resources is effectively improved.

[0191] In addition, according to the method provided in this embodiment of the present application, the amount of replicas included in the target index may be more flexibly adjusted based on the data reading frequency of the target index. In this way, the read elasticity of the ES cluster is implemented. Furthermore, when a node is newly added to the ES cluster, the node specification of the newly added node and the type of resource used by the node may be flexibly selected. Therefore, the flexibility of newly adding a node can be effectively increased, and the cost of the newly added node can be reduced. For example, according to the test, in a scenario in which log data is stored in the target index, the elasticity of the writer cluster is implemented, and as a result, the cost of the ES cluster can be reduced by 50%. If the resource scheduling device can more flexibly select the node specification of the node and the type of resource used by the node based on the principle of cost priority, the cost of the ES cluster can be reduced by 70%.

[0192] An embodiment of the present application provides a resource scheduling apparatus for an ES cluster. The resource scheduling apparatus may be configured to implement a resource scheduling method for an ES cluster provided in the embodiment of the above method. The ES cluster includes a plurality of first nodes configured to bear a target index, and the target index includes a plurality of shards. The resource scheduling apparatus may be deployed on a cloud platform. For example, the resource scheduling apparatus may be an application hosting component illustrated in FIG. 2. As illustrated in FIG. 20, the resource scheduling apparatus includes: A statistics module 201 configured to calculate a data writing rate of a target index, where the implementation of the function of the statistics module 201 may refer to the relevant description of step 101; and an adjustment module 202 configured to adjust the amount of resources of a node occupied by multiple shards when the data write rate of a target index falls outside a target rate range, where the implementation of the function of the adjustment module 202 may refer to the relevant description of step 102.

[0193] Optionally, the coordination module 202 may be configured to add at least one second node to the ES cluster and migrate at least one shard among the plurality of shards to the at least one second node when the data write rate of the target index is higher than the upper limit of the target rate range. The implementation of the functions of the coordination module 202 may further refer to the relevant descriptions of steps 102a1 and 102a2.

[0194] In any implementation, the adjustment module 202 may be further configured to determine an amount of the at least one second node to be newly added to the ES cluster based on a difference between the data write rate of the target index and an upper limit of the target rate range, the amount being positively correlated with the difference, and the node specification of the at least one second node being a preset specification, before the at least one second node is newly added to the ES cluster.

[0195] In another optional implementation, the adjustment module 202 may be further configured to: determine, before the at least one second node is newly added to the ES cluster, an amount of the at least one second node to be newly added and a node specification of each second node based on a plurality of different candidate node specifications and a difference between the data write rate of the target index and the upper limit of the target rate range. The node specification of each second node is selected from the plurality of candidate node specifications.

[0196] Optionally, a total amount m1 of processor cores included in at least one second node satisfies m1≧(s1−s2) / s0, where s1 is a data write rate of a target index, s2 is an upper limit of a target rate range, and s0 is a data write rate threshold of each processor core.

[0197] Optionally, the resource used by the at least one second node is a spot resource.

[0198] Optionally, at least one shard satisfies at least one of the following conditions: an amount of data written to the shard is less than a first threshold, and a total amount of the shard distributed to the first node on which the shard is located is greater than a second threshold.

[0199] Optionally, the adjustment module 202 may be configured to determine at least one first target node to be removed from the multiple first nodes when the data write rate of the target index is less than a lower limit of a target rate range, migrate all shards distributed to the at least one first target node to a first node other than the at least one first target node, and remove the at least one first target node. The implementation of the functions of the adjustment module 202 may further refer to the relevant descriptions of steps 102b1 to 102b3.

[0200] Optionally, at least one first target node satisfies that a total amount of shards distributed to the node is less than a third threshold.

[0201] Optionally, the adjustment module 202 may be configured to adjust a node specification of at least one first node among the plurality of first nodes when the data write rate of the target index falls outside a target rate range.

[0202] Optionally, the adjustment module 202 may be configured to increase the node specifications of at least one second target node among the plurality of first nodes when the data write rate of the target index is higher than an upper limit of a target rate range, or decrease the node specifications of at least one third target node among the plurality of first nodes when the data write rate of the target index is less than a lower limit of the target rate range.

[0203] Optionally, the resource used by the fourth target node among the plurality of first nodes is a spot resource, and the coordination module 202 may be further configured to: newly add at least one third node to the ES cluster, migrate all shards distributed to the fourth target node to the at least one third node, and remove the fourth target node when the remaining available duration of the spot resource used by the fourth target node is less than a duration threshold. The implementation of the functions of the coordination module 202 may further refer to the relevant descriptions of steps 103 to 105.

[0204] Optionally, the resources used by the at least one third node include on-demand resources and / or spot resources.

[0205] Optionally, the ES cluster may further include a plurality of fourth nodes, and the plurality of fourth nodes are configured to carry a plurality of replicas of the target index. The statistics module 201 may further be configured to calculate the data read frequency of the target index. The implementation of the function of the statistics module 201 may further refer to the relevant description of step 106.

[0206] The adjustment module 202 may be further configured to adjust the amount of replicas included in the target index when the data reading frequency of the target index is out of the target frequency range. The implementation of the function of the adjustment module 202 may further refer to the relevant description of step 107.

[0207] Optionally, the adjustment module 202 may be configured to add at least one new fifth node to the ES cluster and add at least one new replica of the target index to each fifth node when the data retrieval frequency of the target index is higher than an upper limit of the target frequency range.

[0208] Optionally, the adjustment module 202 may be configured to delete replicas distributed to at least one fifth target node among the multiple fourth nodes and delete the at least one fifth target node when the data read frequency of the target index is less than a lower limit of the target frequency range.

[0209] It will be understood that when the resource scheduling device is the application hosting component shown in FIG. 2, the functionality of the statistics module 201 may be implemented by the server SDK, AGW, and AASS components, and the functionality of the coordination module 202 may be implemented by the AASS component, the client proxy component, and the global scheduling component.

[0210] In conclusion, the embodiment of the present application provides a resource scheduling device for an ES cluster. The device can calculate the data write rate of a target index, and when the data write rate falls outside the target rate range, can dynamically adjust the amount of resources of a node occupied by multiple shards of the target index. Since both the data storage capacity of the target index and the maximum data write rate supported by the target index are related to the amount of resources occupied by multiple shards, the device provided in this embodiment of the present application can dynamically adjust the data storage capacity and the maximum data write rate of the target index without changing the amount of shards included in the target index. In this way, the flexibility of data writing is effectively enhanced, and the utilization of cluster resources is effectively improved.

[0211] Those skilled in the art will clearly understand that for the purpose of simple and clear description, with regard to the specific working processes of the aforementioned resource scheduling apparatus and modules, reference may be made to the corresponding processes of the aforementioned method embodiments, and the details will not be described again in this specification.

[0212] It should be understood that all modules of the resource scheduling device (e.g., the statistics module 201 and the adjustment module 202) may be implemented by using software or by using hardware. For example, the following uses the statistics module 201 as an example to describe the implementation of the statistics module 201. Similarly, for the implementation of the adjustment module 202, please refer to the implementation of the statistics module 201.

[0213] A module is an example of a software functional unit, and the statistics module 201 may include code executed on a computing instance. The computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, there may be one or more computing instances. For example, the statistics module 201 may include code executed on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to execute the code may be distributed in the same region or may be distributed in different regions. Furthermore, the multiple hosts / virtual machines / containers used to execute the code may be distributed in the same availability zone (AZ) or may be distributed in different AZs. Each AZ includes one data center or multiple data centers that are geographically close to each other. Generally, one region may include multiple AZs.

[0214] Similarly, multiple hosts / virtual machines / containers used to run code may be distributed in the same virtual private cloud (VPC) or may be distributed across multiple VPCs. Generally, one VPC is configured in one region. For communication between two VPCs in the same region or between VPCs in different regions, a communication gateway needs to be configured in each VPC. The interconnection between VPCs is implemented through a communication gateway.

[0215] A module is used as an example of a hardware functional unit, and the statistics module 201 may include at least one computing device, such as a server. Alternatively, the statistics module 201 may be a device implemented by using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), etc. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0216] The computing devices included in the statistics module 201 may be distributed in the same region or may be distributed in different regions. The computing devices included in the statistics module 201 may be distributed in the same AZ or may be distributed in different AZs. Similarly, the computing devices included in the statistics module 201 may be distributed in the same VPC or may be distributed in multiple VPCs. The computing devices may be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.

[0217] It should be noted that in another embodiment, the statistics module 201 may be configured to perform any step of the aforementioned resource scheduling method, and the adjustment module 202 may also be configured to perform any step of the aforementioned resource scheduling method. The steps that the statistics module 201 and the adjustment module 202 are responsible for performing may be specified according to need. The statistics module 201 and the adjustment module 202 are respectively configured to perform different steps of the resource scheduling method to perform all the functions of the resource scheduling device.

[0218] Figure 21 is a diagram of a structure of a computing device according to an embodiment of the present application. As shown in Figure 21, the computing device may include a bus 2102, a processor 2104, a memory 2106, and a communication interface 2108. The processor 2104, the memory 2106, and the communication interface 2108 communicate with each other via the bus 2102. The computing device may be a server or a terminal device. It should be understood that the amount of the processor and memory of the computing device is not limited in the embodiment of the present application.

[0219] The bus 2102 may be a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, etc. A bus may be classified as an address bus, a data bus, a control bus, etc. For ease of representation, only one line is used for representation in FIG. 21, but this does not imply that there is only one bus or only one type of bus. The bus 2102 may include paths for transferring information between various components of a computing device (e.g., the memory 2106, the processor 2104, and the communication interface 2108).

[0220] The processor 2104 may include any one or more of a processor, such as a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).

[0221] The memory 2106 may include a volatile memory, such as a random access memory (RAM). The processor 2104 may further include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).

[0222] The memory 2106 stores executable program codes, and the processor 2104 executes the executable program codes to separately perform the functions of the statistics module and the adjustment module to perform the resource scheduling method provided in the above-mentioned method embodiments. In other words, the instructions used to perform the resource scheduling method are stored in the memory 2106.

[0223] The communications interface 2108 employs a transceiver module, such as, but not limited to, a network interface card or transceiver, to facilitate communications between the computing device and another device or communications network.

[0224] An embodiment of the present application further provides a cluster of computing devices. The cluster of computing devices includes at least one computing device. The computing device may be a server, for example, a central server, an edge server, or a local server of a local data center. In some embodiments, the computing device may alternatively be a terminal device, for example, a desktop computer, a notebook computer, or a smartphone.

[0225] As shown in Figure 22, the cluster of computing devices includes at least one computing device. The memory 2106 of one or more computing devices in the cluster of computing devices may store the same instructions used to perform the resource scheduling method.

[0226] In some possible implementations, the memory 2106 of one or more computing devices in the cluster of computing devices may separately store some of the instructions used to perform the resource scheduling method. In other words, a combination of one or more computing devices may jointly execute the instructions used to perform the resource scheduling method.

[0227] It should be noted that the memories 2106 of different computing devices in the cluster of computing devices may store different instructions that are respectively used to perform some functions of the resource scheduling apparatus. In other words, the instructions stored in the memories 2106 of the different computing devices may implement one or more functions of the statistics collection module and the adjustment module.

[0228] In some possible implementations, one or more computing devices in a cluster of computing devices may be connected through a network, which may be a wide area network, a local area network, or the like.

[0229] The embodiment of the present application further provides a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be housed by a computing device, or a data storage device, such as a data center, that includes one or more available media. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, or a magnetic tape), an optical medium (e.g., a DVD), a semiconductor medium (e.g., a solid-state drive), etc. The computer-readable storage medium includes instructions, and the instructions instruct the computing device to execute the resource scheduling method for an ES cluster provided in the embodiment of the method described above.

[0230] The embodiment of the present application further provides a computer program product including instructions. The computer program product may be a software or program product including instructions and may be executed on a computing device or stored in any available medium. When the computer program product is executed on at least one computing device, the at least one computing device is enabled to execute the resource scheduling method for ES cluster provided in the embodiment of the above method.

[0231] An embodiment of the present application further provides an elastic search system. The elastic search system can provide a cloud search service (CSS). The elastic search system may include an ES cluster as shown in FIG. 1 and a resource scheduling device configured to schedule resources of the ES cluster.

[0232] An ES cluster may include multiple nodes, which may be deployed in a read / write split or in a storage / computation split.

[0233] The resource scheduling device may be configured to implement the resource scheduling method for an ES cluster provided in the above method embodiment. For example, the resource scheduling device may be the application hosting component shown in Figure 2, and the structure of the resource scheduling device may refer to any one of Figures 20 to 22.

[0234] In the embodiments of the present application, the terms "first", "second" and "third" are used for explanatory purposes only and cannot be understood as indicating or suggesting relative importance. The term "and / or" in the present application indicates only an association relationship to describe related objects, and indicates that three relationships may exist. For example, A and / or B may indicate three cases: only A exists, both A and B exist, and only B exists. In addition, the character " / " in this specification generally indicates an "or" relationship between related objects.

[0235] Finally, it should be noted that the above embodiments are only intended to describe the technical solutions of the present invention, and are not intended to limit the present invention. Although the present invention has been described in detail in conjunction with the above embodiments, those skilled in the art must understand that, without departing from the protection scope of the technical solutions of the embodiments of the present invention, those skilled in the art may still make modifications to the technical solutions described in the above embodiments, or make equivalent replacements for some technical features of those technical solutions. [Explanation of symbols]

[0236] 201 Statistics Module 202 Adjustment Module 2102 Bus 2104 Processor 2106 Memory 2108 Communication Interface

Claims

1. A resource scheduling method for an ElasticSearch cluster, the ElasticSearch cluster including a plurality of first nodes, the plurality of first nodes being configured to carry a plurality of shards of a target index, the method comprising: calculating a data write rate for the target index; adjusting an amount of node resources occupied by the plurality of shards when the data write rate of the target index falls outside a target rate range; A method comprising:

2. adjusting an amount of node resources occupied by the plurality of shards when the data write rate of the target index falls outside a target rate range, adding at least one new second node to the ElasticSearch cluster when the data write rate of the target index is higher than an upper limit of the target rate range; migrating at least one shard among the plurality of shards to the at least one second node; 2. The method of claim 1, comprising:

3. Before adding at least one second node to the ElasticSearch cluster, determining an amount of the at least one newly added second node based on a difference between the data write rate of the target index and the upper limit of the target rate range; The method of claim 2 , wherein the amount is positively correlated with the difference and a node specification of the at least one second node is a pre-set specification.

4. Before adding at least one second node to the ElasticSearch cluster, determining an amount of the at least one newly added second node and a node specification of each second node based on a plurality of different candidate node specifications and a difference between the data write rate of the target index and the upper limit of the target rate range; Further comprising: The method of claim 2 , wherein the node specification of each second node is selected from the plurality of candidate node specifications.

5. The total number m1 of processor cores included in the at least one second node is m1 ≧ (s1 - s2) / s0 5. The method of claim 2, wherein s1 is the data write rate for the target index, s2 is the upper limit of the target rate range, and s0 is a data write rate threshold for each processor core.

6. The method according to claim 2 , wherein the resource used by the at least one second node is a spot resource.

7. The at least one shard satisfies the following condition: the amount of data written to the shard is less than a first threshold; and the total amount of shards distributed to the first node on which the shards are located is greater than a second threshold; The method according to any one of claims 2 to 6, wherein at least one of the following is satisfied:

8. adjusting an amount of node resources occupied by the plurality of shards when the data write rate of the target index falls outside a target rate range, determining at least one first target node to be removed from the plurality of first nodes when the data writing rate of the target index is less than a lower limit of the target rate range; Migrating all shards distributed to the at least one first target node to a first node other than the at least one first target node; deleting the at least one first target node; 2. The method of claim 1, comprising:

9. 9. The method of claim 8, wherein a total amount of shards distributed to each first target node is less than a third threshold.

10. adjusting an amount of node resources occupied by the plurality of shards when the data write rate of the target index falls outside a target rate range, adjusting a node specification of at least one first node among the plurality of first nodes when the data write rate of the target index falls outside the target rate range.

10. The method of any one of claims 1 to 9, comprising:

11. adjusting a node specification of at least one first node among the plurality of first nodes when the data write rate of the target index falls outside the target rate range; increasing a node specification of at least one second target node among the plurality of first nodes when the data write rate of the target index is higher than the upper limit of the target rate range. The method of claim 10, comprising:

12. adjusting a node specification of at least one second target node among the plurality of first nodes when the data write rate of the target index falls outside the target rate range; reducing a node specification of at least one third target node among the plurality of first nodes when the data write rate of the target index is less than the lower limit of the target rate range. The method of claim 10, comprising:

13. the resource used by a fourth target node among the plurality of first nodes is a spot resource, and the method further comprises: When the remaining available duration of the spot resource used by the fourth target node is less than a duration threshold, newly adding at least one third node to the ElasticSearch cluster; Migrating all shards distributed to the fourth target node to the at least one third node; deleting the fourth target node; 13. The method of any one of claims 1 to 12, further comprising:

14. The method of claim 13 , wherein the resources used by the at least one third node include on-demand resources and / or spot resources.

15. The ElasticSearch cluster further includes a plurality of fourth nodes, the plurality of fourth nodes being configured to carry a plurality of replicas of the target index, and the method further comprises: Calculating a data read frequency of the target index; adjusting the number of replicas included in the target index when the data read frequency of the target index falls outside a target frequency range; 15. The method of any one of claims 1 to 14, further comprising:

16. the step of adjusting the number of replicas included in the target index when the data read frequency of the target index falls outside a target frequency range, When the data read frequency of the target index is higher than an upper limit of the target frequency range, adding at least one fifth node to the ElasticSearch cluster; adding at least one new replica of the target index to each fifth node; 16. The method of claim 15, comprising:

17. the step of adjusting the number of replicas included in the target index when the data read frequency of the target index falls outside a target frequency range, When the data read frequency of the target index is less than a lower limit of the target frequency range, deleting replicas distributed to at least one fifth target node among the plurality of fourth nodes; deleting the at least one fifth target node; 16. The method of claim 15, comprising:

18. 1. A resource scheduling apparatus for an ElasticSearch cluster, the ElasticSearch cluster including a plurality of first nodes configured to carry a target index, the target index including a plurality of shards, the resource scheduling apparatus comprising: a calculation module configured to calculate a data write rate for the target index; an adjustment module configured to adjust an amount of node resources occupied by the plurality of shards when the data write rate of the target index falls outside a target rate range; A resource scheduling device comprising:

19. The adjustment module comprises: Adding at least one new second node to the ElasticSearch cluster when the data write rate of the target index is higher than an upper limit of the target rate range; migrating at least one shard among the plurality of shards to the at least one second node; The resource scheduling apparatus according to claim 18, configured to:

20. The adjustment module comprises: and determining an amount of the at least one newly added second node based on a difference between the data write rate of the target index and the upper limit of the target rate range; 20. The resource scheduling apparatus of claim 19, wherein the amount is positively correlated with the difference, and a node specification of the at least one second node is a pre-configured specification.

21. The adjustment module comprises: and determining an amount of the at least one newly added second node and a node specification of each second node based on a plurality of different candidate node specifications and a difference between the data write rate of the target index and the upper limit of the target rate range; 20. The resource scheduling apparatus of claim 19, wherein the node specification of each second node is selected from the plurality of candidate node specifications.

22. The total number m1 of processor cores included in the at least one second node is m1 ≧ (s1 - s2) / s0 22. The resource scheduling device according to claim 19, wherein s1 is the data write rate of the target index, s2 is the upper limit of the target rate range, and s0 is a data write rate threshold of each processor core.

23. 23. The resource scheduling apparatus according to any one of claims 19 to 22, wherein the resources used by the at least one second node are spot resources.

24. The at least one shard satisfies the following condition: the amount of data written to the shard is less than a first threshold; and the total amount of shards distributed to the first node on which the shards are located is greater than a second threshold; The resource scheduling device according to any one of claims 19 to 23, wherein at least one of the above is satisfied.

25. The adjustment module comprises: determining at least one first target node to be removed from the plurality of first nodes when the data write rate of the target index is less than a lower limit of the target rate range; Migrating all shards distributed to the at least one first target node to a first node other than the at least one first target node; deleting the at least one first target node; The resource scheduling apparatus according to claim 18, configured to:

26. The resource scheduling apparatus of claim 25, wherein a total amount of shards distributed to each first target node is less than a third threshold.

27. The adjustment module comprises:

27. The resource scheduling apparatus of claim 18, configured to adjust a node specification of at least one first node among the plurality of first nodes when the data writing rate of the target index falls outside the target rate range.

28. The adjustment module comprises:

28. The resource scheduling apparatus of claim 27, configured to increase a node specification of at least one second target node among the plurality of first nodes when the data write rate of the target index is higher than the upper limit of the target rate range.

29. The adjustment module comprises:

28. The resource scheduling apparatus of claim 27, configured to reduce a node specification of at least one third target node among the plurality of first nodes when the data writing rate of the target index is less than the lower limit of the target rate range.

30. The resource used by the fourth target node among the plurality of first nodes is a spot resource, and the coordination module: When the remaining available duration of the spot resource used by the fourth target node is less than a duration threshold, newly adding at least one third node to the ElasticSearch cluster; Migrating all shards distributed to the fourth target node to the at least one third node; deleting the fourth target node; 30. The resource scheduling apparatus of any one of claims 18 to 29, further configured to:

31. The resource scheduling apparatus of claim 30, wherein the resources used by the at least one third node include on-demand resources and / or spot resources.

32. The ElasticSearch cluster further includes a plurality of fourth nodes, the plurality of fourth nodes being configured to carry a plurality of replicas of the target index, and the apparatus is configured to: the calculation module is further configured to calculate a data read frequency of the target index; The adjustment module is further configured to adjust an amount of replicas included in the target index when the data read frequency of the target index falls outside a target frequency range.

32. The resource scheduling apparatus of claim 18, further comprising:

33. The adjustment module comprises: When the data read frequency of the target index is higher than an upper limit of the target frequency range, adding at least one fifth node to the ElasticSearch cluster; adding at least one replica of the target index to each fifth node; The resource scheduling apparatus of claim 32, configured to:

34. The adjustment module comprises: Removing replicas distributed to at least one fifth target node among the plurality of fourth nodes when the data read frequency of the target index is less than a lower limit of the target frequency range; deleting the at least one fifth target node; The resource scheduling apparatus of claim 32, configured to:

35. A cluster of computing devices including at least one computing device, each computing device including a processor and a memory; A cluster of computing devices, wherein the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device such that the cluster of computing devices performs the method of any one of claims 1 to 17.

36. 18. A computer readable storage medium storing computer program instructions which, when executed by a cluster of computing devices, cause the cluster of computing devices to perform a method according to any one of claims 1 to 17.

37. 18. A computer program product comprising instructions which, when executed by a cluster of computing devices, enable the cluster of computing devices to perform a method according to any one of claims 1 to 17.

38. An ElasticSearch system comprising an ElasticSearch cluster and a resource scheduling device for the ElasticSearch cluster, the resource scheduling device being configured to implement a method according to any one of claims 1 to 17.

Citation Information

Patent Citations

  • Access processing method and device, storage medium and program product

    CN113849273A

  • Cross Cluster Replication

    US20200201879A1