Resource scheduling method and apparatus for elastic search clusters, and system
The resource scheduling method in Elasticsearch clusters dynamically adjusts node resources and shard distribution to enhance data write flexibility and resource utilization, addressing the inflexibility of fixed shard numbers.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- HUAWEI CLOUD COMPUTING TECHNOLOGIES CO LTD
- Filing Date
- 2022-12-06
- Publication Date
- 2026-06-22
AI Technical Summary
Elasticsearch (ES) clusters face low flexibility in data writing due to fixed shard numbers in indices, limiting data storage capacity and write rate adjustments.
A resource scheduling method that dynamically adjusts node resources and shard distribution based on data write rates, allowing for flexible data storage capacity and write rate adjustments without changing shard numbers, using techniques like adding or removing nodes and adjusting node specifications.
Enhances data write flexibility and resource utilization in ES clusters by matching data write performance with actual rates, reducing costs, and optimizing resource allocation.
Smart Images

Figure 0007877491000002 
Figure 0007877491000003 
Figure 0007877491000004
Abstract
Description
Technical Field
[0001] This application claims the priority of Chinese Patent Application No. 202210510751.2, titled "DATA PROCESSING METHOD AND COMPUTER", filed on May 11, 2022, and Chinese Patent Application No. 202210764591.4, titled "RESOURCE SCHEDULING METHOD AND APPARATUS FOR ELASTIC-SEARCH CLUSTER AND SYSTEM", filed on June 29, 2022. These Chinese patent applications are hereby incorporated by reference in their entirety into this specification.
[0002] This application relates to the field of data storage technology, and particularly to a resource scheduling method and apparatus for an elasticsearch cluster, and a system.
Background Art
[0003] Elasticsearch (ES) is a distributed, highly scalable, and highly real-time data search engine that can provide data search services within a cluster. A cluster usually 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. The logical space (i.e., container) used to store documents is called an index. An index may be divided into multiple shards, and to increase the data storage capacity of the index and ensure high availability, at least one corresponding replica is created for each shard. Each shard and at least one corresponding replica are distributed across different nodes. When a document needs to be stored in an index, first, a target shard for storing the document must be calculated based on the document's identity (ID) and the number of shards in the index, and then the document may be stored in the target shard so that the target shard synchronizes the document with at least one corresponding replica of the target shard. When a document needs to be read from an index, the target shard in which the document is stored may be determined based on the document's ID and the number of shards in the index, and the document is read from the target shard.
[0005] Since the target shard needs to be calculated based on the number of shards included in the index, the number of shards included in the index must be fixed in order to store documents in the index and read documents from the index. In other words, once the index is created, the number of shards included in the index cannot be modified. As a result, there is little flexibility in data writing. [Overview of the Initiative] [Means for solving the problem]
[0006] This application provides a resource scheduling method and apparatus, as well as a system, for an ES cluster to solve the technical problem of low flexibility in data writing in an elastic search cluster.
[0007] According to a first embodiment, a resource scheduling method for an ES cluster is provided. The ES cluster includes a plurality of first nodes, which are configured to handle a plurality of shards of a target index. The method includes the steps of calculating the data write rate of the target index and adjusting the amount of node resources occupied by the plurality of shards of the target index when the data write rate of the target index falls outside the target rate range.
[0008] 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 solution provided in this application allows for the dynamic adjustment of the target index's data storage capacity and maximum data write rate without changing the number of shards included in the target index. In this way, data write flexibility is effectively increased and the utilization of cluster resources is effectively improved.
[0009] Optionally, when the data write rate of a target index falls outside the target rate range, the process of adjusting the amount of node resources occupied by multiple shards may include the steps of adding at least one second node to the ES cluster when the data write rate of the target index is higher than the upper limit of the target rate range, and migrating at least one shard from the multiple shards to at least one second node.
[0010] At least one second node is added to the ES cluster, thus enabling the ES cluster to scale out and increasing the amount of resources occupied by the target index. In this way, the data storage capacity and maximum data write rate of the target index can be effectively improved so that the data write performance of the target index can match the current actual data write rate.
[0011] Optionally, before at least one second node is newly added to the ES cluster, the method may further include the step of determining the amount of at least one second node to be newly added, based on the difference between the data write rate of the target index and the upper limit of the target rate range. The amount is positively correlated with the difference, and the node specification of at least one second node is a pre-configured specification.
[0012] In the solution provided in this application, at least one second node with pre-configured specifications may be added to the ES cluster based on the difference in write rates. The method for adding the second node is simple and efficient.
[0013] Optionally, before at least one second node is newly added to the ES cluster, the method may further include the step of determining the number of second nodes to be newly added and the node specifications of each second node, based on several different 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 specifications of each second node are selected from several candidate node specifications.
[0014] If the available nodes in the resource pool have multiple different node specifications, the solution provided in this application may determine at least one second node from among the available nodes of multiple different node specifications based on the difference in write rates. The method for adding the second node is flexible. For example, in the solution provided in this application, at least one second node may be determined based on the cost of each candidate node specification and according to a cost-prioritizing policy. In this way, the cost of the newly added node can be effectively reduced.
[0015] Optionally, the total number of processor cores m1 in at least one second node may satisfy m1 ≥ (s1 - s2) / s0, where 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 for each processor core.
[0016] According to the aforementioned formula, it can be guaranteed that, after at least one second node is added, the data write performance of the multiple first nodes and at least one second node configured to handle the target index may match the data write rate of the target index.
[0017] Optionally, resources used by at least one second node may be spot resources. Because spot resources are inexpensive, in the solution provided in this application, spot resources may be given preferential use as resources for newly added nodes.
[0018] Optionally, at least one shard may satisfy at least one of the following conditions: the amount of data written to the shard is less than a first threshold, and the total number of shards distributed on the first node where the shard resides is greater than a second threshold.
[0019] In the solution provided in this application, it can be seen from the conditions that shards with a small amount of written data may be selected for migration, and / or shards in a first node with a large number 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 it is ensured that the amount of shards in all first nodes is balanced.
[0020] Optionally, when the data write rate of a target index falls outside the target rate range, the process of adjusting the amount of resources on a node occupied by multiple shards may include the steps of determining which first target node should be removed from a group of first nodes when the data write rate of the target index is below the lower limit of the target rate range; migrating all shards distributed to at least one first target node to first nodes other than at least one first target node; and removing at least one first target node.
[0021] If the data write rate of the target index falls below 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 being fully utilized. Therefore, at least one first node is removed to reduce the capacity of the ES cluster in order 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 across each first target node is less than a third threshold. In other words, in the solution provided in this application, first nodes with a small number of shards may be removed. In this way, it can be ensured that shards within at least one first target node can be rapidly migrated to another first node before at least one first target node is removed.
[0023] Optionally, the process of adjusting the amount of node resources occupied by multiple shards when the data write rate of the target index falls outside the target rate range may include the step of adjusting the node specifications of at least one of the multiple first nodes when the data write rate of the target index falls outside the target rate range.
[0024] According to the solution provided in this application, in order to adjust the amount of resources occupied by the target index, without changing the first node to which the shard belongs, the node specifications of the first node can be dynamically adjusted.
[0025] Optionally, when the data writing rate of the target index is outside the target rate range, the process of adjusting the node specifications of at least one first node among the plurality of first nodes may include the step of increasing the node specifications of at least one second target node among the plurality of first nodes when the data writing rate of the target index is higher than the upper limit of the target rate range. At least one second target node may be a first node with a large amount of shards in the ES cluster.
[0026] Optionally, when the data writing rate of the target index is outside the target rate range, the process of adjusting the node specifications of at least one first node among the plurality of first nodes may include the step of reducing the node specifications 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. At least one third target node may be a first node with a small amount of shards in the ES cluster.
[0027] Optionally, the resources used by the fourth target node among the plurality of first nodes are spot resources. The method may further include the steps of newly adding at least one third node to the ES cluster when the remaining available duration of the spot resources used by the fourth target node is less than the duration threshold, migrating all the shards distributed to the fourth target node to at least one third node, and deleting the third target node.
[0028] Since spot resources are inexpensive, the solution provided in this application may use spot resources as resources for a fourth target node, and when the remaining usage duration of the spot resources is less than a duration threshold, shards in the fourth target node may be migrated in time to a newly added third node. In this way, the cost of the ES cluster can be effectively reduced while the data read / write performance of the ES cluster is guaranteed.
[0029] Optionally, the resources used by 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 types of resources used by at least one third node may be determined according to a cost-first policy.
[0030] Optionally, the ES cluster may further include multiple fourth nodes, each configured to handle multiple replicas of the target index. The method may further include the steps of calculating the data read frequency of the target index and adjusting the number of replicas included in the target index when the data read frequency of the target index falls outside the target frequency range.
[0031] In the solution provided in this application, the number of replicas included in the target index is adjusted so that the number of replicas included in the target index matches the data read frequency. In this way, resource utilization of the ES cluster can be effectively improved while data read performance is guaranteed.
[0032] Optionally, the process of adjusting the number of replicas included in the target index when the data read frequency of the target index falls outside the target frequency range may include the steps of adding at least one new fifth node to the ES cluster and adding at least one new replica of the target index to each of the fifth nodes when the data read frequency of the target index is higher than the upper limit of the target frequency range.
[0033] A fifth node is added to the ES cluster, along with at least one replica, so that the data read performance of the ES cluster can be effectively improved.
[0034] Optionally, the process of adjusting the number of replicas included in the target index when the data read frequency of the target index falls outside the target frequency range may include the steps of removing replicas distributed across at least one fifth target node among a plurality of fourth nodes, and removing at least one fifth target node, when the data read frequency of the target index is below the lower limit of the target frequency range.
[0035] If the data read frequency of the target index falls below 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 being fully utilized. Therefore, at least one fifth target node is removed to reduce the capacity of the ES cluster in order to effectively improve the resource utilization of the ES cluster and reduce the cost of the ES cluster.
[0036] According to a second embodiment, a resource scheduling device for an ES cluster is provided. The resource scheduling device may include at least one module, the at least one module may be configured to implement the resource scheduling method for an ES cluster according to the above embodiment.
[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 memory. The processor of at least one computing device is configured to execute instructions stored in the memory of at least one computing device so that the cluster of computing devices performs the resource scheduling method for the ES cluster according to the preceding aspects.
[0038] According to a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a cluster of computing devices, the cluster of computing devices performs a resource scheduling method for an ES cluster according to the preceding aspect.
[0039] According to a fifth aspect, a computer program product including instructions is provided. When the instructions are executed by a cluster of computing devices, the cluster of computing devices is enabled to perform a resource scheduling method for an ES cluster according to the preceding aspects.
[0040] According to a sixth aspect, an ES system is provided. The ES system includes an ES cluster and a resource scheduling device for the ES cluster, the resource scheduling device may be configured to implement a resource scheduling method for the ES cluster according to the preceding aspects.
[0041] In conclusion, this application provides a resource scheduling method and apparatus, as well as a system, for an elastic search cluster, which belongs to the field of data storage technology. According to the solution provided in this 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 node resources 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 solution provided in this application can dynamically adjust the data storage capacity and maximum data write rate of the target index without changing the number 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 explanation of the drawing]
[0042] [Figure 1] This is a diagram showing the structure of an ES cluster according to an embodiment of this application. [Figure 2] This is a diagram illustrating an application scenario of the resource scheduling method for an ES cluster according to an embodiment of this application. [Figure 3] This is a flowchart of a resource scheduling method for an ES cluster according to an embodiment of this application. [Figure 4] This is a flowchart illustrating a method for scaling out an ES cluster according to an embodiment of this application. [Figure 5] This figure shows a second node being added to the AASS component according to an embodiment of the present application. [Figure 6] This diagram shows how a client proxy component migrates shards according to an embodiment of this application. [Figure 7] This is a diagram of a scaled-out ES cluster according to an embodiment of this application. [Figure 8]This is a flowchart illustrating a method for scaling in an ES cluster according to an embodiment of this application. [Figure 9] This figure shows the client proxy component in which the AASS component initiates the deletion procedure according to the embodiment of this application. [Figure 10] This is another diagram illustrating shard migration by a client proxy component according to an embodiment of the present application. [Figure 11] This figure shows the removal of the first target node by the AASS component according to an embodiment of the present application. [Figure 12] This diagram shows the data writing performance of a first node with different node specifications according to an embodiment of this application. [Figure 13] This is another flowchart of a resource scheduling method for an ES cluster according to an embodiment of the present application. [Figure 14] This figure shows how a resource scheduling device determines a node replacement policy according to an embodiment of this application. [Figure 15] This figure shows the addition of a third node to the AASS component according to an embodiment of the present application. [Figure 16] This figure shows the removal of the fourth target node by the AASS component according to an embodiment of the present application. [Figure 17] This figure shows a fifth node being added to the AASS component according to an embodiment of the present application. [Figure 18] This figure shows the data read frequency of the target index according to the embodiment of this application. [Figure 19] This figure shows the data writing frequency of the target index according to the embodiment of this application. [Figure 20] This is a diagram showing the structure of a resource scheduling device for an ES cluster according to an embodiment of the present application. [Figure 21] This is a diagram showing the structure of a computing device according to an embodiment of this application. [Figure 22]This is a diagram showing the structure of a computing device cluster according to an embodiment of this application. [Modes for carrying out the invention]
[0043] The resource scheduling method, apparatus, and system for an ES cluster provided in the embodiments of this application will be described in detail below with reference to the attached drawings.
[0044] First, the following terms used in the embodiments of this application will be explained.
[0045] ES: ES is a decentralized, highly scalable, and highly real-time data search engine developed based on Lucene (a full-text search engine), capable of providing data retrieval services within a cluster.
[0046] ES Cluster: An ES cluster is a set of nodes that can independently provide search services. For example, as shown in Figure 1, an ES cluster may contain a total of three nodes, i.e., nodes 1 through 3.
[0047] Node: A node, sometimes called an ES server, ES instance, or compute instance, contains basic physical resources such as a processor, memory, and disk. 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 equivalent to a database.
[0049] Shards: Shards are obtained by dividing an index and are used to hold the data within the index. Each index may be divided into multiple shards, and these shards may be distributed across 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 divided into a total of five shards, i.e., shards S1 through S5. Shards S1 and S3 are distributed across node 1, shards S2 and S4 are distributed across node 2, and shard S5 is distributed across node 3.
[0050] Replicas: Replicas are obtained by duplicating shards and are backups of shards. Each shard may have one or more replicas, and each replica and the shard corresponding to the replica are distributed across different nodes. For example, as shown in Figure 1, shards S1 through S5 each have one replica, and the replicas of shards S1 through S5 are, in order, replicas R1 through R5. Replicas R1 and R3 are distributed across node 3, replicas R2 and R4 are distributed across node 1, and replica R5 is distributed across node 2.
[0051] The data stored in a replica is the same as the data stored in the shard, and the replica can process data query requests, i.e., it can provide a data query service, which can effectively increase data query throughput and achieve high availability. In a scenario where replicas are created for a shard, the shard may also be called the primary shard, and the replica may also be called the replica shard.
[0052] Figure 2 is a diagram illustrating an application scenario of the resource scheduling method for an ES cluster according to an embodiment of the present application. As shown in Figure 2, the application scenario includes an ES cluster and application hosting components. 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, client nodes, and a request cache. The master node is configured to maintain the status of the ES cluster, for example, by creating and deleting indexes. The client nodes are primarily responsible for storing data and processing data index requests and data read requests from applications (also called clients). It will be understood that the master node may also have the functionality of a client node. The request cache is used to cache data index requests and data read requests. A data index request is used to request that data be written to an index and may also be called a data write request. A data read request is used to request that data be read from an index and may also be called a data query request.
[0053] The data plane of an ES cluster may include a reader cluster and a writer cluster. The reader cluster has a total of N nodes (node N). r1 From node N rN ) include, where N is an integer greater than 1. One or more replicas of the index may be distributed across each node of the reader cluster, and the reader cluster may be used to process data read requests. The writer cluster has a total of M nodes (nodes N). w1 From node N wM) is included, where M is an integer greater than 1. One or more shards of the index may be distributed across each node of a 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 across 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 across the reader cluster. In this way, data read / write partitioning can be implemented, which effectively improves the efficiency of data read / write operations.
[0054] The application hosting component may also be called the smart cloud APP elastic engine (Scase) service component, which can provide global application hosting services. As shown in Figure 2, the application hosting component may also include a global scheduling component and an application queue management component located in the management plane, and a client proxy component, application gateway (AGW), application autoscale service (AASS) component, and server software development kit (SDK) located in the data plane. In the application scenario shown in Figure 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 with 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 the start or stop of the search process and to report monitoring data for the search service. Monitoring data may include the amount of reads / writes per second, the status of the search process, and the number of threads involved in the search process.
[0056] Application Queue Management Component: The application queue management component is responsible for hosting the search process and managing the queue size for the search process.
[0057] AGW: AGW is used to control the search process, for example, by collecting monitoring data gathered by the Server SDK and delivering control commands to the Server SDK, enabling the Server SDK to control the start and stop of the search process as well as the 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 data read requests), and adjusts the cluster's application metrics and underlying resources to implement an application-driven elastic service.
[0059] Client proxy component: The client proxy component is used to control the distribution of data write and data read requests, that is, to distribute data write requests to each node in the writer cluster and data read requests to each node in 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 priority policy).
[0061] As shown in Figure 2, application scenarios may also include storage service components, such as object storage service (OBS) components. Storage service components are used to perform data synchronization between shards and replicas.
[0062] Embodiments of this application provide 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 among the plurality of first nodes. At least one shard of the target index may be distributed among 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 at least one index. Furthermore, it will be understood that all of the plurality of shards of the target index may 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 Figure 2. w1 From node N wM That's fine.
[0063] The method provided in the embodiments of this 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 Figure 2. As shown in Figure 3, the resource scheduling method includes the following steps:
[0064] Step 101: Calculate the data write rate for the target index.
[0065] In this embodiment of the present application, the resource scheduling device may calculate the data write rate of the target index in real time or periodically. The data write rate calculated by the resource scheduling device at each statistical moment may be the average data write rate in the first target duration preceding that statistical moment, i.e., the ratio of the total amount of data received in the first target duration and to be written to the target index to the first target duration. The unit of the data write rate may be bits per second (bps).
[0066] Optionally, the resource scheduling device may collect statistics on the amount of data write requests received for the target index during a first target duration, and statistics on the amount of data written requested by each data write request. The resource scheduling device may accumulate the amount of data requested by the data write requests received during the first target duration to obtain the total amount of data that needs to be received and written to the target index during the first target duration. The resource scheduling device may then calculate the ratio of the total amount of data to the first target duration and determine this ratio as the data write rate for the target index.
[0067] For example, if the resource scheduling device is the application hosting component shown in Figure 2, the AGW or client proxy component may collect statistics on the amount of data write requests received for the target index during the first target duration, and statistics on the amount of data written requested by each data write request. The AASS component may calculate the data write rate for the target index based on the data collected by the AGW or client proxy component.
[0068] Step 102: When the data write rate of the target index falls outside the target rate range, adjust the amount of node resources occupied by multiple shards.
[0069] The resource scheduling device pre-stores a target rate range, which may be the range of data write rates currently supported by the target index. Since the target index is currently supported by multiple first nodes, the target rate range may be understood as the range of data write rates supported by multiple first nodes. Furthermore, the target rate range may be determined based on the node specifications of the multiple first nodes.
[0070] The node specification metric may include, at a minimum, the number of processor cores contained in the node. Alternatively, the metric may further include the node's memory size. If a 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 stands for unit, a unit indicating the external size of the server, and in embodiments of this application may indicate the number of processor cores.
[0071] It will be understood that higher node specifications for the first node indicate a higher maximum data write rate that the first node can support, i.e., better data write performance for the first node. Therefore, the resource scheduling device may determine the target rate range based on the node specifications of multiple first nodes.
[0072] Optionally, the resource scheduling device may obtain a preset data write rate threshold s0 for each processor core, i.e., the single-core data write rate. In this case, 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, where Δs is a preset write rate fluctuation value and may be a number greater than or equal to 0. The data write rate threshold s0 may be configured by the application (client) and may be obtained by the application by testing the data write performance of a single processor core.
[0073] For example, if the amount of resources that need to be occupied when a single search process of an application is running is 1U4G, and the maximum data write rate supported by a node when a single search process is running on a 1U4G node is 2 megabits per second (Mbps), the application may configure the data write rate threshold s0 for each processor core to 2 Mbps. If the amount of resources that need to be occupied when a single search process of an application is running is 2U8G, and the maximum data write rate supported by a node when a single search process is running on a 2U8G node is 2 Mbps, the application may configure the data write rate threshold s0 for each processor core to 1 Mbps.
[0074] It is assumed that the data write rate threshold s0 for each processor core configured in the resource scheduling device is 2 Mbps. The ES cluster includes 10 first nodes, each first node containing 4 processor cores, i.e., the total number of processor cores m included in the 10 first nodes is 40. Accordingly, the resource scheduling device may determine that the target rate range is (80 ± Δs) Mbps. If 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 multiple first nodes does not match the data write rate of the target index. If 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 multiple first nodes cannot support the current actual data write rate of the target index, i.e., data may get stuck and may not be effectively written to the target index in time. If the data write rate of the target index is below the lower limit of the target rate range, the resource scheduling device may determine that the data write performance of the multiple first nodes is not being fully utilized, 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 multiple shards of the target index so that the amount of resources occupied by multiple shards matches the current actual data write rate of the target index. In this way, it is possible to achieve high data write performance while effectively improving the resource utilization of the ES cluster, that is, an elastic policy based on the quality of service (QoS) of writes is implemented.
[0077] In the first optional implementation, the resource scheduling device may adjust the number of nodes occupied by multiple shards of the target index in order to adjust the amount of resources occupied by multiple shards. In the second optional implementation, the resource scheduling device may adjust the node specifications of at least one of multiple first nodes in order to adjust the amount of resources occupied by multiple shards.
[0078] The following describes the process of performing step 102, using the first implementation as an example. As shown in Figure 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, add at least one second node 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, the resource scheduling device may add at least one second node to the ES cluster configured to handle shards of the target index in order to increase the amount of resources occupied by the target index.
[0081] In the first example, the resource scheduling device may determine the amount of at least one new second node to be added 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 at least one second node is positively correlated with the difference. Furthermore, the node specifications of each of the at least one second node are pre-configured specifications, i.e., at least one second node has the same node specifications. In the first example, the node specifications of each node to be added are pre-configured specifications. Therefore, the resource scheduling device may directly determine the amount of at least one new second node to be added based on the write rate difference. The method of adding a second node is simple and efficient.
[0082] In the first example, if the number of processor cores in the pre-configured specifications is m0, the number of second nodes to be added, n1, is n1≧(s1 - s2) / (s0×m0) Equation (1) This may be the case.
[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 for each processor core. Equation (1) can also be transformed to (n1 × m0) ≥ (s1 - s2) / s0, where (n1 × m0) is the total number of processor cores included in at least one second node.
[0084] In the second example, if 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 number of at least one new second node to be added and the node specifications 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 specifications of each second node are 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 number of processor cores m1 included in at least one new second node is: m1≧(s1 - s2) / s0 Equation (2) This may be the case.
[0085] Optionally, the resource scheduling device may determine the quantity of at least one second node and the node specifications of each second node based on the cost of the specifications of each candidate node and in accordance with a cost priority policy. In this way, the cost of newly added nodes can be effectively reduced while improving the data write performance of the ES cluster.
[0086] For example, a resource scheduling device may first determine several node combination methods from the available nodes in the resource pool that satisfy equation (2), where different node combination methods have different quantities of second nodes and / or different specifications for at least one second node. Then, the resource scheduling device may select the node combination method with the lowest cost from the multiple node combination methods and add at least one new second node to the node combination method with the lowest cost.
[0087] Assume that the target index data write rate s1 is 100 Mbps, the upper limit s2 of the target rate range is 80 Mbps, and the data write rate threshold s0 for each processor core is 2 Mbps. The resource scheduling device may determine, according to equation (2), that the total number of processor cores m1 in at least one newly added second node must be 10 or more. If the node specification of each newly added second node is a pre-configured specification 2U8G, i.e., the number of processor cores m0 in each second node is 2, the resource scheduling device may add five 2U8G second nodes to the ES cluster.
[0088] Assume that the available nodes in the resource pool have two candidate node specifications, 2U8G and 4U16G, and that the cost of one 4U16G node is lower than the cost of two 2U8G nodes. The resource scheduling device may add two second 4U16G nodes and one second 2U8G node to the ES cluster according to a cost priority policy.
[0089] Optionally, if the available nodes in the resource pool include nodes that use spot resources, the resource scheduling device may, in step 102a1, preferentially select the nodes that use spot resources as the second node to be added, because spot resources have a lower cost. In other words, the resources used by at least one second node may be spot resources. Nodes that use spot resources may also be called spot instances.
[0090] Step 102a2: Migrate at least one shard from the multiple shards to at least one second node.
[0091] After adding at least one second node to the ES cluster, the resource scheduling device may migrate at least one shard of the target index to at least one second node. Each second node may be responsible for one or more shards of the target index.
[0092] Optionally, at least one shard that is migrated by the resource scheduling device may satisfy at least one of the following conditions: the amount of data written to the shard is less than a first threshold, and the total number of shards distributed on the first node where the shard resides is greater than a second threshold.
[0093] It can be seen from the conditions that the resource scheduling device may select shards with a small amount of written data for migration, and / or select shards in the 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 it can be ensured that the amount of shards in all first nodes is balanced.
[0094] The first and second thresholds may be fixed values pre-configured 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 or 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 or upper quartile of the amount of shards in all first nodes.
[0095] It will be understood that the resource scheduling device may, alternatively, determine in another way which shards should be migrated. For example, the resource scheduling device may randomly select which shards should be migrated from among multiple shards of the target index.
[0096] Furthermore, it will be understood that, after determining at least one shard to be migrated, the resource scheduling device may migrate at least one shard to at least one newly added second node in accordance with the load balancing policy.
[0097] The following describes the implementation process of steps 102a1 and 102a2 using an example where the resource scheduling device is the application hosting component shown in Figure 2.
[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 the number of second nodes to be added (at least one) and the node specifications for each of the second nodes to be added. For example, the AASS component may determine the scale-out policy based on the difference between the data write rate and the upper limit of the target rate range. Alternatively, the AASS component may report the difference to the global scheduling component, which may then determine a scale-out policy based on the difference and the specifications of several candidate nodes 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 add at least one second node to the ES cluster and adjust the shard deployment policy. The shard deployment policy may also be a correspondence between each shard of the target index and the node to which the shard is distributed, i.e., a mapping relationship between shards and nodes.
[0100] For example, as shown in Figure 5, the target index is assumed to contain a total of four shards, namely shards S1 through S4, and the leader cluster used to support the four shards is assumed to contain a total of two first nodes, namely node 1 and node 2. Shards S1 and S3 are distributed to node 1, and shards S2 and 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, namely node 3 and node 4, may be added to the leader cluster. Furthermore, the AASS component may adjust the shard deployment policy as follows, namely that shard S3 is deployed to node 3 and shard S4 is deployed to node 4.
[0101] Furthermore, the client proxy component may interconnect with the AASS component in real time to obtain the service status of the newly added second node and synchronize the shard deployment policy. After determining that the service status of all newly added second nodes is ready, the client proxy component may migrate at least one shard to at least one newly added second node according to the shard deployment policy. For example, as shown in Figure 6, the client proxy component may migrate shard S3 to node 3 and shard S4 to node 4.
[0102] After completing the shard migration, the client proxy component must further update its distribution policy and distribute data write requests according to the updated distribution policy. The distribution policy is a policy that distributes data write requests to each node configured to be responsible for the target index. For example, as shown in Figure 6, before migrating shards S3 and S4, the client proxy component may distribute data write requests to nodes 1 and 2 according to the distribution policy. Furthermore, from Figure 6, it can be seen that during the process of migrating shards S3 and S4, the client proxy component does not distribute data write requests to nodes 3 and 4. As shown in Figure 7, after completing the migration of shards S3 and S4, the client proxy component may distribute data write requests to nodes 1, 2, 3, and 4 according to the updated distribution policy.
[0103] In the aforementioned scale-out process, adding at least one second node takes approximately 3 to 5 minutes, while performing shard migration and traffic switching takes approximately 1 minute.
[0104] Figure 8 is a flowchart of a method for scaling in an ES cluster according to an embodiment of the present application. As shown in Figure 8, step 102 may alternatively include the following steps.
[0105] Step 102b1: Determine which first target node should be removed from a group of first nodes when the data write rate of the target index is below the lower limit of the target rate range.
[0106] When the data write rate of the target index is below the lower limit of the target rate range, the resource scheduling device may determine which first target node should be removed from a plurality of first nodes in order to improve resource utilization of the ES cluster and reduce the cost of the ES cluster.
[0107] Optionally, the total amount of shards distributed across each first target node may be less than a third threshold. In other words, the resource scheduling device may remove first nodes with a small number of shards. In this way, it can be ensured that shards within at least one first target node can be quickly migrated to another first node before at least one first target node is removed.
[0108] The third threshold may be a predetermined value pre-configured in the resource scheduling device. Alternatively, the third threshold may be determined based on the amount of shards in all first nodes, for example, the average value or lower quartile of the amount of shards in all first nodes.
[0109] In the first example, if the node specifications of each first node in the ES cluster are pre-configured, the resource scheduling device may determine the amount of at least one first target node to be removed based on the difference between the data write rate of the target index and the lower limit of the target rate range. The amount of at least one first target node is positively correlated with the difference.
[0110] If the number of processor cores in the pre-configured specifications is m0, then the number of first target nodes n2 that should be removed may satisfy the equation (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 for each processor core. Equation (3) may also be transformed into (n2 × m0) ≤ (s3 - s1) / s0, where (n2 × m0) is the total number 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, that is, the target rate range may be the rate threshold.
[0113] In the second example, if the node specifications of all first nodes are not exactly the same, the resource scheduling device may determine at least one first target node to be removed based on the node specifications of all 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 number of processor cores m2 included in at least one first target node may satisfy equation (4) m2 ≤ (s3 - s1) / s0.
[0114] Optionally, in the second example, the resource scheduling device may further determine, in accordance with a cost priority policy, at least one first target node to be removed based on the cost of the first nodes with different node specifications, in order to effectively reduce the cost of the ES cluster.
[0115] For example, the resource scheduling device may first determine several node combination methods that satisfy equation (4), where different node combination methods have different quantities of first nodes and / or different specifications for at least one first node. Then, the resource scheduling device may select the node combination method with the highest cost from the multiple node combination methods and determine the node combination method with the highest cost as the combination method for at least one first target node to be removed.
[0116] Step 102b2: Migrate all shards distributed across at least one first target node to at least one first node other than the first target node.
[0117] After determining at least one first target node to be removed, the resource scheduling device may migrate all shards distributed to at least one first target node to at least one first node other than the first target node. For example, the resource scheduling device may migrate shards according to a load balancing policy to ensure that the amount of shards in all first nodes except at least one first target node is balanced after the shard migration.
[0118] Step 102b3: Delete at least one first target node.
[0119] After completing the shard migration, the resource scheduling device may remove at least one first target node. In this way, the capacity of the ES cluster can be effectively reduced, i.e., the ES cluster can be scaled in to effectively reduce the cost of the ES cluster.
[0120] The following describes the implementation process of steps 102b1 to 102b3, using the example where the resource scheduling device is the application hosting component shown in Figure 2.
[0121] First, after detecting that the data write rate of the target index is below 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 deleted and a deployment policy for the shards within at least one first target node. Then, as shown in Figure 9, the AASS component may send a node deletion notification to the client proxy component to instruct it to begin the deletion procedure. After receiving the node deletion notification, the client proxy component may synchronize the scale-in policy of the AASS component and migrate each shard within at least one first target node to another first node according to the scale-in policy. For example, as shown in Figure 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 shard migration, the client proxy component may terminate the service flows for nodes 3 and 4. Furthermore, the client proxy component may notify the AASS component that at least one first target node may be deleted. The AASS component may monitor the service status of at least one first target node using AGW. After determining that data and processes within at least one first target node have been deleted, the AASS component may delete at least one first target node. For example, as shown in Figures 10 and 11, the AASS component may delete nodes 3 and 4.
[0123] In this embodiment of the present application, it will be understood that the AASS component may directly call the Elastic Computer Service (ECS) or Autoscaling Service (AS) interface of the ES cluster to add a second node or delete a first target node. Since a delete script may be executed in the process of deleting a node by calling the ECS interface, the ECS may delete the data and processes in the first target node by executing a delete callback pre-configured in the Server SDK. The AGW may update the service status of a node by using the Server SDK. The service status includes the status of processes and the number of sessions in the node. After determining, by monitoring the AGW, that the data and processes in the node have been deleted, the AASS component calls the ECS interface 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 have been deleted, the ECS interface is called to delete the first target node.
[0124] The process of implementing step 102 is described below using the aforementioned second implementation (adjusting the node specification of at least one first node among the multiple first nodes occupied by the target index) as an example.
[0125] In the second implementation, all of the multiple first nodes in the ES cluster may use a serverless architecture. When the data write rate of the target index is detected to be outside the target rate range, the resource scheduling device may adjust the node specifications of at least one of the multiple first nodes. In other words, the resource scheduling device does not need to adjust the number of nodes used to handle the target index, does not need to migrate the shards of the target index, and can dynamically adjust the node specifications of at least one first node to adjust the amount of resources occupied by the target index.
[0126] As described above, the node specification metrics may include at least the number of processor cores in the node. Thus, when the resource scheduling device adjusts the node specification of a second target node, it may mean adjusting the number of processor cores in the second target node. If the node specification metrics further include the memory size of the node, then adjusting the node specification of a second target node may mean adjusting both the memory size and the number of processor cores in the second target node.
[0127] In the second implementation, if the resource scheduling device determines that the data write rate of the target index is higher than the 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 number of shards distributed across each second target node may exceed the fourth threshold. In other words, the resource scheduling device may increase the node specifications of first nodes that have a large number of shards. The fourth threshold may be a fixed value pre-configured in the resource scheduling device. Alternatively, the fourth threshold may be determined based on the number of shards in all first nodes, for example, the average value or upper quartile of the number of shards in all first nodes.
[0129] It will be understood that at least one second target node may be determined alternatively in another way. For example, the resource scheduling device may randomly select at least one second target node from a plurality of first nodes. Alternatively, the resource scheduling device may determine all of the plurality of first nodes as second target nodes, that is, the resource scheduling device may increase the node specifications of each first node.
[0130] In the second implementation, if the resource scheduling device determines that the data write rate of the target index is below the 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 across each third target node may be less than the fifth threshold. In other words, the resource scheduling device may reduce the node specifications of first nodes with a small number of shards. The fifth threshold may be a fixed value pre-configured in the resource scheduling device. Alternatively, the fifth threshold may be determined based on the amount of shards in all first nodes, for example, the average or lower quartile of the amount of shards in all first nodes.
[0132] It will be understood that at least one third target node may be determined alternatively in another way. For example, the resource scheduling device may randomly select at least one third target node from a plurality of first nodes. Alternatively, the resource scheduling device may determine all of the plurality of first nodes as the third target node, that is, the resource scheduling device may reduce the node specification of each first node.
[0133] Furthermore, it will be understood that the resource scheduling device may adjust the node specifications of at least one second target node (or at least one third target node) based on the data write rate s1 of the target index. In addition, the total number of processor cores m3 included in the multiple first nodes whose node specifications are adjusted may satisfy equation (5) m3 ≥ s1 / s0.
[0134] For example, suppose the data write rate threshold s0 for 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 number of processor cores included in the 10 first nodes is 40. If the data write rate s1 for the target index is 100 Mbps, the resource scheduling device may determine, according to equation (5), that the requirement for the data write rate s1 for the target index can only be met if the total number of processor cores included in the 10 first nodes is 50 or more. 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 number of processor cores m3 included in the multiple first nodes whose node specifications are adjusted is 52.
[0135] If the target index data write rate s1 is 40 Mbps, the resource scheduling device may determine, according to equation (5), that the requirement for the target index data write rate s1 can be met when the total number of processor cores in the 10 first nodes is 20 or more. 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 number of processor cores m3 in the multiple first nodes whose node specifications are adjusted is 20.
[0136] Optionally, when 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 multiple shards of the target index in either the first or second implementation. Alternatively, the resource scheduling device may combine the two implementations to adjust the amount of resources occupied by multiple shards of the target index. In other words, the resource scheduling device may adjust the number of nodes used to handle the target index and adjust the node specifications of at least one first node.
[0137] In this embodiment of the present application, a correspondence between node specifications and node performance may be pre-configured in the resource scheduling device, and the performance of nodes corresponding to different node specifications is recorded in the correspondence. Node performance may be represented using the following parameters: the amount of shards that the node can handle and the maximum data write rate supported by the node. When the data write rate of a target index is detected to be outside the target rate range, the resource scheduling device may, based on the correspondence, determine the node specifications of a second node to be added and / or adjust the node specifications of the first node.
[0138] It will be understood that the amount of resources required by a node to run a search process (including indexing and reading processes) will differ for different types of applications. For example, the amount of resources required to run a single search process for application 1 may be 1U2G, while the amount of resources required to run a single search process for application 2 may be 2U4G. Based on this, for each type of application, a correspondence related to the application type may be configured in the resource scheduling device, and the performance of nodes within the correspondence may be obtained by testing the application type.
[0139] For example, the correspondences associated with a particular type of application and configured in the resource scheduling device may be shown in Table 1. As shown in Table 1, a node with the node specification 2U8G can host one shard, and the maximum data write rate supported by the node is 4Mbps. A node with the node specification 8U32G can also host one shard, but the maximum data write rate supported by the node can reach 16Mbps.
[0140] [Table 1]
[0141] As shown in Figure 12, it is assumed that the resource scheduling device adjusts the node specifications of nodes 1 and 2 in the ES cluster to 32U, adds nodes 3 and 4 with node specifications of 4U to the ES cluster, migrates shard S3 to node 3, and migrates shard S4 to node 4. Referring to Table 1, it can be seen that the maximum data write rates supported by nodes 1 and 2 are 64 Mbps each, and the maximum data write rates supported by nodes 3 and 4 are 8 Mbps each. The total data write rate supported by the four nodes could reach 144 Mbps.
[0142] Optionally, a resource used by a fourth target node among multiple first nodes may be a spot resource. Spot resources are low-cost resources whose availability fluctuates based on supply and demand.
[0143] In the first possible example, the resource scheduling device may purchase a spot resource for a fixed duration (e.g., overnight) for use as a resource for a fourth target node. When the execution duration of the spot resource reaches the fixed duration, the spot resource is automatically released, i.e., reclaimed by the resource pool.
[0144] In a second possible scenario, the resource scheduling device may purchase a spot resource based on a pre-set target price and use the spot resource as a resource for a 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 if the resource pool has no resource inventory, the resource pool sends a warning notification to the resource scheduling device and automatically releases (reclaims) the spot resource after a certain duration.
[0145] Figure 13 is another flowchart of the resource scheduling method according to this embodiment of the present application. As shown in Figure 13, the resource scheduling method may further include the following steps.
[0146] Step 103: Add at least one new third node to the ES cluster when the remaining available duration of the spot resources used by the fourth target node is less than the duration threshold.
[0147] When the remaining available duration of a spot resource is less than the duration threshold, the resource scheduling device may add at least one third node to the ES cluster (e.g., a writer cluster) so that shards in the fourth target node are migrated to 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 can be ensured that the migration of shards in the fourth target node is completed before the spot resources used by the fourth target node are released, thus avoiding impact on services.
[0148] Optionally, resources used by at least one third node newly added by the resource scheduling device may include on-demand resources and / or spot resources. For example, the resource scheduling device may, in accordance with a cost priority policy, select on-demand resources and / or spot resources from the resource pool as resources used by at least one third node. 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.
[0149] In the first example, if the resource scheduling device purchases spot resources based on a fixed duration, the resource scheduling device may monitor in real time the remaining available duration of the spot resources used by the fourth target node. The remaining available duration may be equal to the difference between the fixed duration of the spot resources and the duration used. When the remaining available duration is less than a duration threshold pre-configured by the resource scheduling device, the resource scheduling device may add at least one third node to the ES cluster.
[0150] For example, if a spot resource purchased by the resource scheduling device for a fourth target node has a fixed duration of 2 hours and a duration threshold of 20 minutes, the resource scheduling device may add at least one new third node to the ES cluster when the duration of use 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 at a granularity of 5 minutes, uploaded to the ES cluster, and indexed. Therefore, the shard migration process starts when the remaining available duration of the spot resource is 20 minutes, ensuring ample migration time for the shard. This can prevent an impact on service performance.
[0151] When a resource scheduling device purchases a spot resource based on a target price, upon receiving a pre-warning notice 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 add at least one third node to the ES cluster. The duration threshold may be the reserved duration from the time the resource pool sends the pre-warning notice until the spot resource is automatically released.
[0152] When adding at least one third node to an ES cluster, it will be understood that the resource scheduling device may determine the number of third nodes to be added and the specifications of each third node based on the data write rate of the target index. For example, the total number of processor cores included in at least one third node and the first nodes other than the fourth target node in the ES cluster may satisfy equation (5).
[0153] Step 104: Migrate each shard within the fourth target node to at least one third node.
[0154] In this embodiment of the present application, after adding at least one new third node, the resource scheduling device may migrate each shard in the fourth target node to at least one third node. For example, the resource scheduling device may migrate shards to at least one third node in accordance with a load balancing policy. For the process of implementing step 104, please refer to the implementation processes of steps 102a2 and 102b2. Further details are not described again herein.
[0155] Step 105: Delete the fourth target node.
[0156] When the shard migration is complete and the remaining available duration of the spot resources used by the fourth target node is zero, the resource scheduling device may delete the fourth target node to release the spot resources used by the fourth target node. For the implementation process of step 105, please refer to the implementation process of step 102b3. Further details are not described again herein.
[0157] The following describes the implementation process of steps 103 to 105, using the example where the resource scheduling device is the application hosting component shown in Figure 2.
[0158] As shown in Figure 14, when the AASS component detects that the remaining available duration of the spot resources used by the fourth target node (for example, node 3 or node 4 in Figure 14) is less than the duration threshold, it may determine a node replacement policy, which includes the amount of at least one new third node to be added and the node specifications of each new third node to be added. For example, the AASS component may report node requirements information to the global scheduling component, which may determine a node replacement policy based on the node requirements information and the specifications of several candidate nodes and deliver the node replacement policy to the AASS component. The node requirements information may indicate the total amount of processor cores to be added.
[0159] Then, in accordance with the node replacement policy, the AASS component can add at least one third node to the ES cluster and adjust the shard deployment policy. For example, as shown in Figure 15, the AASS component may add a total of two third nodes, namely node 5 and node 6. In addition, the AASS component may adjust the shard deployment policy as follows, namely that shard S3 is deployed on node 5 and shard S4 is deployed on node 6.
[0160] Furthermore, the client proxy component may migrate at least one shard to at least one newly added third node in accordance with the coordinated shard deployment policy. For example, as shown in Figure 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 resources used by node 3 or node 4 is zero, the AASS component may remove node 3 or node 4, as shown in Figure 16.
[0161] From the aforementioned analysis, it can be seen that in the method provided in this embodiment of the present application, the amount of resources occupied by multiple shards of the target index may be adjusted to enable flexible adjustment of the data write performance of the target index, i.e., write elasticity of the ES cluster can be implemented. Based on this, the solution provided in this embodiment of the present application may be applied to scenarios in which a large amount of data is stored and the amount of data written fluctuates greatly over time. For example, the target index may be used to store media log data or transaction data of a transaction system. Media log data may include live streaming log data, on-demand log data, etc.
[0162] The above is illustrated by using an example in which a resource scheduling device adjusts the amount of resources occupied by multiple shards of the target index based on the data write 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, the multiple replicas being carried out by the multiple fourth nodes. The multiple fourth nodes may form a leader cluster of the target index. For example, the multiple fourth nodes are node N in Figure 2.r1 From node N rN The resource scheduling device may further flexibly adjust the amount of replicas included in the target index based on the data read frequency of the target index in order to implement read elasticity of the ES cluster. As shown again 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 for the target index.
[0164] In this embodiment of the present application, the resource scheduling device may calculate the data read frequency of a target index in real time or periodically. The data read frequency may be the amount of data read requests received within a unit time with respect to the target index. Optionally, the data read frequency calculated by the resource scheduling device at each statistical moment may be the ratio of the amount of data read requests received in a second target duration ending before the statistical moment to the second target duration. For example, if the unit of the statistic for 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 write rate. For example, both the second and first target durations may be 5 minutes each.
[0166] Step 107: Adjust the number of replicas included in the target index when the data read frequency of the target index falls outside the target frequency range.
[0167] Each replica in the target index is obtained by duplicating a shard of the target index; that is, the data stored in each replica is the same as the data stored in the shard corresponding to the replica. Furthermore, the number of replicas in different shards of the target index may be the same or different.
[0168] Replicas of the target index may provide data query services, and it will be understood that a larger number of replicas included in the target index will result in a higher maximum data read frequency supported by the target index. In this embodiment of the present application, the resource scheduling device may pre-store a target frequency range, which may be determined based on the number of replicas currently included in the target index.
[0169] Furthermore, when a document (a document is the smallest unit for storing data) is stored in the target index, it will be understood that the identity of the target shard used to store the document needs to be calculated based on the number of shards contained in the target index. For example, the identity of a target shard, shard_num, may be calculated according to the following formula: shard_num = hash (routing) %num_primary_shards Formula (6)
[0170] Here, hash represents a hash operation, routing represents a pre-configured routing key, and num_primary_shards is the number 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 must also be determined according to equation (6). From the above analysis, it can be seen that, in order to guarantee accurate data queries, the number of shards included in the target index cannot be modified after the target index is created.
[0171] Since the number of shards included in the target index cannot be adjusted, and the number of replicas can be flexibly adjusted, a larger number of replicas included in the target index indicates a higher maximum data read frequency that can be supported by the target index, i.e., better data read performance for multiple fourth nodes. Furthermore, since the number of replicas that can be handled by each fourth node in the ES cluster is positively correlated with the node specifications of the fourth node, in this embodiment of the application, the target frequency range may be determined based on the node specifications of multiple fourth nodes in the ES cluster.
[0172] There may be a set of common elements between the multiple fourth nodes and the multiple first nodes described above, or the multiple fourth nodes may be independent of the multiple first nodes. For example, if the ES cluster is deployed with separate read / write operations as shown in Figure 2, the multiple first nodes may be nodes in the writer cluster, and the multiple fourth nodes may be nodes in the reader cluster.
[0173] Optionally, the resource scheduling device may obtain a preset data read frequency threshold r0 for each processor core, i.e., the single-core data read frequency. In this case, the target frequency range may be determined based on the product of the data read frequency threshold r0 and the total number of processor cores m4 included in the multiple fourth nodes. For example, the target frequency range may be (r0 × m4) ± Δr, where Δr is a preset variation in the read rate and may be a number greater than or equal to 0.
[0174] For example, suppose the data read frequency threshold r0 for each processor core is 5 QPS, and the ES cluster includes 10 fourth nodes of 4U16G. In this way, the total number of processor cores m4 included in the 10 fourth nodes is 40. Accordingly, the resource scheduling device may determine that the target frequency range is (200 ± Δr) QPS. If the preset read rate variation Δr is 0, the target frequency range may be equal to 200 QPS.
[0175] If the data read frequency of the target index falls outside the target frequency range, the resource scheduling device may determine that the data read performance of the multiple fourth nodes does not match the data read frequency of the target index. If the data read frequency of the target index is higher than the upper limit of the target frequency range, the resource scheduling device may determine that the data read performance of the multiple fourth nodes cannot support the data read frequency. If the data read frequency of the target index is below the lower limit of the target frequency range, the resource scheduling device may determine that the data read performance of the multiple fourth nodes is not being fully utilized, i.e., that the ES cluster's resource utilization is low.
[0176] Based on this, the resource scheduling device may adjust the number of replicas included in the target index so that the number of replicas included in the target index matches the data read frequency. In this way, resource utilization of the ES cluster can be effectively improved while data read performance is guaranteed.
[0177] In this embodiment of the present application, if the data read frequency of the target index is higher than the upper limit of the target frequency range, the resource scheduling device may 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. The amount of replicas newly added to each fifth node may be positively correlated with the node specifications of the fifth node. In other words, higher node specifications for the fifth node indicate a larger amount of replicas newly added to the fifth node.
[0178] In the first possible example, the node specification of at least one fifth node is a pre-configured specification. Correspondingly, the quantity of at least one fifth node may be determined based on the difference between the data read frequency and the upper limit of the target frequency range, and the quantity of at least one fifth node is positively correlated with the difference.
[0179] In the first example, if the number of processor cores in the pre-configured specifications is m0, the number of the fifth node to be added, n3, is n3≧(r1 - r2) / (r0×m0) Equation (7) This may be the case.
[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 for each processor core. Equation (7) may also be transformed to (n3 × m0) ≥ (r1 - r2) / r0, where (n3 × m0) is the total number of processor cores included in at least one newly added fifth node.
[0181] Assume that the data read frequency threshold r0 for each processor core is 5 QPS, the upper limit r2 of the target frequency range is 200 QPS, and the node specification for each available node in the resource pool is 4U16G. Thus, m0 = 4. As shown in Figure 17, if the AASS component detects that the target index data read frequency r1 is 210 QPS by using AGW, the AASS component may determine a fifth node to be added, whose node specification is 4U16G, according to equation (7). Correspondingly, as shown in Figure 17, the AASS component may add node 3 to the ES cluster and add a replica to node 3. The replica is hosted by a search process, which is integrated with the server SDK.
[0182] In a second possible example, the available nodes in the resource pool have multiple different candidate node specifications. The resource scheduling device may determine the number of at least one new fifth node to be added and the node specifications of each fifth node based on the multiple different candidate node specifications and the difference between the data read frequency and the upper limit of the target frequency range. The node specifications of each fifth node are selected from the multiple candidate node specifications, and the node specifications of different fifth nodes may be the same or different.
[0183] In the second example, the total number of processor cores m5 included in at least one fifth node is m5≧(r1 - r2) / r0 Equation (8) This may be the case.
[0184] Optionally, the resource scheduling device may determine the quantity of at least one fifth node and the node specifications of each fifth node based on the cost of the specifications of each candidate node and in accordance with a cost priority policy. In this way, the cost of newly added nodes can be reduced while ensuring that the data read performance of the ES cluster is effectively improved.
[0185] In this embodiment of the present application, if the data read frequency of the target index is below the lower limit of the target frequency range, the resource scheduling device may determine at least one fifth target node from a plurality of fourth nodes and delete the replicas distributed to each of the fifth target nodes. Then, the resource scheduling device may delete 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 across the node is less than the sixth threshold, and the node's data read frequency is less than the seventh threshold. In other words, the resource scheduling device may remove a fourth node with a small amount of shards and / or a small amount of received data read requests. The sixth and seventh thresholds may be fixed values pre-configured in the resource scheduling device. Alternatively, the sixth threshold may be determined based on the amount of replicas across all fourth nodes, for example, the average or lower quartile of the amount of replicas across all fourth nodes. The seventh threshold may be determined based on the data read frequency across all fourth nodes, for example, the average or lower quartile of the data read frequency across all fourth nodes.
[0187] Figure 18 is a diagram of the data read frequency of the target index according to an embodiment of the present application. In Figure 18, an example in which the target index is used to store media log data is used for illustrative purposes. In Figure 18, the horizontal axis is time, the unit is hours, and the vertical axis is data read frequency, the unit is reads / minute. As shown in Figure 18, it can be seen that the overall data read frequency of the target index is low, with a peak value of approximately 7 reads / minute. Good data read performance can be guaranteed when the data read frequency supported by the fourth node in the ES cluster is 20 QPS.
[0188] Figure 19 is a diagram of the data write frequency of the target index according to an embodiment of the present application. In Figure 19, an example in which the target index is used to store media log data is used for illustrative purposes. In Figure 19, the horizontal axis is time, the unit is time, and the vertical axis is data write frequency, the unit is times / minute. As shown in Figure 19, it can be seen that the peak range of the data write frequency of the target index is approximately 5,600 times / minute to 137,000 times / minute. Because the data write frequency of the target index is high, the data write rate of the target index is also high. Furthermore, it can be seen from Figure 19 that the data write rate of the target index fluctuates significantly 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. Thus, dynamic resilience of data write performance can be implemented, and resource utilization of the ES cluster is effectively improved while data write performance is guaranteed.
[0189] It will be understood that the sequence of steps of the resource scheduling method for an ES cluster provided in the embodiments of this application may be appropriately adjusted on a given basis, or steps may be added or removed accordingly. For example, steps 103 through 105 may be removed on a given basis, or steps 106 and 107 may be removed on a given basis, or steps 106 and 107 may be performed before step 105, or steps 103 through 105 may be performed before step 102.
[0190] In conclusion, embodiments of the present application provide a resource scheduling method for an 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 node resources 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 allows for the dynamic adjustment of the data storage capacity and maximum data write rate of the target index without changing the number of shards included in the target index. In this way, data write flexibility 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 adjusted more flexibly based on the data read frequency of the target index. In this way, read elasticity of the ES cluster is implemented. Furthermore, when a node is newly added to the ES cluster, the node specifications of the newly added node and the type of resources used by the node may be flexibly selected. Thus, the flexibility of adding nodes is effectively increased, and the cost of newly added nodes may be reduced. For example, tests have shown that in a scenario where log data is stored in the target index, writer cluster elasticity can be implemented, resulting in a 50% reduction in the cost of the ES cluster. If the resource scheduling device can more flexibly select the node specifications of a node and the type of resources used by the node based on the principle of cost priority, the cost of the ES cluster may be reduced by 70%.
[0192] Embodiments of this application provide a resource scheduling device for an ES cluster. The resource scheduling device may be configured to implement a resource scheduling method for an ES cluster provided in embodiments of the method described above. The ES cluster includes a plurality of first nodes configured to be responsible for a target index, the target index includes a plurality of shards. The resource scheduling device may be deployed on a cloud platform. For example, the resource scheduling device may be the application hosting component shown in Figure 2. As shown in Figure 20, the resource scheduling device is A statistics module 201 configured to calculate the data write rate of a target index, wherein the implementation of the functionality of the statistics module 201 may refer to the relevant description in step 101, and the statistics module 201, A tuning module 202 configured to adjust the amount of node resources occupied by multiple shards when the data write rate of a target index falls outside a target rate range, wherein the implementation of the functionality of the tuning module 202 may refer to the relevant description in step 102.
[0193] Optionally, the adjustment module 202 may be configured to add at least one second node to the ES cluster and migrate at least one shard from among multiple shards to 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. Further details on the implementation of the functionality of the adjustment module 202 may be found in the relevant descriptions of steps 102a1 and 102a2.
[0194] In any implementation, the adjustment module 202 may be further configured to determine the amount of at least one new second node to be added to the ES cluster, based on the difference between the data write rate of the target index and the upper limit of the target rate range, before at least one new second node is added to the ES cluster. The amount is positively correlated with the difference, and the node specification of at least one second node is a pre-configured specification.
[0195] In another optional implementation, the adjustment module 202 may be further configured to determine the number of new second nodes to be added and the node specifications of each second node, based on a plurality of different candidate node specifications and the difference between the data write rate of the target index and the upper limit of the target rate range, before at least one new second node is added to the ES cluster. The node specifications of each second node are selected from the plurality of candidate node specifications.
[0196] Optionally, the total number of processor cores m1 in at least one second node satisfies m1 ≥ (s1 - s2) / s0, where 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 for each processor core.
[0197] Optionally, resources used by at least one second node are spot resources.
[0198] Optionally, at least one shard satisfies at least one of the following conditions: the amount of data written to the shard is less than a first threshold, and the total number of shards distributed on the first node where the shard resides is greater than a second threshold.
[0199] Optionally, the adjustment module 202 may be configured to determine which first target node should be removed from a plurality of first nodes when the data write rate of the target index is below the lower limit of the target rate range, to migrate all shards distributed to at least one first target node to at least one first node other than the first target node, and to remove at least one first target node. For implementation of the functionality of the adjustment module 202, further reference may be given to the relevant descriptions in steps 102b1 to 102b3.
[0200] Optionally, at least one first target node satisfies the condition that the total amount of shards distributed across the node is less than the third threshold.
[0201] Optionally, the adjustment module 202 may be configured to adjust the node specifications of at least one of the multiple first nodes when the data write rate of the target index falls outside the target rate range.
[0202] Optionally, the adjustment module 202 may be configured to increase the node specification of at least one second target node among the multiple first nodes when the data write rate of the target index is higher than the upper limit of the target rate range, or to decrease the node specification of at least one third target node among the multiple first nodes when the data write rate of the target index is below the lower limit of the target rate range.
[0203] Optionally, if the resources used by the fourth target node among multiple first nodes are spot resources, the coordination module 202 may be further configured to add at least one new third node to the ES cluster, migrate all shards distributed to the fourth target node to at least one third node, and remove the fourth target node when the remaining available duration of the spot resources used by the fourth target node is less than a duration threshold. Further implementation of the functionality of the coordination module 202 may refer to the relevant descriptions in steps 103 to 105.
[0204] Optionally, resources used by at least one third node may include on-demand resources and / or spot resources.
[0205] Optionally, the ES cluster may further include multiple fourth nodes, which are configured to handle multiple replicas of the target index. The statistics module 201 may further be configured to calculate the data read frequency of the target index. For implementation of the functionality of the statistics module 201, refer further to the relevant description in 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 read frequency of the target index falls outside the target frequency range. For further implementation of the functionality of the adjustment module 202, refer to the relevant description in step 107.
[0207] Optionally, the adjustment module 202 may be configured to add at least one fifth node to the ES cluster and at least one replica of the target index to each fifth node when the data read frequency of the target index is higher than the upper limit of the target frequency range.
[0208] Optionally, the adjustment module 202 may be configured to remove replicas distributed across at least one fifth target node among a plurality of fourth nodes when the data read frequency of the target index is below the lower limit of the target frequency range, and to remove at least one fifth target node.
[0209] If the resource scheduling device is the application hosting component shown in Figure 2, it will be understood that 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, client proxy component, and global scheduling component.
[0210] In conclusion, embodiments of the present application provide a resource scheduling device for an ES cluster. The device can calculate the data write rate of a target index and dynamically adjust the amount of node resources occupied by multiple shards of the target index when the data write rate falls outside the target rate range. 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 maximum data write rate of the target index without changing the number of shards included in the target index. In this way, data write flexibility is effectively increased and the utilization of cluster resources is effectively improved.
[0211] Those skilled in the art will clearly understand that, for the sake of a simple and clear explanation, with respect to the specific working processes of the resource scheduling devices and modules described above, the corresponding processes of the embodiments of the methods described above may be referenced, and that details are not described again herein.
[0212] It will be understood that all modules of the resource scheduling device (for example, the statistics module 201 and the adjustment module 202) may be implemented using software or using hardware. For example, the implementation of the statistics module 201 is described below, using the statistics module 201 as an example. 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 statistics module 201 may contain code that runs on a compute instance. A compute 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 compute instances. For example, statistics module 201 may contain code that runs on multiple hosts / virtual machines / containers. Note that the multiple hosts / virtual machines / containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code may be distributed in the same Availability Zone (AZ) or in different AZs. Each AZ may include 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 within the same virtual private cloud (VPC), or across multiple VPCs. Generally, one VPC is configured in one region. For communication between two VPCs within the same region, or between VPCs in different regions, a communication gateway must be configured in each VPC. Interconnection between VPCs is achieved through the communication gateway.
[0215] The 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 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] Multiple computing devices included in Statistics Module 201 may be distributed within the same region or across different regions. Multiple computing devices included in Statistics Module 201 may be distributed within the same Availability Zone (AZ) or across different Availability Zones (AZs). Similarly, multiple computing devices included in Statistics Module 201 may be distributed within the same Virtual PC (VPC) or across multiple VPCs. Multiple 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 resource scheduling method described above, and the adjustment module 202 may also be configured to perform any step of the resource scheduling method described above. The steps to be performed by the statistics module 201 and the adjustment module 202 may be specified as needed. The statistics module 201 and the adjustment module 202 are each configured to perform different steps of the resource scheduling method in order to perform all the functions of the resource scheduling device.
[0218] Figure 21 is a diagram illustrating the 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, memory 2106, and a communication interface 2108. The processor 2104, memory 2106, and 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 processor and memory in the computing device is not limited to the embodiments of the present application.
[0219] Bus 2102 may be a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or the like. Buses may be classified into address buses, data buses, control buses, etc. For ease of representation, only one line is used for representation in Figure 21, but this does not mean that only one bus or only one type of bus exists. Bus 2102 may include paths for transferring information between various components of a computing device (e.g., memory 2106, processor 2104, and communication interface 2108).
[0220] The processor 2104 may include one or more processors 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 volatile memory, such as random access memory (RAM). The processor 2104 may further include non-volatile memory, such as read-only memory (ROM), flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0222] Memory 2106 stores executable program code, and processor 2104 executes the executable program code to separately perform the functions of the statistics module and the coordination module in order to implement the resource scheduling method provided in the embodiment of the method described above. In other words, the instructions used to implement the resource scheduling method are stored in memory 2106.
[0223] The communication interface 2108 uses transceiver modules, such as, but not limited to, network interface cards or transceivers, to facilitate communication between the computing device and another device or communication network.
[0224] Embodiments of this application further provide 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 in 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, a 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 execute the resource scheduling method.
[0226] In some possible implementations, the memory 2106 of one or more computing devices in a cluster of computing devices may store some instructions used to execute the resource scheduling method separately. In other words, a combination of one or more computing devices may jointly execute the instructions used to execute the resource scheduling method.
[0227] It should be noted that the memories 2106 of different computing devices within a cluster of computing devices may store different instructions, each used to perform some of the functions of the resource scheduling device. In other words, the instructions stored in the memories 2106 of different computing devices may implement one or more functions of the statistics collection module and the coordination module.
[0228] In some possible implementations, one or more computing devices in a cluster of computing devices may be connected via a network. The network may be a wide area network, a local area network, or the like.
[0229] Embodiments of this application further provide a computer-readable storage medium. The computer-readable storage medium may be any available medium that can be accommodated by a computing device, or a data storage device such as a data center that includes one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, or magnetic tapes), optical media (e.g., DVDs), semiconductor media (e.g., solid-state drives), etc. The computer-readable storage medium includes instructions, which instruct a computing device to execute a resource scheduling method for an ES cluster provided in embodiments of the method described above.
[0230] Embodiments of this application further provide a computer program product including instructions. The computer program product may be a software or program product including instructions that can be executed on a computing device or stored on 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 a resource scheduling method for an ES cluster provided in embodiments of the above-described method.
[0231] Embodiments of this application further provide an elastic search system. The elastic search system can provide a cloud search service (CSS). The elastic search system may include an ES cluster shown in Figure 1 and a resource scheduling device configured to schedule the resources of the ES cluster.
[0232] An ES cluster may include multiple nodes. These nodes may be deployed to separate read / write operations, or to decouple memory and compute operations.
[0233] The resource scheduling device may be configured to implement the resource scheduling method for the ES cluster provided in the embodiment of the method described above. 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 be based on any one of Figures 20 to 22.
[0234] In embodiments of this application, the terms “first,” “second,” and “third” are used solely for descriptive purposes and should not be understood as indicating or suggesting relative importance. The terms “and / or” in this application indicate only a relationship of association to describe the subjects in question, and that three such relationships may exist. For example, A and / or B may indicate three cases: that only A exists, that both A and B exist, and that only B exists. In addition, the letter “ / ” in this specification generally indicates an “or” relationship between the subjects in question.
[0235] Finally, it should be noted that the embodiments described above are intended only to illustrate the technical solutions of the present invention and are not intended to limit the invention. Although the present invention has been described in detail in relation to the embodiments described above, those skilled in the art will surely understand that they may still make modifications to the technical solutions described in the embodiments described above, or make equivalent substitutions for some of the technical features of those technical solutions, without departing from the scope of protection of the technical solutions of the embodiments of the present invention. [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 applied in an elastic search system, wherein the elastic search system includes a client proxy, a writer cluster, a reader cluster, and an object storage service component, the writer cluster includes a plurality of first nodes, the plurality of first nodes are used to write data to an index in the elastic search system, the shards of the index are distributed among the first nodes, the reader cluster includes a plurality of second nodes, the plurality of second nodes are used to read data from the index in the elastic search system, the replicas of the shards of the index are distributed among the second nodes, and the object storage service component is used to perform data synchronization between the shards and the replicas, and the method is A step of receiving data write requests and data read requests by the client proxy, wherein the data write request is used to write data to the index, and the data read request is used to read data from the index. The steps include: distributing the data write request to the writer cluster using the client proxy; The steps include processing the data write request by having the first node of the writer cluster write the data to one or more shards distributed to the first node, The steps include: distributing the data read request to the reader cluster using the client proxy; The steps include processing the data read request by having a second node of the reader cluster read data from one or more replicas distributed to the second node, When the data write rate of the index falls outside the target rate range, the step of adjusting the amount of resources occupied by one or more shards of the index, and / or, When the data read rate of the index falls outside the target rate range, the step of adjusting the amount of resources occupied by one or more replicas of the index. Methods that include...
2. Adjusting the amount of resources occupied by one or more shards of the index by adjusting the node specifications of one or more first nodes in the writer cluster, such that the node specifications of the first nodes include the amount of processor cores included in the first node and / or the memory size of the first node, and / or The method according to claim 1, wherein the adjustment of the amount of resources occupied by one or more replicas of the index is achieved by adjusting the node specifications of one or more second nodes in the leader cluster, the node specifications of the second nodes include the amount of processor cores included in the second nodes and / or the memory size of the second nodes.
3. Adjusting the amount of resources occupied by one or more shards of the aforementioned index, Adding one or more new first nodes to the writer cluster, or Deleting one or more first nodes in the writer cluster. The method according to claim 1.
4. After one or more new first nodes are added to the writer cluster, one or more shards of the index are migrated from one or more old first nodes to one or more new first nodes within the writer cluster, or Steps to migrate one or more shards of the index from one or more first nodes to be deleted within the writer cluster to other first nodes within the writer cluster, before one or more first nodes are deleted within the writer cluster. The method according to claim 3, including the method described in claim 3.
5. The method according to claim 4, wherein the policy for migrating shards within the writer cluster is a load balancing policy.
6. The step of migrating one or more shards of the index from one or more old first nodes to one or more new first nodes within the writer cluster is A step of migrating the target shard of the index from the old first node to the new first node, wherein the target shard meets the following conditions, namely: The amount of data written to the target shard is less than the first threshold, and The total number of shards distributed to the old first node where the target shard is located is greater than the second threshold. A step that satisfies at least one of the following conditions The method according to claim 4, including the method described in claim 4.
7. Adjusting the amount of resources occupied by one or more replicas of the aforementioned index, Adding one or more new second nodes to the leader cluster, and / or adding one or more new replicas of the index to the leader cluster, Deleting one or more second nodes in the leader cluster, and / or deleting one or more replicas of the index in the leader cluster. The method according to claim 1.
8. After the one or more new second nodes are added to the leader cluster, the steps include migrating one or more replicas of the index from one or more old second nodes to the one or more new second nodes within the leader cluster, and / or adding one or more new replicas of the index to the added second node, or Steps to migrate one or more replicas of the index from one or more second nodes to be deleted to other second nodes in the leader cluster, or to delete one or more replicas in one or more second nodes to be deleted, before one or more second nodes are deleted within the leader cluster. The method according to claim 7, including the method described in claim 7.
9. The method according to claim 1, wherein the elastic search system further comprises an ES cluster and an application hosting component, the ES cluster comprising a master node, client nodes and a request cache, the master node being configured to maintain the status of the ES cluster, the client nodes being used to process the data write requests and data read requests of an application, the request cache being used to cache the data write requests and data read requests, the application hosting component comprising a software development kit, an application queue management component, an application gateway, an application autoscaling service and a global scheduling component, each shard in the writer cluster and each replica in the reader cluster being able to be hosted by a search process, the software development kit being used to control the start or stop of the search process and to report monitoring data for the search service, the application queue management component being responsible for hosting the search process and managing the queue size of the search process, the application gateway being used to control the search process, the application autoscaling service being used to monitor the traffic of the search process and the global scheduling component being used to provide a global resource view of the resource pool.
10. This includes client proxies, writer clusters, reader clusters, resource scheduling devices, and object storage service components. The writer cluster includes a plurality of first nodes, which are used to write data to an index of an elastic search system, and the shards of the index are distributed among the first nodes. The reader cluster includes a plurality of second nodes, the plurality of second nodes are used to read data from the index of the elastic search system, and replicas of the shards of the index are distributed across the second nodes. The object storage service component is used to perform data synchronization between the shard and the replica. The client proxy is configured to receive data write requests and data read requests, distribute the data write requests to the writer cluster, and distribute the data read requests to the reader cluster, wherein the data write requests are used to write data to the index, and the data read requests are used to read data from the index. The first node of the writer cluster is configured to process the data write request by writing data to one or more shards distributed on the first node, The second node of the reader cluster is configured to process the data read request by reading data from one or more replicas distributed to the second node. The resource scheduling device is configured to adjust the amount of resources occupied by one or more shards of the index when the data write rate of the index falls outside the target rate range, and / or An elastic search system in which the resource scheduling device is configured to adjust the amount of resources occupied by one or more replicas of the index when the data read rate of the index falls outside the target rate range.
11. The elastic search system includes a resource scheduling device, and the resource scheduling device is Adjusting the node specifications of one or more first nodes in the writer cluster, such that the node specifications of the first node include the number of processor cores included in the first node and / or the memory size of the first node, and / or Adjusting the node specifications of one or more second nodes in the leader cluster, such that the node specifications of the second node include the number of processor cores included in the second node and / or the memory size of the second node. The elastic search system according to claim 10, configured to perform the following:
12. The elastic search system includes a resource scheduling device, and the resource scheduling device is Adding one or more new first nodes to the writer cluster, or Deleting one or more first nodes in the writer cluster. The elastic search system according to claim 10, configured to perform the following:
13. The resource scheduling device, After the one or more new first nodes are added to the writer cluster, one or more shards of the index are migrated from one or more old first nodes to one or more new first nodes within the writer cluster, or Migrating one or more shards of the index from one or more first nodes to be deleted within the writer cluster to other first nodes within the writer cluster before one or more first nodes are deleted within the writer cluster. The elastic search system according to claim 12, configured to perform the following:
14. The elastic search system according to claim 13, wherein the policy for migrating shards within the writer cluster is a load balancing policy.
15. The resource scheduling device moves one or more shards of the index from one or more older first nodes to one or more new first nodes within the writer cluster. The objective shard of the index is migrated from the old first node to the new first node, wherein the objective shard is subject to the following conditions, namely: The amount of data written to the target shard is less than the first threshold, and The total number of shards distributed to the old first node where the target shard is located is greater than the second threshold. The elastic search system according to claim 13, configured to migrate by migrating, satisfying at least one of the following conditions.
16. The elastic search system includes a resource scheduling device, and the resource scheduling device is Adding one or more new second nodes to the leader cluster, and / or adding one or more new replicas of the index to the leader cluster, Deleting one or more second nodes in the leader cluster, and / or deleting one or more replicas of the index in the leader cluster. The elastic search system according to claim 10, configured to perform the following:
17. The elastic search system includes a resource scheduling device, and the resource scheduling device is After one or more new second nodes are added to the leader cluster, one or more replicas of the index are migrated within the leader cluster from one or more old second nodes to the one or more new second nodes, and / or one or more new replicas of the index are added to the added second node, or Before one or more second nodes are deleted within the leader cluster, migrate one or more replicas of the index from one or more second nodes to be deleted to other second nodes within the leader cluster, or delete one or more replicas within one or more second nodes to be deleted. The elastic search system according to claim 16, configured to perform the following:
18. The Elastic Search System according to claim 10, further comprising an ES cluster and an application hosting component, wherein the ES cluster comprises a master node, client nodes, and a request cache, the master node being configured to maintain the status of the ES cluster, the client nodes being used to process the data write requests and data read requests of an application, the request cache being used to cache the data write requests and data read requests, the application hosting component comprising a software development kit, an application queue management component, an application gateway, an application autoscaling service, and a global scheduling component, each shard in the writer cluster and each replica in the reader cluster being able to be hosted by a search process, the software development kit being used to control the start or stop of the search process and to report monitoring data for the search service, the application queue management component being responsible for hosting the search process and managing the queue size of the search process, the application gateway being used to control the search process, the application autoscaling service being used to monitor the traffic of the search process, and the global scheduling component being used to provide a global resource view of the resource pool.
19. A cluster of computing devices comprising at least one computing device, wherein each computing device comprises a processor and 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 so that the cluster of computing devices performs the method according to claim 1.
20. A computer-readable storage medium that stores computer program instructions, and in which the cluster of computing devices performs the method according to claim 1 when the computer program instructions are executed by the cluster of computing devices.
21. A computer program comprising instructions, wherein when the instructions are executed by a cluster of computing devices, the cluster of computing devices is enabled to perform the method according to claim 1.
Citation Information
Patent Citations
Access processing method and device, storage medium and program product
CN113849273A
Cross Cluster Replication
US20200201879A1