WO2023216571A1 - 弹性搜索集群的资源调度方法、装置及系统 - Google Patents

弹性搜索集群的资源调度方法、装置及系统 Download PDF

Info

Publication number
WO2023216571A1
WO2023216571A1 PCT/CN2022/136923 CN2022136923W WO2023216571A1 WO 2023216571 A1 WO2023216571 A1 WO 2023216571A1 CN 2022136923 W CN2022136923 W CN 2022136923W WO 2023216571 A1 WO2023216571 A1 WO 2023216571A1
Authority
WO
WIPO (PCT)
Prior art keywords
node
target
nodes
target index
resource scheduling
Prior art date
Application number
PCT/CN2022/136923
Other languages
English (en)
French (fr)
Inventor
王楠楠
卞盛伟
Original Assignee
华为云计算技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from CN202210764591.4A external-priority patent/CN117093357A/zh
Application filed by 华为云计算技术有限公司 filed Critical 华为云计算技术有限公司
Publication of WO2023216571A1 publication Critical patent/WO2023216571A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Definitions

  • the present application relates to the field of data storage technology, and in particular to a resource scheduling method, device and system for elastic search clusters.
  • Elastic-search is a distributed, highly scalable and highly real-time data search engine that can provide data search services in clusters.
  • a cluster usually includes multiple nodes, and each node can be a physical machine or a virtual machine (VM).
  • VM virtual machine
  • the smallest unit of data storage and search is a document, and the logical space (i.e., container) used to store documents is called an index.
  • the index can be divided into multiple shards and create at least one corresponding replica for each shard. Each shard and its corresponding at least one replica are distributed in different nodes.
  • ID the document's identity
  • the target shard will synchronize the document to at least one corresponding copy.
  • the target shard storing the document can be determined based on the ID of the document and the number of shards included in the index, and the document can be read from the target shard.
  • the number of shards included in the index should be fixed. That is, after the index is created, the number of shards included in the index cannot be modified. As a result, the flexibility of data writing is low.
  • This application provides a resource scheduling method, device and system for elastic search clusters, which can solve the technical problem of low data writing flexibility in ES clusters.
  • a resource scheduling method for an ES cluster includes multiple first nodes, and the multiple first nodes are used to carry multiple shards of a target index.
  • the method includes: counting the data writing rate of the target index, and adjusting the amount of resources of nodes occupied by multiple shards of the target index based on the data writing rate of the target index being outside the target rate range.
  • the solution provided by this application can be used without changing the number of shards included in the target index.
  • the data storage capacity and maximum data writing rate of the target index can be dynamically adjusted. This not only effectively improves the flexibility of data writing, but also effectively improves the utilization of cluster resources.
  • the data writing rate based on the target index is outside the target rate range.
  • the process of adjusting the resource amount of the node occupied by the multiple shards may include: the data writing rate based on the target index is greater than the target rate.
  • the upper limit of the range adding at least one second node to the ES cluster, and migrating at least one of the plurality of shards to the at least one second node.
  • the ES cluster By adding at least one second node to the ES cluster, the ES cluster can be expanded and the amount of resources occupied by the target index can be increased. As a result, the data storage capacity and maximum data writing rate of the target index can be effectively increased, so that the data writing performance of the target index can match the current actual data writing rate.
  • the method may also include: based on the difference between the data writing rate of the target index and the upper limit of the target rate range, determine at least one second node to be added. The number of two nodes. The number is positively correlated with the difference, and the node specifications of the at least one second node are all preset specifications.
  • the solution provided by this application can add at least one second node with preset specifications in the ES cluster based on the difference in write rates.
  • the method of adding a second node is relatively simple and highly efficient.
  • the method may also include: a difference between the data writing rate based on the target index and the upper limit of the target rate range, and multiple different backup devices.
  • Select the node specifications determine the number of at least one second node to be added, and the node specifications of each second node.
  • the node specification of each second node is selected from the specifications of the multiple candidate nodes.
  • the solution provided by this application can determine at least one second node from the available nodes with multiple different node specifications based on the difference in write rates.
  • This method of adding a second node has high flexibility.
  • the solution provided by this application can use a cost-priority strategy to determine at least one second node based on the cost of each alternative node specification. As a result, the cost of adding new nodes can be effectively reduced.
  • the total number m1 of processor cores included in the at least one second node may satisfy: m1 ⁇ (s1-s2)/s0.
  • s1 is the data write rate of the target index
  • s2 is the upper limit of the target rate range
  • s0 is the data write rate threshold of each processor core.
  • the data writing performance of multiple first nodes and at least one second node used to carry the target index can match the data writing rate of the target index.
  • the resources used by the at least one second node may be bidding resources. Since the cost of bidding resources is low, the solution provided by this application can preferentially use bidding resources as resources for new nodes.
  • the at least one shard may satisfy at least one of the following conditions: the amount of data written in the shard is less than the first threshold; the total number of shards distributed in the first node where the shard is located is greater than the first threshold. Two thresholds.
  • the solution provided by this application can select shards with a smaller amount of written data for migration, and/or select shards in the first node with a larger number of shards for migration. This can effectively improve the migration efficiency of shards, reduce migration costs, and ensure that the number of shards in each first node is relatively balanced.
  • the data writing rate based on the target index is outside the target rate range
  • the process of adjusting the resource amount of the node occupied by the multiple shards may include: the data writing rate based on the target index is less than the target rate The lower limit of the range, determine at least one first target node to be deleted from the plurality of first nodes; migrate all the fragments distributed in the at least one first target node to other than the at least one first target node. other first nodes, and delete the at least one first target node.
  • the capacity of the ES cluster can be reduced by deleting at least one first node, thereby effectively improving the resource utilization of the ES cluster and reducing the cost of the ES cluster.
  • the total number of distributed shards in each first target node is less than a third threshold. That is to say, the solution provided by this application can delete the first node with a small number of shards. This ensures that the shards in the at least one first target node can be quickly migrated to other first nodes before deleting the at least one first target node.
  • the data writing rate based on the target index is outside the target rate range
  • the process of adjusting the resource amount of the node occupied by the multiple shards may include: the data writing rate based on the target index is within the target rate. outside the range, adjust the node specification of at least one first node among the plurality of first nodes.
  • the solution provided by this application can also adjust the amount of resources occupied by the target index by dynamically adjusting the node specifications of the first node without changing the first node to which the shard belongs.
  • the data writing rate based on the target index is outside the target rate range
  • the process of adjusting node specifications of at least one first node among the plurality of first nodes may include: based on the data writing rate of the target index Greater than the upper limit of the target rate range, increase the node specification of at least one second target node among the plurality of first nodes.
  • the at least one second target node may be the first node with a larger number of shards in the ES cluster.
  • the data writing rate based on the target index is outside the target rate range
  • the process of adjusting node specifications of at least one first node among the plurality of first nodes may include: based on the data writing rate of the target index is less than the lower limit of the target rate range, reduce the node specification of at least one third target node among the plurality of first nodes.
  • the at least one third target node may be the first node with a smaller number of shards in the ES cluster.
  • the resources used by the fourth target node among the plurality of first nodes are bidding resources.
  • the method may also include: based on the remaining available time of the bidding resources used by the fourth target node being less than a time duration threshold, adding at least a third node to the ES cluster; migrating all shards distributed in the fourth target node to the at least one third node, and delete the third target node.
  • the solution provided by this application can use bidding resources as the resources of the fourth target node, and can timely transfer the points in the fourth target node when the remaining usage time of the bidding resources is less than the duration threshold. Migrate the slice to the newly added third node. As a result, the cost of the ES cluster can be effectively reduced while ensuring the data reading and writing performance of the ES cluster.
  • the resources used by the at least one third node may include on-demand resources and/or bidding resources.
  • on-demand resources refer to resources purchased according to business needs, and their costs are higher than bidding resources.
  • the solution provided by this application can determine the type of resource used by the at least one third node according to a cost-priority strategy.
  • the ES cluster may also include multiple fourth nodes, and the multiple fourth nodes are used to host multiple copies of the target index.
  • the method may further include: counting the data reading frequency of the target index, and adjusting the number of copies included in the target index based on the data reading frequency of the target index being outside the target frequency range.
  • the solution provided by this application can make the number of copies included in the target index match the data reading frequency by adjusting the number of copies included in the target index. As a result, the resource utilization of the ES cluster can be effectively improved while ensuring data reading performance.
  • the data reading frequency based on the target index is outside the target frequency range
  • the process of adjusting the number of copies included in the target index may include: the data reading frequency based on the target index is greater than the upper limit of the target frequency range.
  • the data reading performance of the ES cluster can be effectively improved.
  • the data reading frequency based on the target index is outside the target frequency range
  • the process of adjusting the number of copies included in the target index may include: the data reading frequency based on the target index is less than the lower limit of the target frequency range. , delete the copies distributed in at least one fifth target node among the plurality of fourth nodes, and then delete the at least one fifth target node.
  • the capacity of the ES cluster can be reduced by deleting at least one fifth target node, thereby effectively improving the resource utilization of the ES cluster and reducing the cost of the ES cluster.
  • a second aspect provides a resource scheduling device for an ES cluster.
  • the resource scheduling device may include at least one module, and the at least one module may be used to implement the resource scheduling method for an ES cluster provided in the above aspect.
  • a computing device cluster including at least one computing device, each computing device including a processor and a memory.
  • the processor of the at least one computing device is configured to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the resource scheduling method of the ES cluster provided by the above aspect.
  • a computer-readable storage medium is provided.
  • Computer program instructions are stored in the computer-readable storage medium.
  • the computing device cluster executes the method provided in the above aspect. Resource scheduling method for ES cluster.
  • a fifth aspect provides a computer program product containing instructions.
  • the computing device cluster causes the computing device cluster to execute the resource scheduling method of the ES cluster provided in the above aspect.
  • a sixth aspect provides an ES system.
  • the ES system includes: an ES cluster, and a resource scheduling device of the ES cluster.
  • the resource scheduling device can be used to implement the resource scheduling method of the ES cluster provided in the above aspect.
  • this application provides a resource scheduling method, device and system for elastic search clusters, which belongs to the field of data storage technology.
  • the solution provided by this application can count the data writing rate of the target index, and can dynamically adjust the amount of resources of the nodes occupied by multiple shards in the target index when the data writing rate is outside the target rate range. Since the data storage capacity of the target index and the maximum data write rate supported are related to the amount of resources occupied by the multiple shards, the solution provided by this application can be used without changing the number of shards included in the target index. Under the premise, the data storage capacity and maximum data writing rate of the target index can be dynamically adjusted. This not only effectively improves the flexibility of data writing, but also effectively improves the utilization of cluster resources.
  • Figure 1 is a schematic structural diagram of an ES cluster provided by an embodiment of the present application.
  • Figure 2 is a schematic diagram of an application scenario of an ES cluster resource scheduling method provided by an embodiment of the present application
  • Figure 3 is a flow chart of a resource scheduling method for an ES cluster provided by an embodiment of the present application
  • Figure 4 is a flow chart of a method for expanding the capacity of an ES cluster provided by an embodiment of the present application
  • Figure 5 is a schematic diagram of adding a second node to an AASS component provided by an embodiment of the present application
  • Figure 6 is a schematic diagram of a client proxy component migrating shards provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of an expanded ES cluster provided by an embodiment of the present application.
  • Figure 8 is a flow chart of a method for reducing the capacity of an ES cluster provided by an embodiment of the present application.
  • Figure 9 is a schematic diagram of an AASS component instructing a client agent component to initiate a deletion process provided by an embodiment of the present application
  • Figure 10 is a schematic diagram of another client proxy component migrating shards provided by an embodiment of the present application.
  • Figure 11 is a schematic diagram of an AASS component deleting the first target node provided by the embodiment of the present application.
  • Figure 12 is a schematic diagram of the data writing performance of a first node with different node specifications provided by an embodiment of the present application
  • Figure 13 is a flow chart of another resource scheduling method for an ES cluster provided by an embodiment of the present application.
  • Figure 14 is a schematic diagram of a resource scheduling device determining a node replacement strategy provided by an embodiment of the present application
  • Figure 15 is a schematic diagram of adding a third node to an AASS component provided by an embodiment of the present application.
  • Figure 16 is a schematic diagram of an AASS component deleting the fourth target node provided by the embodiment of the present application.
  • Figure 17 is a schematic diagram of adding a fifth node to an AASS component provided by an embodiment of the present application.
  • Figure 18 is a schematic diagram of the data reading frequency of a target index provided by an embodiment of the present application.
  • Figure 19 is a schematic diagram of the data writing frequency of a target index provided by an embodiment of the present application.
  • Figure 20 is a schematic structural diagram of a resource scheduling device for an ES cluster provided by an embodiment of the present application.
  • Figure 21 is a schematic structural diagram of a computing device provided by an embodiment of the present application.
  • Figure 22 is a schematic structural diagram of a computing device cluster provided by an embodiment of the present application.
  • ES A distributed, highly scalable and highly real-time data search engine developed based on Lucene (a full-text search engine), which can provide data search services on a cluster basis.
  • the ES cluster a collection of multiple nodes, can independently provide search services.
  • the ES cluster may include a total of 3 nodes from node 1 to node 3.
  • Node It can also be called ES server, ES instance or computing instance, which contains basic physical resources such as processor, memory and disk.
  • a node can be a physical machine, a VM, or a container within a physical machine.
  • each index can be divided into multiple shards, and the multiple shards can be distributed on different nodes, thereby effectively increasing the data storage capacity of the index.
  • each shard can be a Lucene instance.
  • the index can be divided into 5 shards from shard S1 to shard S5.
  • shard S1 and shard S3 are distributed in node 1
  • shard S2 and shard S4 are distributed in node 2
  • shard S5 is distributed in node 3.
  • Copy obtained by copying the shards and is a backup of the shards.
  • Each shard can have one or more replicas, and each replica and its corresponding shard are distributed on different nodes.
  • each of slices S1 to S5 has one replica, and the replicas of slices S1 to S5 are replicas R1 to replicas R5 in sequence.
  • replica R1 and replica R3 are distributed in node 3
  • replica R2 and replica R4 are distributed in node 1
  • replica R5 is distributed in node 2.
  • the replica can process data query (query) requests, that is, provide data query services, it can effectively improve data query throughput and achieve high availability.
  • the shard can also be called the primary shard (primary shard), and the copy can also be called a replica shard (replica shard).
  • FIG. 2 is a schematic diagram of an application scenario of an ES cluster resource scheduling method provided by an embodiment of the present application.
  • this application scenario includes ES clusters and application hosting components.
  • this application scenario can be divided into management plane and data plane.
  • the management plane of the ES cluster can include the master node, client node and request cache.
  • the master node is used to maintain the status of the ES cluster, such as creating and deleting indexes, etc.
  • the client node is mainly responsible for data storage and processing data indexing requests and data reading requests from applications (also called clients). It is understood that the master node may also have the functions of the client node.
  • the request cache is used to cache data indexing requests and data reading requests.
  • the data index request is used to request to write data in the index, and can also be called a data write request;
  • the data read request is used to request to read the data in the index, and can also be called a data query request.
  • the data plane of an ES cluster can include a reader cluster and a writer cluster.
  • the read cluster includes a total of N nodes from node N r1 to node N rN , where N is an integer greater than 1.
  • One or more copies of the index can be distributed on each node in the read cluster, and the read cluster can be used to process data read requests.
  • the write cluster includes a total of M nodes from node N w1 to node N wM , where M is an integer greater than 1.
  • One or more shards of the index may be distributed in each node in the write cluster, and the write cluster may be used to process data write requests.
  • the application hosting component can also be called a smart cloud application elastic engine (smart cloud APP elastic engine, Scase) service component, which can provide global application hosting services.
  • the application hosting component may include: a global scheduling component and an application queue management component located on the management plane, as well as a client proxy (client proxy) component, application gateway (AGW), and application elasticity located on the data plane.
  • Scaling service application autoscale service, AASS) components and service (server) software development kit (SDK).
  • each shard in the write cluster and each replica in the read cluster can be hosted by a search process (also called a Lucene process or application process).
  • the service SDK is integrated into the search process.
  • the functions of each component in the application hosting component are as follows:
  • Service SDK used to control the start and stop of the search process, and report monitoring data of the search business.
  • the monitoring data may include: read and write volume per second, the status of the search process, the number of threads included in the search process, etc.
  • Application queue management component responsible for hosting the search process and managing the size of the queue for the search process.
  • AGW used for search process control.
  • the monitoring data collected by the service SDK is aggregated, and control instructions are issued to the service SDK so that the service SDK controls the start and stop of the search process, and controls the migration of shards or replicas.
  • AASS component monitors the traffic of the search process (including the amount of written data and the number of data read requests), and coordinates application indicators with the underlying resources of the cluster to achieve application-driven elastic services.
  • Client proxy component used to offload data write requests and data read requests, that is, offload data write requests to each node in the write cluster, and offload data read requests to the read cluster. of each node.
  • Global scheduling component Provides a global resource view of the resource pool, and based on the node specifications of the available nodes in the resource pool, determines the combination of nodes in the ES cluster according to a preset strategy (such as a cost-priority strategy).
  • this application scenario may also include storage service components, such as object storage service (OBS) components.
  • OBS object storage service
  • This storage service component is used to implement data synchronization between shards and replicas.
  • Embodiments of the present application provide a resource scheduling method for an ES cluster.
  • the ES cluster includes multiple first nodes, and multiple shards of a target index are distributed among the multiple first nodes.
  • each first node may be distributed with at least one shard of the target index.
  • the ES cluster can host at least one index, and the target index can be any index in the at least one index.
  • the multiple shards of the target index all refer to primary shards, and the multiple first nodes can form a write cluster of the target index.
  • the plurality of first nodes may be nodes N w1 to nodes N wM in FIG. 2 .
  • the resource scheduling method includes:
  • Step 101 Count the data writing rate of the target index.
  • the resource scheduling device can count the data writing rate of the target index in real time or periodically.
  • the data writing rate counted by the resource scheduling device at each statistical time may refer to: the average data writing rate within the first target duration before the statistical time, that is, the data received within the first target duration that needs to be written to The ratio of the total data volume of the target index to the first target duration.
  • the unit of the data writing rate may be bits per second (bps).
  • the resource scheduling device may count the number of data write requests for the target index received within the first target duration, and count the amount of data requested to be written by each data write request.
  • the resource scheduling device may accumulate the amount of data requested by each data write request received within the first target duration, thereby obtaining the total amount of data received within the first target duration that needs to be written to the target index.
  • the resource scheduling device may calculate the ratio of the total data amount to the first target duration, and determine the ratio as the data writing rate of the target index.
  • the AGW or client agent component can count the number of data write requests for the target index received within the first target duration, and Count the amount of data requested for each data write request.
  • the AASS component can calculate the data writing rate of the target index based on the data collected by the AGW or client agent component.
  • Step 102 If the data writing rate based on the target index is outside the target rate range, adjust the amount of resources of the node occupied by multiple shards.
  • a target rate range is prestored in the resource scheduling device, and the target rate range may be a range of data writing rates currently supported by the target index. Since the target index is currently carried by multiple first nodes, the target rate range can also be understood as a range of data writing rates that the multiple first nodes can support. Moreover, the target rate range may be determined based on node specifications of the plurality of first nodes.
  • the measurement indicators of node specifications may at least include: the number of processor cores included in the node.
  • the metric can also include the memory size of the node. If a node has x processor cores and a memory of y gigabytes (G), the node specification of the node can be expressed as xUyG.
  • x and y are both positive integers.
  • U is the abbreviation of unit, which is a unit that represents the external dimensions of the server. In the embodiment of the present application, it can be used to represent the number of processor cores.
  • the resource scheduling device may determine the target rate range based on node specifications of the plurality of first nodes.
  • the resource scheduling device may obtain the preset data writing rate threshold s0 of each processor core, that is, the single-core data writing rate.
  • the target rate range may be determined based on the product of the data writing rate threshold s0 and the total number m of processor cores included in the plurality of first nodes.
  • the target rate range may be (s0 ⁇ m) ⁇ s.
  • ⁇ s is a preset writing rate fluctuation value, which may be a number greater than or equal to 0.
  • the data writing rate threshold s0 may be configured by the application (that is, the client), and may be obtained by testing the data writing performance of a single processor core by the application.
  • the application can configure the data write rate threshold s0 of each processor core to 2Mbps. If a single search process of an application requires 2U8G of resources to run, and when the single search process is run on a 2U8G node, the maximum data writing rate supported by the node is 2Mbps, then the application can Configure the data write rate threshold s0 of each processor core to 1Mbps.
  • the data writing rate threshold s0 of each processor core configured in the resource scheduling device is 2Mbps.
  • the ES cluster includes 10 first nodes, and the number of processor cores included in each first node is 4, that is, the total number m of processor cores included in the 10 first nodes is 40.
  • the resource scheduling device can determine the target rate range to be (80 ⁇ s)Mbps. If the preset write rate fluctuation value ⁇ s is 0, the target rate range may be equal to 80Mbps.
  • the resource scheduling device may determine that the data writing performance of the plurality of first nodes does not match the data writing rate of the target index. If the data writing rate of the target index is greater than the upper limit of the target rate range, the resource scheduling device may determine that the data writing performance of the plurality of first nodes cannot support the current actual data writing rate of the target index, that is, the data may be generated Accumulation, unable to be written to the target index in a timely and effective manner. If the data writing rate of the target index is less than the lower limit of the target rate range, the resource scheduling device may determine that the data writing performance of the plurality of first nodes is not fully utilized, that is, the resource utilization rate of the ES cluster is low.
  • the resource scheduling device can dynamically adjust the amount of resources occupied by multiple fragments of the target index so that the amount of resources occupied by the multiple fragments can match the current actual data writing rate of the target index.
  • the resource utilization of the ES cluster can be effectively improved while ensuring high data writing performance, that is, an elastic strategy based on write quality of service (QOS) is implemented.
  • QOS write quality of service
  • the resource scheduling device can adjust the amount of resources occupied by the multiple shards by adjusting the number of nodes occupied by the multiple shards in the target index.
  • the resource scheduling device may adjust the amount of resources occupied by the plurality of shards by adjusting the node specification of at least one first node among the plurality of first nodes.
  • this step 102 may include:
  • Step 102a1 Based on the data writing rate of the target index being greater than the upper limit of the target rate range, add at least one second node to the ES cluster.
  • the resource scheduling device can add at least one new shard in the ES cluster for carrying the target index. Two nodes.
  • the resource scheduling device may determine the number of at least one second node to be added based on the difference between the data writing rate of the target index and the upper limit of the target rate range. Wherein, the number of the at least one second node is positively related to the difference. Furthermore, the node specifications of the at least one second node are all preset specifications, that is, the node specifications of the at least one second node are the same. Since in the first example, the node specifications of the nodes to be added are all preset specifications, the resource scheduling device can directly determine the number of at least one second node to be added based on the difference in writing rates. The method of adding a second node is relatively simple and highly efficient.
  • the number n1 of at least one second node to be added can satisfy:
  • s1 is the data write rate of the target index
  • s2 is the upper limit of the target rate range
  • s0 is the data write rate threshold of each processor core.
  • the above formula (1) can also be transformed into: (n1 ⁇ m0) ⁇ (s1-s2)/s0, where (n1 ⁇ m0) is the total number of processor cores included in the at least one second node.
  • the resource scheduling device can be based on the data writing rate of the target index and the upper limit of the target rate range. , and the multiple alternative node specifications, determine the number of at least one second node to be added, and the node specifications of each second node.
  • the node specification of each second node is selected from the plurality of alternative node specifications, and the node specifications of different second nodes may be the same or different.
  • the total number of processor cores m1 included in the at least one newly added second node can satisfy:
  • the resource scheduling device may determine the number of at least one second node and the node specification of each second node using a cost priority strategy based on the cost of each alternative node specification.
  • the cost of adding new nodes can be effectively reduced while improving the data writing performance of the ES cluster.
  • the resource scheduling device may first determine multiple node combinations that can satisfy the above formula (2) from the available nodes in the resource pool, where the number of second nodes in different node combinations is different, and/or, At least one second node has different specifications. Afterwards, the resource scheduling device can select a node combination with the lowest cost from the multiple node combinations, and add at least one second node according to the node combination with the lowest cost.
  • the resource scheduling device can determine that the total number of processor cores m1 included in at least one second node to be added needs to be greater than or equal to 10. If the node specifications of the second nodes to be added are all preset specifications: 2U8G, that is, the number m0 of processor cores in each second node is equal to 2, then the resource scheduling device can add 5 new processor cores in the ES cluster. The second node of 2U8G.
  • the resource scheduling device can add two 4U16G second nodes and one 2U8G second node to the ES cluster.
  • the resource scheduling device may preferentially select the node using spot resources as the node.
  • the second node to be added That is, the resources used by the at least one second node may be bidding resources. Among them, nodes that use bidding resources can also be called spot instances.
  • Step 102a2 Migrate at least one of the plurality of shards to the at least one second node.
  • the resource scheduling device After the resource scheduling device adds at least one second node in the ES cluster, it can migrate at least one fragment in the target index to the at least one second node.
  • Each second node may carry one or more shards of the target index.
  • At least one fragment migrated by the resource scheduling device may satisfy at least one of the following conditions: the amount of data written in the fragment is less than the first threshold; the fragment distributed in the first node where the fragment is located The total number of slices is greater than the second threshold.
  • the resource scheduling device can select shards with a smaller amount of written data for migration, and/or select shards in the first node with a larger number of shards for migration.
  • the migration efficiency of shards can be effectively improved, the migration cost can be reduced, and the number of shards in each first node can be ensured to be relatively balanced.
  • both the first threshold and the second threshold may be fixed values preconfigured in the resource scheduling device.
  • the first threshold may be determined based on the amount of data written in each shard of the target index, for example, it may be the mean or lower quartile of the amount of data written in each shard of the target index.
  • the second threshold may be determined based on the number of shards in each first node, for example, it may be the mean or upper quartile of the number of shards in each first node.
  • the resource scheduling device can also determine at least one fragment to be migrated through other methods. For example, the resource scheduling device may randomly select at least one fragment to be migrated from multiple fragments of the target index.
  • the resource scheduling device may migrate the at least one fragment to the newly added at least one second node based on a load balancing policy.
  • the following takes the resource scheduling device as the application hosting component shown in Figure 2 as an example to introduce the implementation process of the above steps 102a1 and 102a2.
  • the AASS component can determine the expansion strategy.
  • the expansion strategy includes the number of at least one second node to be added and each node to be added.
  • the node specification of the second node For example, the AASS component can determine the expansion strategy based on the difference between the data write rate and the upper limit of the target rate range.
  • the AASS component can report the difference to the global scheduling component.
  • the global scheduling component can then determine the expansion strategy based on the difference and various alternative node specifications in the resource pool, and deliver the expansion strategy to the AASS component. .
  • the AASS component can add at least one second node to the ES cluster according to the expansion strategy and adjust the sharding deployment strategy.
  • the deployment strategy of shards may refer to the corresponding relationship between each shard in the target index and the nodes on which it is distributed, that is, the mapping relationship between shards and nodes.
  • the target index includes a total of four shards from shard S1 to shard S4, and the read cluster used to carry the four shards includes a total of two first nodes, node 1 and node 2.
  • shard S1 and shard S3 are distributed in node 1
  • shard S2 and shard S4 are distributed in node 2.
  • the AASS component determines that the data writing rate of the target index is greater than the upper limit of the target rate range, it can add a total of two second nodes, Node 3 and Node 4, in the read cluster.
  • the AASS component can adjust the shard deployment strategy as follows: shard S3 is deployed to node 3, and shard S4 is deployed to node 4.
  • the client agent component can connect to the AASS component in real time to obtain the service status of the newly added second node and synchronize the sharding deployment strategy. After the client agent component determines that the service status of the newly added second node is all ready, it can migrate at least one shard to at least one new second node according to the shard deployment strategy. For example, referring to Figure 6, the client agent component may migrate shard S3 to node 3 and shard S4 to node 4.
  • the client proxy component After completing the shard migration, the client proxy component also needs to update the offloading policy and offload data write requests according to the updated offloading policy.
  • the offloading strategy is a strategy for distributing data write requests to each node used to host the target index. For example, referring to Figure 6, before migrating shard S3 and shard S4, the client agent component may distribute data write requests to node 1 and node 2 based on the offloading policy. Moreover, as can be seen from Figure 6, during the process of migrating shard S3 and shard S4, the client proxy component will not distribute data write requests to nodes 3 and 4. Referring to Figure 7, after completing the migration of shard S3 and shard S4, the client agent component can distribute data write requests to node 1, node 2, node 3 and node 4 based on the updated offload policy.
  • the time required to add at least one second node is about 3 to 5 minutes, and the time required for shard migration and traffic switching is about 1 minute.
  • FIG. 8 is a flow chart of a method for reducing the capacity of an ES cluster provided by an embodiment of the present application. Referring to Figure 8, the above step 102 may also include:
  • Step 102b1 Based on the data writing rate of the target index being less than the lower limit of the target rate range, determine at least one first target node to be deleted from the plurality of first nodes.
  • the resource scheduling device may determine at least one first node to be deleted from the plurality of first nodes. A target node.
  • the total number of shards distributed in each first target node may be less than a third threshold. That is, the resource scheduling device can delete the first node with a smaller number of shards. This ensures that the shards in the at least one first target node can be quickly migrated to other first nodes before deleting the at least one first target node.
  • the third threshold may be a fixed value preconfigured in the resource scheduling device. Alternatively, the third threshold may be determined based on the number of shards in each first node, for example, it may be the mean or the lower quartile of the number of shards in each first node.
  • the resource scheduling device can determine the data to be deleted based on the difference between the data writing rate of the target index and the lower limit of the target rate range.
  • the number of at least one first target node is positively related to the difference.
  • the number n2 of at least one first target node to be deleted can satisfy: n2 ⁇ (s3-s1)/(s0 ⁇ m0) Formula (3);
  • s1 is the data write rate of the target index
  • s3 is the lower limit of the target rate range
  • s0 is the data write rate threshold of each processor core.
  • the above formula (3) can also be transformed into: (n2 ⁇ m0) ⁇ (s3-s1)/s0, where (n2 ⁇ m0) is the total number of processor cores included in the at least one first target node.
  • 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 a rate threshold.
  • the resource scheduling device may be based on the difference between the data writing rate of the target index and the lower limit of the target rate range, and the node specifications of each first node. Determine at least one first target node to be deleted. Moreover, the total number of processor cores m2 included in the at least one first target node can satisfy: m2 ⁇ (s3-s1)/s0 Formula (4).
  • the resource scheduling device can also use a cost-priority strategy to determine at least one first target node to be deleted based on the costs of first nodes with different node specifications, so as to effectively reduce the cost of the ES cluster. cost.
  • the resource scheduling device may first determine multiple node combinations that can satisfy the above formula (4), wherein the number of first nodes in different node combinations is different, and/or the specifications of at least one first node are different. Thereafter, the resource scheduling device may select a node combination with the highest cost from the multiple node combinations, and determine the node combination with the highest cost as the combination of at least one first target node to be deleted.
  • Step 102b2 Migrate all the shards distributed in at least one first target node to other first nodes except the at least one first target node.
  • the resource scheduling device After the resource scheduling device determines at least one first target node to be deleted, it can migrate all the fragments distributed in the at least one first target node to other first nodes except the at least one first target node. For example, the resource scheduling device may migrate shards based on a load balancing policy to ensure that after shard migration, the number of shards in each first node except the at least one first target node is relatively balanced.
  • Step 102b3 Delete at least one first target node.
  • the at least one first target node can be deleted.
  • the capacity of the ES cluster can be effectively reduced, that is, the capacity of the ES cluster can be reduced, thereby effectively reducing the cost of the ES cluster.
  • the following takes the resource scheduling device as the application hosting component shown in Figure 2 as an example to introduce the implementation process of the above steps 102b1 to 102b3.
  • the AASS component can determine a capacity reduction strategy.
  • the capacity reduction strategy includes at least one first target node to be deleted, and the at least one first target Deployment strategy for shards in the node.
  • the AASS component can send a node deletion notification to the client agent component to instruct the client agent component to start the deletion process.
  • the client agent component can synchronize the capacity reduction strategy in the AASS component, and migrate all the shards in at least one first target node to other first nodes according to the capacity reduction strategy. For example, referring to Figure 10, the client agent component may migrate shard S3 in node 3 to node 1, and migrate shard S4 in node 4 to node 2.
  • the client proxy component can cut off the business flow of nodes 3 and 4. Also, the client agent component may notify the AASS component that the at least one first target node is deletable. The AASS component can then monitor the service status of the at least one first target node through the AGW. After determining that the data and processes in the at least one first target node have been deleted, the AASS component can delete the at least one first target node. For example, referring to Figures 10 and 11, the AASS component may delete node 3 and node 4.
  • the AASS component can directly call the elastic computing service (elastic computer service, ECS) or automatic scaling service (autoscaling service, AS) interface of the ES cluster to add a second node, or Delete the first target node.
  • ECS elastic computer service
  • AS automatic scaling service
  • AGW can update the service status of the node through the service SDK, which includes the process status and number of sessions in the node.
  • the AASS component monitors AGW and determines that the data and processes in the node have been deleted, and then calls the ECS interface to automatically delete the first target node.
  • the delete function can also be called by the AGW to delete the data and processes in the first target node. After the data and processes in the node are deleted, the ECS interface is called to delete the first target node.
  • the implementation process of the above step 102 is introduced below by taking the above second implementation method (that is, adjusting the node specifications of at least one first node among the plurality of first nodes occupied by the target index) as an example.
  • multiple first nodes in the ES cluster can adopt a serverless architecture.
  • the resource scheduling device may adjust the node specification of at least one first node among the plurality of first nodes. That is to say, the resource scheduling device does not need to adjust the number of nodes used to carry the target index, nor does it need to migrate the shards of the target index. Instead, it can dynamically adjust the node specifications of at least one first node to achieve all the requirements for the target index. Adjustment of the amount of resources occupied.
  • the measurement indicators of node specifications can include at least: the number of processor cores of the node. Therefore, adjusting the node specification of the second target node by the resource scheduling device may mean: adjusting the number of processor cores included in the second target node. If the measurement index of the node specification also includes the memory size of the node, then adjusting the node specification of the second target node may mean: adjusting the number of processor cores and the memory size included in the second target node.
  • the resource scheduling device may increase the node specification of at least one second target node among the plurality of first nodes.
  • the total number of shards distributed in each second target node may be greater than the fourth threshold. That is, the resource scheduling device can increase the node specification of the first node with a larger number of shards.
  • the fourth threshold may be a fixed value preconfigured in the resource scheduling device. Alternatively, the fourth threshold may be determined based on the number of shards in each first node, for example, it may be the mean or upper quartile of the number of shards in each first node.
  • the resource scheduling device can randomly select at least one second target node from a plurality of first nodes.
  • the resource scheduling device may determine the plurality of first nodes as second target nodes, that is, the resource scheduling device may increase the node specifications of each first node.
  • the resource scheduling device may reduce the node specification of at least one third target node among the plurality of first nodes.
  • the total number of shards distributed in each third target node may be less than the fifth threshold. That is, the resource scheduling device can reduce the node specifications of the first node with a smaller number of shards.
  • the fifth threshold may be a fixed value preconfigured in the resource scheduling device. Alternatively, the fifth threshold may be determined based on the number of shards in each first node, for example, it may be the mean or the lower quartile of the number of shards in each first node.
  • the resource scheduling device can randomly select at least one third target node from a plurality of first nodes.
  • the resource scheduling device may determine the plurality of first nodes as third target nodes, that is, the resource scheduling device may reduce the node specifications of each first node.
  • the resource scheduling device can adjust the node specifications of the at least one second target node (or at least one third target node) based on the data writing rate s1 of the target index.
  • the total number of processor cores m3 included in multiple first nodes after adjusting the node specifications can satisfy: m3 ⁇ s1/s0 Formula (5).
  • the resource scheduling device can determine based on the above formula (5) that the total number of processor cores included in the 10 first nodes needs to be greater than or equal to 50 to meet the data writing rate of the target index. The demand for input rate s1. Based on this, the resource scheduling device can adjust the node specifications of the three first nodes in the ES cluster from 4U16G to 8U32G. At this time, the total number of processor cores m3 included in the multiple first nodes after adjusting the node specifications is 52.
  • the resource scheduling device can determine based on the above formula (5) that the total number of processor cores included in the 10 first nodes is greater than or equal to 20 to satisfy the data writing rate of the target index. The demand for input rate s1. Based on this, the resource scheduling device can adjust the node specifications of the 10 first nodes in the ES cluster from 4U16G to 2U8G. At this time, the total number of processor cores m3 included in the multiple first nodes after adjusting the node specifications is 20.
  • the resource scheduling device may adopt any one of the above first implementation manner and the second implementation manner to adjust the target index.
  • the amount of resources occupied by multiple shards may be adopted.
  • the resource scheduling device can also combine the above two implementation methods to adjust the amount of resources occupied by multiple shards in the target index. That is, the resource scheduling device can not only adjust the number of nodes used to carry the target index, but also adjust the number of nodes used to carry the target index.
  • the resource scheduling device may be pre-configured with a corresponding relationship between node specifications and node performance, and the node performance corresponding to different node specifications is recorded in the corresponding relationship.
  • node performance can be characterized by the following parameters: the number of shards that the node can carry, and the maximum data writing rate supported by the node.
  • the resource scheduling device may determine the node specifications of the second node to be added based on the corresponding relationship, and/or adjust the node specifications of the first node. .
  • the amount of resources required by a node to run the search process is different.
  • the amount of resources required to run a single search process of Application 1 is 1U2G
  • the amount of resources required to run a single search process of Application 2 can be 2U4G.
  • the resource scheduling device may be configured with a corresponding relationship associated with the application of the type, and the node performance in the corresponding relationship may be obtained by testing the application of the type.
  • the corresponding relationship configured in the resource scheduling device and associated with a certain type of application may be as shown in Table 1.
  • Table 1 the number of shards that a node with a node specification of 2U8G can carry is 1, and the maximum data write rate it supports is 4Mbps.
  • the number of shards that a node with a node specification of 8U32G can carry is 1, but the maximum data write rate it supports can reach 16Mbps.
  • the resource scheduling device adjusts the node specifications of node 1 and node 2 in the ES cluster to 32U, adds node 3 and node 4 with a node specification of 4U to the ES cluster, and migrates shard S3 to Node 3, migrate shard S4 to node 4.
  • the maximum data write rate supported by node 1 and node 2 is both 64Mbps
  • the maximum data write rate supported by node 3 and node 4 is both 8Mbps.
  • the total data write rate supported by the 4 nodes can reach 144Mbps.
  • the resources used by the fourth target node among the plurality of first nodes may be bidding resources.
  • This bidding resource is a resource with lower cost, and the cost (ie, price) changes with the relationship between supply and demand.
  • the resource scheduling device may purchase a fixed-duration bidding resource as a resource of the fourth target node within a specific period of time (for example, at night).
  • a specific period of time for example, at night.
  • the resource scheduling device may purchase bidding resources according to a preset target price as resources of the fourth target node. If the target price is higher than the market price of the bidding resources and the resource pool has sufficient resource inventory, the ES cluster can continue to occupy the bidding resources. If the target price is lower than the market price of the bidding resources, or the resource inventory of the resource pool does not exist, the resource pool will send an early warning notification to the resource scheduling device and automatically release (i.e., withdraw) the bidding resources after a certain period of time.
  • FIG 13 is a flow chart of another resource scheduling method provided by an embodiment of the present application. As shown in Figure 13, the resource scheduling method may also include:
  • Step 103 Based on the remaining available time of the bidding resource used by the fourth target node being less than the time duration threshold, add at least one third node to the ES cluster.
  • the resource scheduling device can add at least one third node in the ES cluster (for example, the write cluster) to migrate the shards in the fourth target node to the at least one The third node.
  • the duration threshold may be greater than the duration required to migrate the shards in the fourth target node. This ensures that the shards in the fourth target node can complete migration before the bidding resources used by the fourth target node are released, thereby avoiding any impact on the business.
  • the resources used by the at least one third node newly added by the resource scheduling device may include on-demand resources and/or bidding resources.
  • the resource scheduling device may select on-demand resources and/or bidding resources from the resource pool as resources used by at least one third node according to a cost priority strategy.
  • on-demand resources refer to resources purchased according to business needs, and their costs are higher than bidding resources.
  • the resource scheduling device can monitor the remaining available duration of the bidding resources used by the fourth target node in real time.
  • the remaining available time may be equal to the difference between the fixed time and the used time of the bidding resource.
  • the resource scheduling device can add at least one third node in the ES cluster.
  • the resource scheduling device can, when the used duration of the bidding resources reaches 1 hour and 40 minutes, Add at least one third node to the ES cluster.
  • the target index is used to store live broadcast log data
  • the live broadcast log data is generally packaged at a granularity of 5 minutes, uploaded to the ES cluster and indexed
  • the migration process of shards is started when the remaining available time of the bidding resource is 20 minutes. Sufficient migration time is reserved for shards to avoid affecting business performance.
  • the resource scheduling device can determine that the remaining available time of the bidding resource is less than the duration threshold when receiving the early warning notification sent by the resource pool, and add at least one new resource in the ES cluster.
  • the duration threshold can be the reserved duration between when the resource pool sends an early warning notification and when the bidding resource is automatically released.
  • the resource scheduling device when it adds at least one third node to the ES cluster, it can determine the number of at least one third node to be added based on the data writing rate of the target index, and the number of each third node. Specification. For example, the total number of processor cores included in the at least one third node and other first nodes in the ES cluster except the fourth target node can satisfy the above formula (5).
  • Step 104 Migrate all the shards in the fourth target node to the at least one third node.
  • the resource scheduling device can migrate all the shards in the fourth target node to the at least one third node.
  • the resource scheduling device may migrate the shards to the at least one third node based on a load balancing policy.
  • step 104 For the implementation process of step 104, reference can be made to the above-mentioned step 102a2 and step 102b2, which will not be described again here.
  • Step 105 Delete the fourth target node.
  • the resource scheduling device can delete the fourth target node to release the bidding resources used by the fourth target node.
  • step 105 For the implementation process of step 105, reference can be made to the above-mentioned step 102b3, which will not be described again here.
  • the following takes the resource scheduling device as the application hosting component shown in Figure 2 as an example to introduce the implementation process of the above steps 103 to 105.
  • the AASS component when the AASS component detects that the remaining available duration of the bidding resources used by the fourth target node (such as node 3 and node 4 in Figure 14) is less than the duration threshold, it can determine the node replacement strategy.
  • the node replacement strategy includes The number of at least one third node to be added, and the node specifications of each third node to be added.
  • the AASS component can report node demand information to the global scheduling component.
  • the global scheduling component can then determine the node replacement strategy based on the node demand information and multiple alternative node specifications, and deliver the node replacement strategy to the AASS component.
  • the node demand information may refer to the total number of new processor cores required.
  • the AASS component can add at least one third node to the ES cluster according to the node replacement strategy and adjust the sharding deployment strategy. For example, referring to Figure 15, the AASS component can add a total of two third nodes, node 5 and node 6. Moreover, the AASS component can adjust the shard deployment strategy as follows: shard S3 is deployed to node 5, and shard S4 is deployed to node 6.
  • the client agent component can migrate at least one shard to at least one newly added third node according to the adjusted shard deployment strategy. For example, referring to Figure 15, the client agent component may migrate shard S3 in node 3 to node 5, and migrate shard S4 in node 4 to node 6. When the remaining available time of the bidding resources used by Node 3 and Node 4 is zero, as shown in Figure 16, the AASS component can delete Node 3 and Node 4.
  • the method provided by the embodiment of the present application can flexibly adjust the data writing performance of the target index by adjusting the amount of resources occupied by multiple shards in the target index, that is, it can achieve write elasticity of the ES cluster. .
  • the solution provided by the embodiment of the present application can be used in scenarios where a large amount of written data is stored, and the amount of written data fluctuates greatly over time.
  • the target index can be used to store media log data or transaction data for a trading system.
  • the media log data may include: live broadcast log data, on-demand log data, etc.
  • the resource scheduling device adjusts the amount of resources occupied by multiple shards in the target index according to the data writing rate of the target index.
  • the ES cluster may further include multiple fourth nodes, and the target index may further include multiple replicas, and the multiple replicas are hosted by the multiple fourth nodes.
  • the plurality of fourth nodes may form a read cluster for the target index.
  • the plurality of fourth nodes may be nodes N r1 to N rN in FIG. 2 .
  • the resource scheduling device can also flexibly adjust the number of copies included in the target index based on the data reading frequency of the target index to achieve read elasticity of the ES cluster.
  • the resource scheduling method provided by the embodiment of the present application may also include:
  • Step 106 Count the data reading frequency of the target index.
  • the resource scheduling device can count the data reading frequency of the target index in real time or periodically.
  • the data reading frequency can refer to the number of data reading requests for the target index received within a unit time.
  • the data reading frequency counted by the resource scheduling device at each statistical time may refer to: the number of data reading requests received within the second target duration before the statistical time and the second target duration. ratio. For example, assuming that the statistical unit of the second target duration is seconds, the data reading frequency can be requests per second (queries per second, QPS).
  • the second target duration may be equal to or may not be equal to the first target duration when the statistical data writing rate is used.
  • both the second target duration and the first target duration can be 5 minutes.
  • Step 107 Based on the data reading frequency of the target index being outside the target frequency range, adjust the number of copies included in the target index.
  • Each copy in the target index is obtained by copying a shard of the target index, that is, the data stored in each copy is the same as the data stored in the corresponding shard of the copy. Moreover, the number of replicas in different shards in the target index can be the same or different.
  • the copies of the target index can provide data query services, and the greater the number of copies included in the target index, the higher the maximum data reading frequency supported by the target index.
  • a target frequency range is prestored in the resource scheduling device, and the target frequency range may be determined based on the number of copies currently included in the target index.
  • the identification of the target shard used to store the document needs to be calculated based on the number of shards included in the target index. For example, the following formula can be used to calculate the target shard identifier shard_num:
  • shard_num hash(routing)%num_primary_shards Formula (6);
  • hash represents the hash operation
  • routing is the preset routing key
  • num_primary_shards is the number of shards included in the target index.
  • the number of shards included in the target index cannot be adjusted, and the number of replicas can be flexibly adjusted, the greater the number of replicas included in the target index, the higher the maximum data reading frequency it can support, that is, the number of replicas included in the target index is higher.
  • the data reading performance of the fourth node is also better.
  • the number of replicas that each fourth node in the ES cluster can carry is positively related to the node specifications of the fourth node, in this embodiment of the present application, based on the node specifications of multiple fourth nodes in the ES cluster, Determine the target frequency range.
  • the plurality of fourth nodes may intersect with the plurality of first nodes mentioned above, or the plurality of fourth nodes may be independent of the plurality of first nodes.
  • the plurality of first nodes may refer to nodes in the write cluster
  • the plurality of fourth nodes may refer to nodes in the read cluster.
  • the resource scheduling device may obtain the preset data reading frequency threshold r0 of each processor core, that is, the single-core data reading frequency. Afterwards, the target frequency range may be determined based on the product of the data reading frequency threshold r0 and the total number m4 of processor cores included in the plurality of fourth nodes. For example, the target frequency range may be (r0 ⁇ m4) ⁇ r. Wherein, ⁇ r is a preset reading rate fluctuation value, which may be a number greater than or equal to 0.
  • the resource scheduling device can determine that the target frequency range is (200 ⁇ r) QPS. If the preset reading rate fluctuation value ⁇ r is 0, the target frequency range may be equal to 200 QPS.
  • the resource scheduling device may determine that the data reading performance of the plurality of fourth nodes does not match the data reading frequency of the target index. If the data reading frequency of the target index is greater than the upper limit of the target frequency range, the resource scheduling device may determine that the data reading performance of the plurality of fourth nodes cannot support the data reading frequency. If the data reading frequency of the target index is less than the lower limit of the target frequency range, the resource scheduling device may determine that the data reading performance of the plurality of fourth nodes is not fully utilized, that is, the resource utilization rate of the ES cluster is low.
  • the resource scheduling device can adjust the number of copies included in the target index so that the number of copies included in the target index can match the data reading frequency.
  • the resource utilization of the ES cluster can be effectively improved while ensuring data reading performance.
  • the resource scheduling device can add at least one fifth node in the ES cluster, and can add a new node in each fifth node. Add at least one copy of the target index.
  • the number of newly added replicas in each fifth node may be positively related to the node specifications of the fifth node. That is, the higher the node specification of the fifth node, the more replicas can be added to the fifth node.
  • the node specifications of the at least one fifth node are all preset specifications.
  • the number of the at least one fifth node may be determined based on the difference between the data reading frequency and the upper limit of the target frequency range, and the number of the at least one fifth node is positively related to the difference.
  • the number n3 of at least one fifth node to be added can satisfy:
  • r1 is the data reading frequency of the target index
  • r2 is the upper limit of the target frequency range
  • r0 is the data reading frequency threshold of each processor core.
  • the above formula (7) can also be transformed into: (n3 ⁇ m0) ⁇ (r1-r2)/r0, where (n3 ⁇ m0) is the total number of processor cores included in at least one newly added fifth node.
  • the AASS component detects through the AGW that the data reading frequency r1 of the target index is 210QPS, the AASS component can determine a fifth node that needs to be added with a node specification of 4U16G based on the above formula (7).
  • the AASS component can add node 3 in the ES cluster and add a copy in node 3. This copy is hosted by a search process, and the service SDK is integrated in the search process.
  • the available nodes in the resource pool have multiple alternative node specifications that differ from each other.
  • the resource scheduling device may determine the number of at least one fifth node to be added and the number of each fifth node to be added based on the difference between the data reading frequency and the upper limit of the target frequency range and the multiple different alternative node specifications.
  • the node specifications of each fifth node are selected from specifications of multiple candidate nodes, and the node specifications of different fifth nodes may be the same or different.
  • the total number of processor cores m5 included in the at least one fifth node can satisfy:
  • the resource scheduling device may determine the number of at least one fifth node and the node specification of each fifth node based on the cost of each alternative node specification using a cost priority strategy. As a result, the cost of adding new nodes can be reduced while ensuring that the data reading performance of the ES cluster is effectively improved.
  • the resource scheduling device can determine at least one fifth target node from a plurality of fourth nodes, and can delete each fifth target node. Replicas distributed among five target nodes. Afterwards, the resource scheduling device can delete the at least one fifth target node.
  • the at least one fifth target node may satisfy at least one of the following conditions: the number of copies distributed in the node is less than a sixth threshold; the data reading frequency of the node is less than a seventh threshold. That is, the resource scheduling device may delete the fourth node with a smaller number of shards, and/or delete the fourth node with a smaller number of received data read requests.
  • Both the sixth threshold and the seventh threshold may be fixed values preconfigured in the resource scheduling device.
  • the sixth threshold may be determined based on the number of replicas in each fourth node, for example, it may be the mean or the lower quartile of the number of replicas in each fourth node.
  • the seventh threshold may be determined based on the data reading frequency of each fourth node, for example, it may be the mean or the lower quartile of the data reading frequency in each fourth node.
  • FIG. 18 is a schematic diagram of the data reading frequency of a target index provided by an embodiment of the present application, and FIG. 18 takes the target index being used to store media log data as an example.
  • the horizontal axis in Figure 18 is time in hours, and the vertical axis is data reading frequency in times/minute. Referring to Figure 18, it can be seen that the data reading frequency of this target index is generally low, with a peak value of approximately 7 times/minute. If the data reading frequency supported by a fourth node in the ES cluster is 20QPS, better data reading performance can be ensured.
  • FIG. 19 is a schematic diagram of the data writing frequency of a target index provided by an embodiment of the present application, and FIG. 19 takes the target index being used to store media log data as an example.
  • the horizontal axis in Figure 19 is time in hours, and the vertical axis is data writing frequency in times/minute.
  • the peak range of the data writing frequency of the target index is approximately 0.56 million (W) times/minute to 13.7W times/minute. Because data is written more frequently to the target index, the data write rate to the target index is also higher. And it can also be seen from Figure 19 that the data writing rate of the target index also fluctuates greatly with time.
  • the solution provided by the embodiment of the present application can dynamically adjust the amount of resources occupied by the target index according to the data writing rate of the target index, it can achieve dynamic elasticity of data writing performance, thereby effectively ensuring data writing performance. Improve resource utilization of ES cluster.
  • the sequence of the steps of the resource scheduling method for the ES cluster provided by the embodiment of the present application can be adjusted appropriately, and the steps can also be increased or decreased accordingly according to the situation.
  • the above-mentioned steps 103 to 105 can be deleted according to the situation; or the above-mentioned steps 106 and 107 can be deleted according to the situation; or the above-mentioned steps 106 and 107 can be executed before step 105; or, the above-mentioned steps 103 to 107 can be deleted according to the situation.
  • 105 may be performed before step 102.
  • the embodiments of this application provide a resource scheduling method for an ES cluster.
  • This method can count the data writing rate of the target index, and can dynamically adjust the amount of node resources occupied by multiple shards of the target index when the data writing rate is outside the target rate range. Since the data storage capacity of the target index and the maximum data writing rate supported are related to the amount of resources occupied by the multiple shards, the method provided by the embodiment of the present application can be used without changing the shards included in the target index. Under the premise of quantity, the data storage capacity and maximum data writing rate of the target index can be dynamically adjusted. This not only effectively improves the flexibility of data writing, but also effectively improves the utilization of cluster resources.
  • the method provided by the embodiments of this application can also flexibly adjust the number of copies included in the target index based on the data reading frequency of the target index, thereby achieving read elasticity of the ES cluster.
  • Embodiments of the present application provide a resource scheduling device for an ES cluster.
  • the resource scheduling device can be used to implement the resource scheduling method for an ES cluster provided in the above method embodiment.
  • the ES cluster includes multiple first nodes for hosting a target index, where the target index includes multiple shards.
  • the resource scheduling device may be deployed in a cloud platform.
  • the resource scheduling device may be an application hosting component such as shown in FIG. 2 .
  • the resource scheduling device includes:
  • the statistics module 201 is used to count the data writing rate of the target index.
  • the statistics module 201 please refer to the relevant description of step 101 above.
  • the adjustment module 202 is configured to adjust the amount of resources of the node occupied by the multiple shards based on the data writing rate of the target index being outside the target rate range.
  • the adjustment module 202 please refer to the relevant description of step 102 above.
  • the adjustment module 202 may be used to: add at least one second node to the ES cluster based on the data writing rate of the target index being greater than the upper limit of the target rate range; At least one shard is migrated to the at least one second node.
  • the adjustment module 202 For the functional implementation of the adjustment module 202, reference may also be made to the relevant descriptions of the above-mentioned steps 102a1 to 102a2.
  • the adjustment module 202 can also be used to: before adding at least one second node in the ES cluster, determine the difference between the data writing rate based on the target index and the upper limit of the target rate range. value to determine the number of the at least one second node to be added. Wherein, the quantity is positively related to the difference, and the node specifications of the at least one second node are all preset specifications.
  • the adjustment module 202 can also be used to: before adding at least one second node in the ES cluster, adjust the data writing rate based on the target index and the upper limit of the target rate range.
  • the node specification of each second node is selected from the specifications of the multiple candidate nodes.
  • the total number m1 of processor cores included in the at least one second node satisfies: m1 ⁇ (s1-s2)/s0.
  • s1 is the data write rate of the target index
  • s2 is the upper limit of the target rate range
  • s0 is the data write rate threshold of each processor core.
  • the resources used by the at least one second node are bidding resources.
  • the at least one shard satisfies at least one of the following conditions: the amount of data written in the shard is less than a first threshold; the total number of shards distributed in the first node where the shard is located is greater than the second threshold. threshold.
  • the adjustment module 202 may be configured to: determine at least one first target node to be deleted from the plurality of first nodes based on the data writing rate of the target index being less than the lower limit of the target rate range; Migrate the fragments distributed in at least one first target node to other first nodes except the at least one first target node; delete the at least one first target node.
  • the adjustment module 202 For the functional implementation of the adjustment module 202, reference can also be made to the relevant descriptions of the above-mentioned steps 102b1 to 102b3.
  • the at least one first target node satisfies: the total number of fragments distributed in the node is less than a third threshold.
  • the adjustment module 202 may be configured to adjust the node specifications of at least one first node among the plurality of first nodes based on the data writing rate of the target index being outside the target rate range.
  • the adjustment module 202 may be configured to: increase the node specifications of at least one second target node among the plurality of first nodes based on the data writing rate of the target index being greater than the upper limit of the target rate range. Alternatively, based on the data writing rate of the target index being less than the lower limit of the target rate range, reduce the node specification of at least one third target node in the plurality of first nodes.
  • the resources used by the fourth target node among the plurality of first nodes are bidding resources; the adjustment module 202 can also be configured to: based on the remaining available time of the bidding resources used by the fourth target node being less than a time length threshold , add at least one third node in the ES cluster; migrate all the shards distributed in the fourth target node to the at least one third node; delete the fourth target node.
  • the adjustment module 202 For the functional implementation of the adjustment module 202, reference may also be made to the relevant descriptions of the above steps 103 to 105.
  • the resources used by the at least one third node include on-demand resources and/or bidding resources.
  • the ES cluster may also include multiple fourth nodes, and the multiple fourth nodes are used to host multiple copies of the target index.
  • the statistics module 201 can also be used to count the data reading frequency of the target index.
  • the functional implementation of the statistics module 201 may also refer to the relevant description of step 106 above.
  • the adjustment module 202 may also be used to adjust the number of copies included in the target index based on the data reading frequency of the target index being outside the target frequency range.
  • the functional implementation of the adjustment module 202 may also refer to the relevant description of the above step 107.
  • the adjustment module 202 may be used to: based on the data reading frequency of the target index being greater than the upper limit of the target frequency range, add at least one fifth node to the ES cluster; add a new node to each fifth node. Add at least one copy of the target index.
  • the adjustment module 202 may be configured to: based on the data reading frequency of the target index being less than the lower limit of the target frequency range, delete the copies distributed in at least one fifth target node among the plurality of fourth nodes, and delete the at least one fifth target node.
  • the resource scheduling device is the application hosting component shown in Figure 2
  • the function of the statistics module 201 can be implemented by the service SDK, AGW and AASS components
  • the function of the adjustment module 202 can be implemented by the AASS component, client End proxy component and global scheduling component are implemented.
  • embodiments of the present application provide a resource scheduling device for an ES cluster.
  • the device can count the data writing rate of the target index, and can dynamically adjust the amount of node resources occupied by multiple shards of the target index when the data writing rate is outside the target rate range. Since the data storage capacity of the target index and the maximum data writing rate supported are related to the amount of resources occupied by the multiple shards, the device provided by the embodiment of the present application can be used without changing the shards included in the target index. Under the premise of quantity, the data storage capacity and maximum data writing rate of the target index can be dynamically adjusted. This not only effectively improves the flexibility of data writing, but also effectively improves the utilization of cluster resources.
  • each module in the resource scheduling device can be implemented by software, or can be implemented by hardware.
  • the following uses the statistics module 201 as an example to introduce the implementation of the statistics module 201.
  • the implementation of the adjustment module 202 may refer to the implementation of the statistics module 201.
  • the statistics module 201 may include code running on a computing instance.
  • the computing instance may include at least one of a physical host (computing device), a virtual machine, and a container. Furthermore, the above computing instance may be one or more.
  • statistics module 201 may include code running on multiple hosts/virtual machines/containers. It should be noted that multiple hosts/virtual machines/containers used to run the code can be distributed in the same region (region) or in different regions. Furthermore, multiple hosts/virtual machines/containers used to run the code can be distributed in the same availability zone (AZ) or in different AZs. Each AZ includes one data center or multiple AZs. geographically close data centers. Among them, usually a region can include multiple AZs.
  • the multiple hosts/VMs/containers used to run the code can be distributed in the same virtual private cloud (VPC), or across multiple VPCs.
  • VPC virtual private cloud
  • Cross-region communication between two VPCs in the same region and between VPCs in different regions requires a communication gateway in each VPC, and the interconnection between VPCs is realized through the communication gateway. .
  • the statistics module 201 may include at least one computing device, such as a server.
  • the statistics module 201 may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD).
  • ASIC application-specific integrated circuit
  • PLD programmable logic device
  • the above-mentioned PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (field-programmable gate array, FPGA), a general array logic (generic array logic, GAL), or any combination thereof.
  • CPLD complex programmable logical device
  • FPGA field-programmable gate array
  • GAL general array logic
  • Multiple computing devices included in the statistics module 201 may be distributed in the same region or in different regions. Multiple computing devices included in the statistics module 201 may be distributed in the same AZ or in different AZs. Similarly, multiple computing devices included in the statistics module 201 may be distributed in the same VPC or in multiple VPCs.
  • the plurality of computing devices may be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
  • the statistics module 201 can be used to perform any step in the above resource scheduling method, and the adjustment module 202 can also be used to perform any step in the above resource scheduling method.
  • the steps that the statistics module 201 and the adjustment module 202 are responsible for implementing can be specified as needed.
  • the statistics module 201 and the adjustment module 202 respectively implement different steps in the resource scheduling method to realize all functions of the resource scheduling device.
  • Figure 21 is a schematic structural diagram of a computing device provided by an embodiment of the present application.
  • the computing device may include a bus 2102, a processor 2104, a memory 2106, and a communication interface 2108.
  • the processor 2104, the memory 2106 and the communication interface 2108 communicate through the bus 2102.
  • the computing device may be a server or an end device. It should be understood that the embodiments of the present application do not limit the number of processors and memories in the computing device.
  • the bus 2102 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc.
  • PCI peripheral component interconnect
  • EISA extended industry standard architecture
  • the bus can be divided into address bus, data bus, control bus, etc. For ease of presentation, only one line is used in Figure 21, but it does not mean that there is only one bus or one type of bus.
  • Bus 2102 may include a path that carries information between various components of the computing device (eg, memory 2106, processor 2104, communications interface 2108).
  • the processor 2104 may include a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP) or a digital signal processor (DSP). any one or more of them.
  • CPU central processing unit
  • GPU graphics processing unit
  • MP microprocessor
  • DSP digital signal processor
  • Memory 2106 may include volatile memory, such as random access memory (RAM).
  • the processor 2104 may also include non-volatile memory (non-volatile memory), such as read-only memory (ROM), flash memory, mechanical hard disk drive (hard disk drive, HDD) or solid state drive (solid state drive). drive, SSD).
  • ROM read-only memory
  • HDD hard disk drive
  • SSD solid state drive
  • the memory 2106 stores executable program code, and the processor 2104 executes the executable program code to respectively implement the functions of the aforementioned statistical module and the adjustment module, thereby implementing the resource scheduling method provided by the above method embodiment. That is, the memory 2106 stores instructions for executing the resource scheduling method.
  • the communication interface 2108 uses transceiver modules such as, but not limited to, network interface cards and transceivers to implement communication between the computing device and other devices or communication networks.
  • An embodiment of the present application also provides a computing device cluster.
  • the computing device cluster includes at least one computing device.
  • the computing device may be a server, such as a central server, an edge server, or a local server in a local data center.
  • the computing device may also be a terminal device such as a desktop computer, a laptop computer, or a smartphone.
  • the computing device cluster includes at least one computing device.
  • the same instructions for executing the above resource scheduling method may be stored in the memory 2106 of one or more computing devices in the computing device cluster.
  • the memory 2106 of one or more computing devices in the computing device cluster may also store part of the instructions for executing the above resource scheduling method.
  • a combination of one or more computing devices may jointly execute instructions for performing the above resource scheduling method.
  • memories 2106 in different computing devices in the computing device cluster can store different instructions, respectively used to execute part of the functions of the resource scheduling device. That is, instructions stored in the memory 2106 in different computing devices may implement the functions of one or more of the statistics module and the adjustment module.
  • one or more computing devices in a cluster of computing devices may be connected through a network.
  • the network may be a wide area network or a local area network, etc.
  • An embodiment of the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be any available medium that a computing device can store or a data storage device such as a data center that contains one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, tape), optical media (eg, DVD), or semiconductor media (eg, solid state drive), etc.
  • the computer-readable storage medium includes instructions, which instruct the computing device to execute the resource scheduling method of the ES cluster provided by the above method embodiment.
  • An embodiment of the present application also provides a computer program product containing instructions.
  • the computer program product may be a software or program product containing instructions capable of running on a computing device or stored in any available medium.
  • the computer program product is run on at least one computing device, at least one computing device is caused to execute the resource scheduling method of the ES cluster provided by the above method embodiment.
  • Embodiments of the present application also provide an elastic search system, which can provide cloud search service (CSS).
  • the elastic search system may include an ES cluster such as that shown in Figure 1, and a resource scheduling device for scheduling resources of the ES cluster.
  • the ES cluster may include multiple nodes.
  • the multiple nodes can be deployed in a read-write separation manner, and can be deployed in a storage-computation separation manner.
  • the resource scheduling device can be used to implement the resource scheduling method of the ES cluster provided in the above method embodiment.
  • the resource scheduling device may be the application hosting component shown in FIG. 2
  • the structure of the resource scheduling device may refer to any of the drawings in FIG. 20 to FIG. 22 .
  • the terms “first”, “second” and “third” are only used for description purposes and cannot be understood as indicating or implying relative importance.
  • the term “and/or” in this application is just an association relationship describing related objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, alone There are three situations B.
  • the character "/" in this article generally indicates that the related objects are an "or" relationship.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Fuzzy Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请提供了一种弹性搜索集群的资源调度方法、装置及系统,属于数据存储技术领域。本申请提供的方案能够统计目标索引的数据写入速率,并能够在该数据写入速率处于目标速率范围之外时,动态调整该目标索引的多个分片所占用的节点的资源量。由于目标索引的数据存储容量,以及所支持的最大数据写入速率均与该多个分片所占用的资源量相关,因此本申请提供的方案能够在不改变目标索引所包括的分片数量的前提下,实现对目标索引的数据存储容量和最大数据写入速率的动态调节。由此,不仅有效提高了数据写入的灵活性,且有效提高了集群资源的利用率。

Description

弹性搜索集群的资源调度方法、装置及系统
本申请要求于2022年5月11日提交的申请号为202210510751.2、发明名称为“一种数据处理方法和计算机”的中国专利申请的优先权,以及要求于2022年6月29日提交的申请号为202210764591.4、发明名称为“弹性搜索集群的资源调度方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据存储技术领域,特别涉及一种弹性搜索集群的资源调度方法、装置及系统。
背景技术
弹性搜索(elastic-search,ES)是一种分布式、高扩展和高实时的数据搜索引擎,其能够以集群(cluster)为单位提供数据搜索服务。其中,集群通常包括多个节点(node),每个节点可以是一台物理机或虚拟机(virtual machine,VM)。
在ES集群中,数据存储和搜索的最小单位为文档,用于存储文档的逻辑空间(即容器)称为索引(index)。为了提高索引的数据存储量以及实现高可用性,可以将索引划分为多个分片(shard),并为每个分片创建对应的至少一个副本(replica)。其中,每个分片与其所对应的至少一个副本分布在不同的节点中。在索引中存储文档时,需要先基于该文档的标识(identity,ID),以及该索引所包括的分片的数量,计算出用于存储该文档的目标分片。之后,即可将文档存储至该目标分片,并由目标分片将文档同步至其所对应的至少一个副本。当需要从索引中读取文档时,可以基于文档的ID以及索引包括的分片的数量,确定出存储有该文档的目标分片,并从该目标分片中进行读取。
由于在索引中存储文档,以及从索引中读取文档时,需要基于该索引所包括的分片的数量计算目标分片,因此索引所包括的分片的数量应是固定的。也即是,在索引创建后,该索引所包括的分片的数量将无法再修改。由此,导致数据写入的灵活性较低。
发明内容
本申请提供了一种弹性搜索集群的资源调度方法、装置及系统,可以解决ES集群中数据写入灵活性较低的技术问题。
第一方面,提供了一种ES集群的资源调度方法,该ES集群包括多个第一节点,该多个第一节点用于承载目标索引的多个分片。该方法包括:统计目标索引的数据写入速率,以及基于该目标索引的数据写入速率处于目标速率范围之外,调整该目标索引的多个分片所占用的节点的资源量。
由于目标索引的数据存储容量,以及所支持的最大数据写入速率均与该多个分片所占用的资源量相关,因此本申请提供的方案能够在不改变目标索引所包括的分片数量的前提下,实现对目标索引的数据存储容量和最大数据写入速率的动态调节。由此,不仅有效提高了数据写入的灵活性,且有效提高了集群资源的利用率。
可选地,基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个分片所占 用的节点的资源量的过程可以包括:基于该目标索引的数据写入速率大于目标速率范围的上限,在该ES集群新增至少一个第二节点,并将该多个分片中的至少一个分片迁移至该至少一个第二节点。
通过在ES集群中新增至少一个第二节点,可以实现对ES集群的扩容,并使得目标索引所占用的资源量增多。由此,能够有效提升目标索引的数据存储容量和最大数据写入速率,以使得该目标索引的数据写入性能能够与当前实际的数据写入速率相匹配。
可选地,在ES集群新增至少一个第二节点之前,该方法还可以包括:基于该目标索引的数据写入速率与该目标速率范围的上限的差值,确定待新增的至少一个第二节点的数量。其中,该数量与差值正相关,且该至少一个第二节点的节点规格均为预设规格。
本申请提供的方案可以根据写入速率的差值,在ES集群中新增预设规格的至少一个第二节点。该新增第二节点的方式较为简单,效率较高。
可选地,在ES集群新增至少一个第二节点之前,该方法还可以包括:基于该目标索引的数据写入速率与该目标速率范围的上限的差值,以及互不相同的多种备选的节点规格,确定待新增的至少一个第二节点的数量,以及每个第二节点的节点规格。其中,每个第二节点的节点规格是从该多种备选节点的规格中选取的。
若资源池中的可用节点具有多种不同的节点规格,则本申请提供的方案可以根据写入速率的差值,从该多种不同节点规格的可用节点中确定至少一个第二节点。该新增第二节点的方式的灵活性较高。例如,本申请提供的方案可以基于每种备选的节点规格的成本,采用成本优先的策略确定至少一个第二节点。由此,可以有效降低新增节点的成本。
可选地,该至少一个第二节点包括的处理器核的总数m1可以满足:m1≥(s1-s2)/s0。其中,s1为目标索引的数据写入速率,s2为目标速率范围的上限,s0为每个处理器核的数据写入速率阈值。
基于上述公式,可以确保新增至少一个第二节点后,用于承载目标索引的多个第一节点以及至少一个第二节点的数据写入性能可以与该目标索引的数据写入速率相匹配。
可选地,该至少一个第二节点所采用的资源可以为竞价资源。由于竞价资源的成本较低,因此本申请提供的方案可以优先采用竞价资源作为新增节点的资源。
可选地,该至少一个分片可以满足下述条件中的至少一种:分片中已写入的数据量小于第一阈值;分片所在的第一节点中分布的分片的总数大于第二阈值。
基于上述条件可知,本申请提供的方案可以选择已写入的数据量较小的分片进行迁移,和/或,选择分片数量较多的第一节点中的分片进行迁移。由此,可以有效提高分片的迁移效率,降低迁移成本,并确保各个第一节点中的分片数量较为均衡。
可选地,基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个分片所占用的节点的资源量的过程可以包括:基于该目标索引的数据写入速率小于目标速率范围的下限,从该多个第一节点中确定待删除的至少一个第一目标节点;将该至少一个第一目标节点中分布的分片均迁移至除该至少一个第一目标节点之外的其他第一节点,以及删除该至少一个第一目标节点。
若目标索引的数据写入速率小于目标速率范围的下限,则表明ES集群中的多个第一节点的数据写入性能未被充分利用。由此,能够通过删除至少一个第一节点的方式缩减ES集群的容量,从而有效提高ES集群的资源利用率,并降低ES集群的成本。
可选地,每个第一目标节点中分布的分片的总数小于第三阈值。也即是,本申请提供的 方案可以删除分片数量较少的第一节点。由此,可以确保在删除该至少一个第一目标节点之前,能够快速将该至少一个第一目标节点中的分片迁移至其他第一节点。
可选地,基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个分片所占用的节点的资源量的过程可以包括:基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个第一节点中至少一个第一节点的节点规格。
本申请提供的方案还能够在不改变分片所属的第一节点的前提下,通过动态调整第一节点的节点规格,以实现对目标索引所占用的资源量的调节。
可选地,基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个第一节点中至少一个第一节点的节点规格的过程可以包括:基于该目标索引的数据写入速率大于目标速率范围的上限,增大该多个第一节点中至少一个第二目标节点的节点规格。其中,该至少一个第二目标节点可以是ES集群中分片数量较多的第一节点。
可选地,基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个第一节点中至少一个第一节点的节点规格的过程可以包括:基于该目标索引的数据写入速率小于目标速率范围的下限,减小该多个第一节点中至少一个第三目标节点的节点规格。其中,该至少一个第三目标节点可以是ES集群中分片数量较少的第一节点。
可选地,该多个第一节点中第四目标节点所采用的资源为竞价资源。该方法还可以包括:基于该第四目标节点所采用的竞价资源的剩余可用时长小于时长阈值,在该ES集群新增至少一个第三节点;将该第四目标节点中分布的分片均迁移至该至少一个第三节点,以及删除该第三目标节点。
由于竞价资源的成本较低,因此本申请提供的方案可以采用竞价资源作为第四目标节点的资源,并可以在该竞价资源的剩余使用时长小于时长阈值时,及时将第四目标节点中的分片迁移至新增的第三节点。由此,可以在确保ES集群的数据读写性能的前提下,有效降低ES集群的成本。
可选地,该至少一个第三节点所采用的资源可以包括按需资源和/或竞价资源。其中,按需资源是指根据业务需求购置的资源,其成本比竞价资源高。例如,本申请提供的方案可以按照成本优先的策略,确定该至少一个第三节点所采用的资源的类型。
可选地,该ES集群还可以包括多个第四节点,该多个第四节点用于承载目标索引的多个副本。该方法还可以包括:统计该目标索引的数据读取频率,以及基于该目标索引的数据读取频率位于目标频率范围之外,调整该目标索引所包括的副本的数量。
本申请提供的方案通过调整目标索引所包括的副本的数量,可以使得目标索引所包括的副本的数量能够与该数据读取频率相匹配。由此,可以在确保数据读取性能的前提下,有效提高ES集群的资源利用率。
可选地,基于该目标索引的数据读取频率位于目标频率范围之外,调整该目标索引所包括的副本的数量的过程可以包括:基于该目标索引的数据读取频率大于目标频率范围的上限,在ES集群新增至少一个第五节点,并在每个第五节点中新增该目标索引的至少一个副本。
通过在ES集群中新增第五节点,并在第五节点中新增至少一个副本,可以有效提升该ES集群的数据读取性能。
可选地,基于该目标索引的数据读取频率位于目标频率范围之外,调整该目标索引所包括的副本的数量的过程可以包括:基于该目标索引的数据读取频率小于目标频率范围的下限,删除该多个第四节点中至少一个第五目标节点中分布的副本,之后,删除该至少一个第五目 标节点。
若目标索引的数据读取频率小于目标频率范围的下限,则表明ES集群中的多个第四节点的数据读取性能未被充分利用。由此,能够通过删除至少一个第五目标节点的方式缩减ES集群的容量,从而有效提高ES集群的资源利用率,并降低ES集群的成本。
第二方面,提供了一种ES集群的资源调度装置,该资源调度装置可以包括至少一个模块,该至少一个模块可以用于实现上述方面所提供的ES集群的资源调度方法。
第三方面,提供了一种计算设备集群,该计算设备集群包括至少一个计算设备,每个计算设备包括处理器和存储器。该至少一个计算设备的处理器用于执行该至少一个计算设备的存储器中存储的指令,以使得计算设备集群执行上述方面所提供的ES集群的资源调度方法。
第四方面,提供了一种计算机可读存储介质,该计算机可读存储介质中存储有计算机程序指令,当该计算机程序指令由计算设备集群执行时,该计算设备集群执行如上述方面所提供的ES集群的资源调度方法。
第五方面,提供了一种包含指令的计算机程序产品,当该指令被计算设备集群运行时,使得该计算设备集群执行如上述方面所提供的ES集群的资源调度方法。
第六方面,提供了一种ES系统,该ES系统包括:ES集群,以及该ES集群的资源调度装置,该资源调度装置可以用于实现上述方面所提供的ES集群的资源调度方法。
综上所述,本申请提供了一种弹性搜索集群的资源调度方法、装置及系统,属于数据存储技术领域。本申请提供的方案能够统计目标索引的数据写入速率,并能够在该数据写入速率处于目标速率范围之外时,动态调整该目标索引中多个分片所占用的节点的资源量。由于目标索引的数据存储容量,以及所支持的最大数据写入速率均与该多个分片所占用的资源量相关,因此本申请提供的方案能够在不改变目标索引所包括的分片数量的前提下,实现对目标索引的数据存储容量和最大数据写入速率的动态调节。由此,不仅有效提高了数据写入的灵活性,且有效提高了集群资源的利用率。
附图说明
图1是本申请实施例提供的一种ES集群的结构示意图;
图2是本申请实施例提供的一种ES集群的资源调度方法的应用场景的示意图;
图3是本申请实施例提供的一种ES集群的资源调度方法的流程图;
图4是本申请实施例提供的一种对ES集群进行扩容的方法流程图;
图5是本申请实施例提供的一种AASS组件新增第二节点的示意图;
图6是本申请实施例提供的一种客户端代理组件迁移分片的示意图;
图7是本申请实施例提供的一种扩容后的ES集群的示意图;
图8是本申请实施例提供的一种对ES集群进行减容的方法流程图;
图9是本申请实施例提供的一种AASS组件指示客户端代理组件启动删除流程的示意图;
图10是本申请实施例提供的另一种客户端代理组件迁移分片的示意图;
图11是本申请实施例提供的一种AASS组件删除第一目标节点的示意图;
图12是本申请实施例提供的一种不同节点规格的第一节点的数据写入性能的示意图;
图13是本申请实施例提供的另一种ES集群的资源调度方法的流程图;
图14是本申请实施例提供的一种资源调度装置确定节点替换策略的示意图;
图15是本申请实施例提供的一种AASS组件新增第三节点的示意图;
图16是本申请实施例提供的一种AASS组件删除第四目标节点的示意图;
图17是本申请实施例提供的一种AASS组件新增第五节点的示意图;
图18是本申请实施例提供的一种目标索引的数据读取频率的示意图;
图19是本申请实施例提供的一种目标索引的数据写入频率的示意图;
图20是本申请实施例提供的一种ES集群的资源调度装置的结构示意图;
图21是本申请实施例提供的一种计算设备的结构示意图;
图22是本申请实施例提供的一种计算设备集群的结构示意图。
具体实施方式
下面结合附图详细介绍本申请实施例提供的ES集群的资源调度方法、装置及系统。
首先,对本申请实施例中涉及的下述术语进行解释。
ES:基于Lucene(一种全文搜索引擎)开发得到的一种分布式、高扩展和高实时的数据搜索引擎,其能够以集群为单位提供数据搜索服务。
ES集群,多个节点(node)的集合,能够独立提供搜索服务。例如,参考图1,ES集群可以包括节点1至节点3共3个节点。
节点:也可以称为ES服务器、ES实例或计算实例,其包含处理器、内存和磁盘等基础的物理资源。一个节点可以是一台物理机,一个VM,或一个物理机中的容器。
索引:用于存储数据的逻辑空间,相当于数据库。
分片:由索引划分得到,用于承载索引中的数据。每个索引可以划分为多个分片,该多个分片能够分布在不同的节点中,由此能够有效提升索引的数据存储容量。其中,每个分片可以是一个Lucene实例。例如,参考图1,索引可以划分为分片S1至分片S5共5个分片。其中,分片S1和分片S3分布在节点1中,分片S2和分片S4分布在节点2中,分片S5分布在节点3中。
副本:对分片进行拷贝得到,是分片的备份。每个分片可以具有一个或多个副本,且每个副本与其对应的分片分布在不同的节点中。例如,参考图1,分片S1至分片S5中的每个分片均具有1个副本,且分片S1至分片S5的副本依次为副本R1至副本R5。其中,副本R1和副本R3分布在节点3中,副本R2和副本R4分布在节点1中,副本R5分布在节点2中。
由于副本中存储的数据与分片中存储的数据相同,且副本能够处理数据查询(query)请求,即提供数据查询服务,因此能够有效提高数据查询吞吐量,且实现高可用性。其中,对于为分片创建了副本的场景,分片也可以称为主分片(primary shard),副本也可以称为副本分片(replica shard)。
图2是本申请实施例提供的一种ES集群的资源调度方法的应用场景的示意图。如图2所示,该应用场景包括ES集群,以及应用托管组件。并且,该应用场景可以划分为管理面和数据面。其中,ES集群的管理面可以包括主节点(master node)、客户端节点(client node)和请求缓存(request cache)。该主节点用于维护ES集群的状态,例如创建和删除索引等。客户端节点主要负责数据的存储,以及处理应用(也称为客户端)的数据索引请求和数据读取请求。可以理解的是,该主节点也可以具有客户端节点所具有的功能。请求缓存用于缓存数据索引请求和数据读取请求。其中,数据索引请求用于请求在索引中写入数据,也可以称为数据写入请求;数据读取请求用于请求读取索引中的数据,也可以称为数据查询请求。
ES集群的数据面可以包括读(reader)集群和写(writer)集群。该读集群包括节点N r1至 节点N rN共N个节点,N为大于1的整数。读集群中的每个节点中可以分布有索引的一个或多个副本,且该读集群可以用于处理数据读取请求。写集群包括节点N w1至节点N wM共M个节点,M为大于1的整数。该写集群中的每个节点中可以分布有索引的一个或多个分片,且该写集群可以用于处理数据写入请求。也即是,在需要向某个索引写入数据时,可以只向写集群中分布的分片写入数据,并由该写集群中的分片将数据同步至读集群中的一个或多个副本。在从某个索引中读取数据(即查询数据)时,可以只从读集群中分布的副本中读取数据。由此,可以实现数据的读写分离,从而有效提高数据的读写效率。
该应用托管组件也可以称为智能云应用弹性引擎(smart cloud APP elastic engine,Scase)服务组件,其能够提供全域应用托管服务。继续参考图2,该应用托管组件可以包括:位于管理面的全域调度组件和应用队列管理组件,以及位于数据面的客户端代理(client proxy)组件、应用网关(application gateway,AGW)、应用弹性伸缩服务(application autoscale service,AASS)组件和服务(server)软件开发工具包(software development kit,SDK)。在图2所示的应用场景中,写集群中的每个分片,以及读集群中的每个副本均能够由一个搜索进程(也称Lucene进程或应用进程)托管。该搜索进程中集成有服务SDK。该应用托管组件中各个组件的功能如下:
服务SDK:用于控制搜索进程的启停,以及上报搜索业务的监控数据。该监控数据可以包括:每秒读写量、搜索进程的状态以及搜索进程所包括的线程数等。
应用队列管理组件:负责搜索进程的托管,以及管理搜索进程的队列的大小。
AGW:用于搜索进程的控制。例如,汇聚收集服务SDK采集到的监控数据,以及向服务SDK下发控制指令,以使服务SDK控制搜索进程的启停,并控制分片或副本的迁移。
AASS组件:监控搜索进程的流量(包括写入数据量和数据读取请求的数量),以及协调应用指标与集群的底层资源,实现应用驱动的弹性服务。
客户端代理组件:用于将数据写入请求和数据读取请求进行分流控制,也即是,将数据写入请求分流至写集群中的各个节点,以及将数据读取请求分流至读集群中的各个节点。
全域调度组件:提供资源池的全局资源视图,以及基于资源池中可用节点的节点规格,按照预设策略(例如成本优先的策略)决策ES集群中节点的组合方式。
继续参考图2,该应用场景还可以包括存储服务组件,例如对象存储服务(object storage service,OBS)组件。该存储服务组件用于实现分片与副本之间的数据同步。
本申请实施例提供了一种ES集群的资源调度方法,该ES集群包括多个第一节点,该多个第一节点中分布有目标索引的多个分片。其中,每个第一节点中可以分布有目标索引的至少一个分片。可以理解的是,该ES集群中可以承载至少一个索引,该目标索引可以是该至少一个索引中的任一索引。还可以理解的是,该目标索引的多个分片均是指主分片,该多个第一节点可以组成目标索引的写集群。例如,该多个第一节点可以是图2中的节点N w1至节点N wM
本申请实施例提供的方法可以应用于资源调度装置,该资源调度装置可以是诸如图2所示应用场景中的应用托管组件。参考图3,该资源调度方法包括:
步骤101、统计目标索引的数据写入速率。
在本申请实施例中,资源调度装置可以实时或周期性地统计目标索引的数据写入速率。资源调度装置在每个统计时刻统计到的数据写入速率可以是指:在该统计时刻之前的第一目标时长内的平均数据写入速率,即第一目标时长内接收到的需写入至目标索引的总数据量与 该第一目标时长的比值。其中,该数据写入速率的单位可以是比特每秒(bits per second,bps)。
可选地,资源调度装置可以统计在第一目标时长内接收到的针对该目标索引的数据写入请求的个数,并统计每个数据写入请求所请求写入的数据的数据量。资源调度装置可以将第一目标时长内接收到的各个数据写入请求所请求的数据量累加,从而得到第一目标时长内接收到的需写入至目标索引的总数据量。之后,资源调度装置可以计算该总数据量与第一目标时长的比值,并将该比值确定为目标索引的数据写入速率。
示例的,假设该资源调度装置为图2所示的应用托管组件,则AGW或客户端代理组件可以统计在第一目标时长内接收到的针对该目标索引的数据写入请求的个数,并统计每个数据写入请求所请求写入的数据的数据量。AASS组件可以基于AGW或客户端代理组件统计的数据,计算该目标索引的数据写入速率。
步骤102、基于目标索引的数据写入速率处于目标速率范围之外,调整多个分片所占用的节点的资源量。
资源调度装置中预先存储有目标速率范围,该目标速率范围可以是目标索引当前所能够支持的数据写入速率的范围。由于目标索引当前由多个第一节点承载,因此该目标速率范围也可以理解为该多个第一节点所能够支持的数据写入速率的范围。并且,该目标速率范围可以基于该多个第一节点的节点规格确定。
其中,节点规格的衡量指标至少可以包括:节点包括的处理器核的数量。或者,该衡量指标还可以包括节点的内存大小。若某个节点具有x个处理器核,且内存为y吉字节(gigabyte,G),则该节点的节点规格可以表示为xUyG。其中,x和y均为正整数。U为单元(unit)的缩写,是一种表示服务器外部尺寸的单位,在本申请实施例中可以用于表示处理器核的数量。
可以理解的是,第一节点的节点规格越高,其所能够支持的最大数据写入速率也越高,即第一节点的数据写入性能也越好。因此,资源调度装置可以基于该多个第一节点的节点规格来确定目标速率范围。
可选地,资源调度装置可以获取预设的每个处理器核的数据写入速率阈值s0,即单核数据写入速率。之后,可以基于该数据写入速率阈值s0与多个第一节点所包括的处理器核的总数m的乘积,确定目标速率范围。例如,该目标速率范围可以为(s0×m)±Δs。其中,Δs为预设的写入速率波动值,其可以为大于或等于0的数。其中,该数据写入速率阈值s0可以是由应用(即客户端)配置的,且可以是应用对单个处理器核的数据写入性能进行测试得到的。
例如,若某个应用的单个搜索进程运行时所需占用的资源量为1U4G,且该单个搜索进程在1U4G的节点中运行时,该节点所支持的最大的数据写入速率为2兆比特每秒(Mbps),则该应用可以配置每个处理器核的数据写入速率阈值s0为2Mbps。若某个应用的单个搜索进程运行时所需占用的资源量为2U8G,且该单个搜索进程在2U8G的节点中运行时,该节点所支持的最大的数据写入速率为2Mbps,则该应用可以配置每个处理器核的数据写入速率阈值s0为1Mbps。
假设资源调度装置中配置的每个处理器核的数据写入速率阈值s0为2Mbps。ES集群中包括10个第一节点,每个第一节点包括的处理器核的数量均为4,即该10个第一节点所包括的处理器核的总数m为40。相应的,资源调度装置可以确定目标速率范围为(80±Δs)Mbps。若该预设的写入速率波动值Δs为0,则该目标速率范围可以等于80Mbps。
当目标索引的数据写入速率处于目标速率范围之外时,资源调度装置可以确定该多个第一节点的数据写入性能与目标索引的数据写入速率并不匹配。其中,若目标索引的数据写入 速率大于目标速率范围的上限,则资源调度装置可以确定该多个第一节点的数据写入性能无法支持目标索引当前实际的数据写入速率,即数据可能产生堆积,无法及时有效地写入至目标索引。若目标索引的数据写入速率小于目标速率范围的下限,则资源调度装置可以确定该多个第一节点的数据写入性能未被充分利用,即ES集群的资源利用率较低。
基于此,资源调度装置可以动态调整目标索引的多个分片所占用的资源量,以使得该多个分片所占用的资源量能够与该目标索引当前实际的数据写入速率相匹配。由此,可以在确保数据写入性能较高的前提下,有效提高ES集群的资源利用率,即实现了基于写服务质量(quality of service,QOS)的弹性策略。
在第一种可选的实现方式中,资源调度装置可以通过调整目标索引中多个分片所占用的节点的数量,以实现对该多个分片所占用的资源量的调节。在第二种可选的实现方式中,资源调度装置可以通过调整该多个第一节点中至少一个第一节点的节点规格,以实现对该多个分片所占用的资源量的调节。
下文以第一种实现方式为例,对上述步骤102的实现过程进行介绍。参考图4,该步骤102可以包括:
步骤102a1、基于目标索引的数据写入速率大于目标速率范围的上限,在ES集群中新增至少一个第二节点。
当目标索引的数据写入速率大于目标速率范围的上限时,为了增大目标索引所占用的资源量,资源调度装置可以在ES集群中新增至少一个用于承载该目标索引的分片的第二节点。
作为第一种示例,资源调度装置可以基于目标索引的数据写入速率与目标速率范围的上限的差值,确定待新增的至少一个第二节点的数量。其中,该至少一个第二节点的数量与该差值正相关。并且,该至少一个第二节点的节点规格均为预设规格,即该至少一个第二节点的节点规格相同。由于在第一种示例中,待新增的节点的节点规格均为预设规格,因此资源调度装置可以直接基于写入速率的差值,确定待新增的至少一个第二节点的数量。该新增第二节点的方式较为简单,效率较高。
在该第一种示例中,假设预设规格中的处理器核的数量为m0,则该待新增的至少一个第二节点的数量n1可以满足:
n1≥(s1-s2)/(s0×m0)   公式(1);
其中,s1为目标索引的数据写入速率,s2为该目标速率范围的上限,s0为每个处理器核的数据写入速率阈值。上述公式(1)还可以变形为:(n1×m0)≥(s1-s2)/s0,其中(n1×m0)即为该至少一个第二节点所包括的处理器核的总数。
作为第二种示例,若资源池(例如云平台)中的可用节点具有互不相同的多种备选的节点规格,则资源调度装置可以基于目标索引的数据写入速率与目标速率范围的上限的差值,以及该多种备选的节点规格,确定待新增的至少一个第二节点的数量,以及每个第二节点的节点规格。其中,每个第二节点的节点规格是从该多种备选的节点规格中选取的,且不同第二节点的节点规格可以相同,也可以不同。在该第二种示例中,该新增的至少一个第二节点所包括的处理器核的总数m1可以满足:
m1≥(s1-s2)/s0    公式(2)。
可选地,资源调度装置可以基于每种备选的节点规格的成本,采用成本优先的策略确定至少一个第二节点的数量,以及每个第二节点的节点规格。由此,可以在改善ES集群的数据写入性能的前提下,有效降低新增节点的成本。
示例的,资源调度装置可以先从资源池的可用节点中确定出能够满足上述公式(2)的多种节点组合方式,其中,不同节点组合方式中的第二节点的数量不同,和/或,至少一个第二节点的规格不同。之后,资源调度装置可以从该多种节点组合方式中选择成本最低的一种节点组合方式,并按照该成本最低的一种节点组合方式新增至少一个第二节点。
假设目标索引的数据写入速率s1为100Mbps,该目标速率范围的上限s2为80Mbps,且每个处理器核的数据写入速率阈值s0为2Mbps。资源调度装置基于上述公式(2)可以确定:待新增的至少一个第二节点所包括的处理器核的总数m1需大于等于10。若待新增的第二节点的节点规格均为预设规格:2U8G,即每个第二节点中的处理器核的数量m0均等于2,则资源调度装置可以在ES集群中新增5个2U8G的第二节点。
若资源池中的可用节点具有2U8G和4U16G共两种备选的节点规格,且一个4U16G的节点的成本低于2个2U8G节点的成本。则资源调度装置基于成本优先的策略,可以在ES集群中新增2个4U16G的第二节点,以及1个2U8G的第二节点。
可选地,若资源池中的可用节点包括采用竞价(spot)资源的节点,则由于竞价资源的成本较低,因此在上述步骤102a1中,资源调度装置可以优先选择该采用竞价资源的节点作为待新增的第二节点。也即是,该至少一个第二节点所采用的资源可以为竞价资源。其中,采用竞价资源的节点也可以称为spot实例。
步骤102a2、将多个分片中的至少一个分片迁移至该至少一个第二节点。
资源调度装置在ES集群中新增至少一个第二节点后,即可将目标索引中的至少一个分片迁移至该至少一个第二节点。其中,每个第二节点中可以承载目标索引的一个或多个分片。
可选地,资源调度装置所迁移的至少一个分片可以满足下述条件中的至少一种:分片中已写入的数据量小于第一阈值;分片所在的第一节点中分布的分片的总数大于第二阈值。
基于上述条件可知,资源调度装置可以选择已写入的数据量较小的分片进行迁移,和/或,选择分片数量较多的第一节点中的分片进行迁移。由此,可以有效提高分片的迁移效率,降低迁移成本,并可以确保各个第一节点中的分片数量较为均衡。
其中,该第一阈值和第二阈值均可以是资源调度装置中预先配置的固定值。或者,该第一阈值可以是基于目标索引中各个分片已写入的数据量确定的,例如可以是目标索引的各个分片中已写入的数据量的均值或下四分位数。该第二阈值可以是基于各个第一节点中的分片数量确定的,例如可以是各个第一节点中的分片数量的均值或上四分位数。
可以理解的是,资源调度装置也可以通过其他方式确定待迁移的至少一个分片。例如,资源调度装置可以从目标索引的多个分片中随机选取待迁移的至少一个分片。
还可以理解的是,资源调度装置在确定出待迁移的至少一个分片后,可以基于负载均衡的策略,将上述至少一个分片迁移至新增的至少一个第二节点。
下文以资源调度装置为图2所示的应用托管组件为例,对上述步骤102a1和步骤102a2的实现过程进行介绍。
首先,AASS组件在检测到目标索引的数据写入速率大于目标速率范围的上限后,可以确定扩容策略,该扩容策略包括待新增的至少一个第二节点的数量,以及待新增的每个第二节点的节点规格。例如,AASS组件可以根据数据写入速率与目标速率范围的上限的差值,确定扩容策略。或者,AASS组件可以将该差值上报至全域调度组件,全域调度组件进而可以根据该差值和资源池中多种备选的节点规格,确定扩容策略,并将该扩容策略下发至AASS组件。
之后,AASS组件即可按照该扩容策略在ES集群中新增至少一个第二节点,并调整分片的 部署策略。其中,分片的部署策略可以是指目标索引中的各个分片与其所分布的节点的对应关系,即分片与节点的映射关系。
例如,参考图5,假设目标索引包括分片S1至分片S4共4个分片,用于承载该4个分片的读集群包括节点1和节点2共2个第一节点。其中,节点1中分布有分片S1和分片S3,节点2中分布有分片S2和分片S4。AASS组件若确定目标索引的数据写入速率大于目标速率范围的上限,则可以在读集群中新增节点3和节点4共2个第二节点。并且,AASS组件可以调整分片的部署策略为:分片S3部署至节点3,分片S4部署至节点4。
进一步的,客户端代理组件可以实时对接AASS组件以获取新增的第二节点的服务状态,并同步分片的部署策略。客户端代理组件在确定新增的第二节点的服务状态均为准备完成(ready)状态后,即可按照分片的部署策略,将至少一个分片迁移至新增的至少一个第二节点。例如,参考图6,客户端代理组件可以将分片S3迁移至节点3,并将分片S4迁移至节点4。
在完成分片迁移后,客户端代理组件还需更新分流策略,并按照更新后的分流策略对数据写入请求进行分流。其中,分流策略是指向用于承载目标索引的各个节点分发数据写入请求的策略。例如,参考图6,在迁移分片S3和分片S4之前,客户端代理组件可以基于分流策略向节点1和节点2分发数据写入请求。并且,从图6可以看出,在迁移分片S3和分片S4的过程中,客户端代理组件并不会向节点3和节点4分发数据写入请求。参考图7,客户端代理组件在完成分片S3和分片S4的迁移后,可以基于更新后的分流策略,向节点1、节点2、节点3和节点4分发数据写入请求。
在上述扩容过程中,新增至少一个第二节点所需的时长大约为3至5分钟,分片迁移和流量切换所需的时长大约为1分钟。
图8是本申请实施例提供的一种对ES集群进行减容的方法流程图。参考图8,上述步骤102还可以包括:
步骤102b1、基于目标索引的数据写入速率小于目标速率范围的下限,从多个第一节点中确定待删除的至少一个第一目标节点。
当目标索引的数据写入速率小于目标速率范围的下限时,为了提高ES集群的资源利用率,并降低ES集群的成本,资源调度装置可以从多个第一节点中确定待删除的至少一个第一目标节点。
可选地,每个第一目标节点中分布的分片的总数可以小于第三阈值。也即是,资源调度装置可以删除分片数量较少的第一节点。由此,可以确保在删除该至少一个第一目标节点之前,能够快速将该至少一个第一目标节点中的分片迁移至其他第一节点。
其中,该第三阈值可以是资源调度装置中预先配置的固定值。或者,该第三阈值可以是基于各个第一节点中的分片数量确定的,例如可以是各个第一节点中的分片数量的均值或下四分位数。
作为第一种示例,若该ES集群中各个第一节点的节点规格均为预设规格,则资源调度装置可以基于目标索引的数据写入速率与目标速率范围的下限的差值,确定待删除的至少一个第一目标节点的数量。其中,该至少一个第一目标节点的数量与该差值正相关。
假设该预设规格中的处理器核的数量为m0,则该待删除的至少一个第一目标节点的数量n2可以满足:n2≤(s3-s1)/(s0×m0)   公式(3);
其中,s1为目标索引的数据写入速率,s3为该目标速率范围的下限,s0为每个处理器核的数据写入速率阈值。上述公式(3)还可以变形为:(n2×m0)≤(s3-s1)/s0,其中(n2×m0) 即该至少一个第一目标节点所包括的处理器核的总数。
可以理解的是,该目标速率范围的下限s3可以小于目标速率范围的上限s2,或者,该目标速率范围的下限s3可以等于上限s2,即该目标速率范围可以是一个速率阈值。
作为第二种示例,若各个第一节点的节点规格不完全相同,则资源调度装置可以基于目标索引的数据写入速率与目标速率范围的下限的差值,以及该各个第一节点的节点规格确定待删除的至少一个第一目标节点。并且,该至少一个第一目标节点所包括的处理器核的总数m2可以满足:m2≤(s3-s1)/s0   公式(4)。
可选地,在该第二种示例中,资源调度装置还可以基于不同节点规格的第一节点的成本,采用成本优先的策略确定待删除的至少一个第一目标节点,以有效降低ES集群的成本。
例如,资源调度装置可以先确定出能够满足上述公式(4)的多种节点组合方式,其中,不同节点组合方式中的第一节点的数量不同,和/或,至少一个第一节点的规格不同。之后,资源调度装置可以从该多种节点组合方式中选择成本最高的一种节点组合方式,并将该成本最高的一种节点组合方式确定为待删除的至少一个第一目标节点的组合方式。
步骤102b2、将至少一个第一目标节点中分布的分片均迁移至除至少一个第一目标节点之外的其他第一节点。
资源调度装置确定出待删除的至少一个第一目标节点后,即可将该至少一个第一目标节点中分布的分片均迁移至除至少一个第一目标节点之外的其他第一节点。例如,资源调度装置可以基于负载均衡的策略迁移分片,以确保分片迁移后,除该至少一个第一目标节点之外的各个第一节点中的分片数量较为均衡。
步骤102b3、删除至少一个第一目标节点。
资源调度装置完成分片迁移后,即可删除该至少一个第一目标节点。由此,能够有效缩减ES集群的容量,即实现对ES集群的减容,从而有效降低ES集群的成本。
下文以资源调度装置为图2所示的应用托管组件为例,对上述步骤102b1至102b3的实现过程进行介绍。
首先,AASS组件在检测到目标索引的数据写入速率小于目标速率范围的下限后,可以确定减容策略,该减容策略包括待删除的至少一个第一目标节点,以及该至少一个第一目标节点中的分片的部署策略。之后,如图9所示,AASS组件可以向客户端代理组件发送节点删除通知,以指示客户端代理组件启动删除流程。客户端代理组件接收到该节点删除通知后,可以同步AASS组件中的减容策略,并根据该减容策略将至少一个第一目标节点中的分片均迁移至其他第一节点。例如参考图10,客户端代理组件可以将节点3中的分片S3迁移至节点1,并将节点4中的分片S4迁移至节点2。
分片迁移完成后,客户端代理组件可以切断节点3和节点4的业务流。并且,客户端代理组件可以通知AASS组件该至少一个第一目标节点可删除。AASS组件进而可以通过AGW监测该至少一个第一目标节点的服务状态,在确定该至少一个第一目标节点中的数据和进程均删除后,AASS组件即可删除该至少一个第一目标节点。例如,参考图10和图11,AASS组件可以删除节点3和节点4。
可以理解的是,在本申请实施例中,AASS组件可以直接调用ES集群的弹性计算服务(elastic computer service,ECS)或者自动伸缩服务(autoscaling service,AS)的接口来新增第二节点,或删除第一目标节点。其中,由于调用ECS的接口删除节点的过程支持执行删除脚本,因此ECS会执行预置在服务SDK中的删除回调,以实现第一目标节点中数据和进程的删 除。AGW可以通过服务SDK更新节点的服务状态,该服务状态包括节点中的进程状态和会话数量等。AASS组件通过监测AGW,确定节点中的数据和进程均删除后,会调用ECS的接口自动删除第一目标节点。或者,也可以由AGW调用删除函数,以删除第一目标节点中的数据和进程。当节点中的数据和进程均删除完成后,再调用ECS接口删除第一目标节点。
下文以上述第二种实现方式(即调整目标索引所占用的多个第一节点中至少一个第一节点的节点规格)为例,对上述步骤102的实现过程进行介绍。
在该第二种实现方式中,ES集群中的多个第一节点均可以采用无服务器(serverless)架构。资源调度装置在检测到目标索引的数据写入速率处于目标速率范围之外时,可以调整该多个第一节点中至少一个第一节点的节点规格。也即是,资源调度装置无需调整用于承载目标索引的节点的数量,也无需迁移目标索引的分片,而是能够通过动态调整至少一个第一节点的节点规格,以实现对该目标索引所占用的资源量的调节。
如前文所述,节点规格的衡量指标至少可以包括:节点的处理器核的数量。因此,资源调度装置调整第二目标节点的节点规格可以是指:调整该第二目标节点所包括的处理器核的数量。若该节点规格的衡量指标还包括节点的内存大小,则调整第二目标节点的节点规格可以是指:调整该第二目标节点所包括的处理器核的数量,以及内存大小。
在该第二种实现方式中,资源调度装置若确定目标索引的数据写入速率大于目标速率范围的上限,则可以增大该多个第一节点中至少一个第二目标节点的节点规格。
其中,每个第二目标节点中分布的分片的总数可以大于第四阈值。也即是,资源调度装置可以增大分片数量较多的第一节点的节点规格。该第四阈值可以是资源调度装置中预先配置的固定值。或者,该第四阈值可以是基于各个第一节点中的分片数量确定的,例如可以是各个第一节点中的分片数量的均值或上四分位数。
可以理解的是,上述至少一个第二目标节点还可以通过其他方式确定,例如资源调度装置可以从多个第一节点中随机选取至少一个第二目标节点。或者,资源调度装置可以将该多个第一节点均确定为第二目标节点,即资源调度装置可以增大每个第一节点的节点规格。
在该第二种实现方式中,资源调度装置若确定目标索引的数据写入速率小于目标速率范围的下限,则可以减小该多个第一节点中至少一个第三目标节点的节点规格。
其中,每个第三目标节点中分布的分片的总数可以小于第五阈值。也即是,资源调度装置可以减小分片数量较少的第一节点的节点规格。该第五阈值可以是资源调度装置中预先配置的固定值。或者,该第五阈值可以是基于各个第一节点中的分片数量确定的,例如可以是各个第一节点中的分片数量的均值或下四分位数。
可以理解的是,上述至少一个第三目标节点还可以通过其他方式确定,例如资源调度装置可以从多个第一节点中随机选取至少一个第三目标节点。或者,资源调度装置可以将该多个第一节点均确定为第三目标节点,即资源调度装置可以减小每个第一节点的节点规格。
还可以理解的,资源调度装置可以基于目标索引的数据写入速率s1,调整该至少一个第二目标节点(或至少一个第三目标节点)的节点规格。并且,调整节点规格后的多个第一节点所包括的处理器核的总数m3可以满足:m3≥s1/s0    公式(5)。
示例的,假设每个处理器核的数据写入速率阈值s0为2Mbps,且ES集群中包括10个节点规格为4U16G的第一节点,即该10个第一节点所包括的处理器核的总数为40。若目标索引的数据写入速率s1为100Mbps,则资源调度装置基于上述公式(5)可以确定,该10个第一节点所包括的处理器核的总数需大于等于50才能满足目标索引的数据写入速率s1的需求。基于此, 资源调度装置可以将ES集群中3个第一节点的节点规格由4U16G调整为8U32G,此时,调整节点规格后的多个第一节点所包括的处理器核的总数m3为52。
若目标索引的数据写入速率s1为40Mbps,则资源调度装置基于上述公式(5)可以确定,该10个第一节点所包括的处理器核的总数大于等于20即可满足目标索引的数据写入速率s1的需求。基于此,资源调度装置可以将该ES集群中10个第一节点的节点规格均由4U16G调整为2U8G,此时,调整节点规格后的多个第一节点所包括的处理器核的总数m3为20。
可选地,资源调度装置在检测到目标索引的数据写入速率位于目标速率范围之外时,可以采用上述第一种实现方式和第二种实现方式中的任一种实现方式,调整目标索引中多个分片所占用的资源量。或者,资源调度装置还可以将上述两种实现方式结合,来调整目标索引中多个分片所占用的资源量,即资源调度装置既可以调整用于承载目标索引的节点的数量,又可以调整至少一个第一节点的节点规格。
在本申请实施例中,资源调度装置中可以预先配置有节点规格与节点性能的对应关系,该对应关系中记录有不同节点规格所对应的节点性能。其中,节点性能可以采用下述参数表征:节点所能够承载的分片的数量,以及节点所支持的最大数据写入速率。资源调度装置在检测到目标索引的数据写入速率位于目标速率范围之外时,可以基于该对应关系,确定待新增的第二节点的节点规格,和/或,调整第一节点的节点规格。
可以理解的是,对于不同类型的应用的搜索进程(包括索引进程和读取进程),节点运行该搜索进程所需的资源量是不同的。例如,运行应用1的单个搜索进程所需的资源量为1U2G,运行应用2的单个搜索进程所需的资源量可以为2U4G。基于此,对于每个类型的应用,资源调度装置中可以配置有与该类型的应用所关联的对应关系,该对应关系中的节点性能可以是对该类型的应用进行测试得到的。
示例的,资源调度装置中配置的与某个类型的应用所关联的对应关系可以如表1所示。参考表1,节点规格为2U8G的节点所能够承载的分片的数量为1,其所支持的最大数据写入速率为4Mbps。节点规格为8U32G的节点所能够承载的分片的数量也为1,但其所支持的最大数据写入速率能够达到16Mbps。
表1
节点规格 承载的分片的数量 最大数据写入速率(Mbps)
2U8G 1 4
4U16G 1 8
8U32G 1 16
12U48G 1 24
16U64G 2 32
24U96G 2 48
32U128G 2 64
参考图12,假设资源调度装置将ES集群中节点1和节点2的节点规格均调整为32U,在ES集群中新增了节点规格为4U的节点3和节点4,并将分片S3迁移至节点3,将分片S4迁移至节点4。结合上述表1可知,该节点1和节点2所支持的最大数据写入速率均为64Mbps,节点3和节 点4所支持的最大数据写入速率均为8Mbps。该4个节点所支持的总的数据写入速率可以达到144Mbps。
可选地,该多个第一节点中的第四目标节点所采用的资源可以为竞价资源。该竞价资源是一种成本较低,且成本(即价格)随供需关系变化的资源。
作为第一种可能的示例,资源调度装置可以在特定时段内(例如夜间)购置固定时长的竞价资源,以作为第四目标节点的资源。当该竞价资源的运行时长达到该固定时长时,将会被自动释放,即该竞价资源将被资源池收回。
作为第二种可能的示例,资源调度装置可以按照预设的目标价格购置竞价资源,以作为第四目标节点的资源。若该目标价格高于竞价资源的市场价,且资源池的资源库存足够,则ES集群可以持续占用该竞价资源。若该目标价格低于竞价资源的市场价,或者资源池的资源库存不存,则资源池将向资源调度装置发送预警通知,并在一定时长后自动释放(即收回)该竞价资源。
图13是本申请实施例提供的另一种资源调度方法的流程图。如图13所示,该资源调度方法还可以包括:
步骤103、基于第四目标节点所采用的竞价资源的剩余可用时长小于时长阈值,在ES集群中新增至少一个第三节点。
当该竞价资源的剩余可用时长小于时长阈值时,资源调度装置可以在ES集群(例如写集群)中新增至少一个第三节点,以便将该第四目标节点中的分片迁移至该至少一个第三节点。其中,该时长阈值可以大于迁移第四目标节点中的分片所需的时长。由此,可以确保在第四目标节点所采用的竞价资源被释放之前,第四目标节点中的分片能完成迁移,从而避免对业务造成影响。
可选地,资源调度装置新增的至少一个第三节点所采用的资源可以包括按需资源和/或竞价资源。例如,资源调度装置可以按照成本优先的策略,从资源池中选择按需资源和/或竞价资源以作为至少一个第三节点所采用的资源。其中,按需资源是指根据业务需求购置的资源,其成本比竞价资源高。
在第一种示例中,若资源调度装置是按照固定时长购置的竞价资源,则资源调度装置可以实时监测第四目标节点所采用的竞价资源的剩余可用时长。该剩余可用时长可以等于该固定时长与竞价资源的已使用时长的差值。当该剩余可用时长小于资源调度装置中预先配置的时长阈值时,资源调度装置即可在ES集群中新增至少一个第三节点。
例如,假设资源调度装置为第四目标节点购置的竞价资源的固定时长为2小时,且该时长阈值为20分钟,则资源调度装置可以在竞价资源的已使用时长达到1小时40分钟时,在ES集群中新增至少一个第三节点。假设该目标索引用于存储直播日志数据,则由于直播日志数据一般按照5分钟的粒度打包,上传至ES集群并索引,因此在竞价资源的剩余可用时长为20分钟时启动分片的迁移流程,对分片是预留有充足的迁移时间的,可以避免影响业务性能。
若资源调度装置是按照目标价格购置的竞价资源,则资源调度装置可以在接收到资源池发送的预警通知时,确定该竞价资源的剩余可用时长小于时长阈值,并在ES集群中新增至少一个第三节点。其中,该时长阈值可以为资源池发送预警通知到自动释放该竞价资源之间的预留时长。
可以理解的是,资源调度装置在ES集群中新增至少一个第三节点时,可以基于目标索引的数据写入速率确定待新增的至少一个第三节点的数量,以及每个第三节点的规格。例如, 该至少一个第三节点,以及ES集群中除第四目标节点之外的其他第一节点所包括的处理器核的总数可以满足上述公式(5)。
步骤104、将第四目标节点中的分片均迁移至该至少一个第三节点。
在本申请实施例中,资源调度装置新增至少一个第三节点后,即可将第四目标节点中的分片均迁移至该至少一个第三节点。例如,资源调度装置可以基于负载均衡的策略,向该至少一个第三节点迁移分片。该步骤104的实现过程可以参考上述步骤102a2和步骤102b2,此处不再赘述。
步骤105、删除第四目标节点。
在完成分片迁移,且第四目标节点所采用的竞价资源的剩余可用时长为零时,资源调度装置即可删除该第四目标节点,以释放第四目标节点所采用的竞价资源。该步骤105的实现过程可以参考上述步骤102b3,此处不再赘述。
下文以资源调度装置为图2所示的应用托管组件为例,对上述步骤103至步骤105的实现过程进行介绍。
参考图14,AASS组件在监测到第四目标节点(例如图14中的节点3和节点4)所采用的竞价资源的剩余可用时长小于时长阈值时,可以确定节点替换策略,该节点替换策略包括待新增的至少一个第三节点的数量,以及待新增的每个第三节点的节点规格。例如,AASS组件可以将节点需求信息上报至全域调度组件,全域调度组件进而可以根据该节点需求信息和多种备选的节点规格,确定节点替换策略,并将该节点替换策略下发至AASS组件。其中,节点需求信息可以是指所需新增的处理器核的总数。
之后,AASS组件即可按照该节点替换策略在ES集群中新增至少一个第三节点,并调整分片的部署策略。例如,参考图15,AASS组件可以新增节点5和节点6共2个第三节点。并且,AASS组件可以调整分片的部署策略为:分片S3部署至节点5,分片S4部署至节点6。
进一步的,客户端代理组件即可按照该调整后的分片部署策略,将至少一个分片迁移至新增的至少一个第三节点。例如,参考图15,客户端代理组件可以将节点3中的分片S3迁移至节点5,并将节点4中的分片S4迁移至节点6。当节点3和节点4所采用的竞价资源的剩余可用时长为零时,如图16所示,AASS组件可以删除该节点3和节点4。
基于上述分析可知,本申请实施例提供的方法可以通过调整目标索引中的多个分片所占用的资源量,实现对目标索引的数据写入性能的灵活调节,即能够实现ES集群的写弹性。基于此,本申请实施例提供的方案可以用于存储写入数据量较多,且写入数据量随时间波动较大的场景。例如,该目标索引可以用于存储媒体日志数据或交易系统的交易数据。其中,媒体日志数据可以包括:直播日志数据和点播日志数据等。
上文是以资源调度装置根据目标索引的数据写入速率,调整目标索引中的多个分片所占用的资源量为例进行的说明。在本申请实施例中,该ES集群还可以包括多个第四节点,该目标索引还可以包括多个副本,该多个副本由该多个第四节点承载。该多个第四节点可以组成目标索引的读集群。例如,该多个第四节点可以是图2中的节点N r1至节点N rN。该资源调度装置还可以基于目标索引的数据读取频率,对目标索引所包括的副本的数量进行灵活调节,以实现ES集群的读弹性。继续参考图13,本申请实施例提供的资源调度方法还可以包括:
步骤106、统计目标索引的数据读取频率。
在本申请实施例中,资源调度装置可以实时或周期性地统计目标索引的数据读取频率,该数据读取频率可以是指在单位时间内接收到的针对目标索引的数据读取请求的数量。可选 地,资源调度装置在每个统计时刻统计到的数据读取频率可以是指:在该统计时刻之前的第二目标时长内接收到的数据读取请求的次数与该第二目标时长的比值。例如,假设该第二目标时长的统计单位为秒,则该数据读取频率可以为每秒请求数(queries per second,QPS)。
其中,该第二目标时长与统计数据写入速率时的第一目标时长可以相等,也可以不等。例如,该第二目标时长和第一目标时长均可以为5分钟。
步骤107、基于目标索引的数据读取频率位于目标频率范围之外,调整目标索引所包括的副本的数量。
目标索引中的每个副本是对该目标索引的一个分片进行拷贝得到的,即每个副本中存储的数据与该副本对应的分片中存储的数据相同。并且,目标索引中不同分片所具有的副本的数量可以相同,也可以不同。
可以理解的是,目标索引的副本可以提供数据查询服务,且目标索引所包括的副本的数量越多,该目标索引所支持的最大数据读取频率也就越高。在本申请实施例中,资源调度装置中预先存储有目标频率范围,该目标频率范围可以是根据目标索引当前所包括的副本的数量确定的。
还可以理解的是,在目标索引中存储文档(文档是数据存储的最小单位)时,需基于该目标索引所包括的分片的数量,计算用于存储该文档的目标分片的标识。例如,可以采用下述公式计算目标分片的标识shard_num:
shard_num=hash(routing)%num_primary_shards    公式(6);
其中,hash表示哈希运算,routing为预设的路由键,num_primary_shards为目标索引所包括的分片的数量。在从目标索引中读取该文档时,同样需基于上述公式(6)确定存储有该文档的目标分片的标识。基于上述分析可知,为了确保数据的准确查询,在目标索引创建后,该目标索引所包括的分片的数量将无法再修改。
由于目标索引所包括的分片数量无法调整,而副本的数量可以灵活调节,因此目标索引所包括的副本的数量越多,其所能够支持的最大数据读取频率也越高,即该多个第四节点的数据读取性能也越好。又由于ES集群中每个第四节点所能承载的副本的数量与该第四节点的节点规格正相关,因此在本申请实施例中,可以基于ES集群中多个第四节点的节点规格,确定该目标频率范围。
其中,该多个第四节点与上文所述的多个第一节点可以存在交集,或者,该多个第四节点可以独立于该多个第一节点。例如,参考图2,假设ES集群采用读写分离的方式部署,则该多个第一节点可以是指写集群中的节点,该多个第四节点可以是指读集群中的节点。
可选地,资源调度装置可以获取预设的每个处理器核的数据读取频率阈值r0,即单核数据读取频率。之后,可以基于该数据读取频率阈值r0与多个第四节点所包括的处理器核的总数m4的乘积,确定目标频率范围。例如,该目标频率范围可以为(r0×m4)±Δr。其中,Δr为预设的读取速率波动值,其可以为大于或等于0的数。
示例的,假设每个处理器核的数据读取频率阈值r0为5QPS,ES集群中包括10个4U16G的第四节点,则该10个第四节点所包括的处理器核的总数m4为40。相应的,资源调度装置可以确定目标频率范围为(200±Δr)QPS。若该预设的读取速率波动值Δr为0,则该目标频率范围可以等于200QPS。
当目标索引的数据读取频率处于目标频率范围之外时,资源调度装置可以确定该多个第四节点的数据读取性能与目标索引的数据读取频率并不匹配。其中,若目标索引的数据读取 频率大于目标频率范围的上限,则资源调度装置可以确定该多个第四节点的数据读取性能无法支持该数据读取频率。若目标索引的数据读取频率小于目标频率范围的下限,则资源调度装置可以确定该多个第四节点的数据读取性能未被充分利用,即ES集群的资源利用率较低。
基于此,资源调度装置可以调整目标索引所包括的副本的数量,以使得目标索引所包括的副本的数量能够与该数据读取频率相匹配。由此,可以在确保数据读取性能的前提下,有效提高ES集群的资源利用率。
在本申请实施例中,若目标索引的数据读取频率大于该目标频率范围的上限,则资源调度装置可以在ES集群中新增至少一个第五节点,并可以在每个第五节点中新增目标索引的至少一个副本。其中,每个第五节点中新增的副本的数量可以与该第五节点的节点规格正相关。也即是,第五节点的节点规格越高,则在该第五节点中新增的副本的数量可以越多。
作为第一种可能的示例,该至少一个第五节点的节点规格均为预设规格。相应的,该至少一个第五节点的数量可以是基于数据读取频率与该目标频率范围的上限的差值确定的,且该至少一个第五节点的数量与该差值正相关。
在该第一种示例中,假设预设规格中的处理器核的数量为m0,则该待新增的至少一个第五节点的数量n3可以满足:
n3≥(r1-r2)/(r0×m0)   公式(7);
其中,r1为目标索引的数据读取频率,r2为该目标频率范围的上限,r0为每个处理器核的数据读取频率阈值。上述公式(7)还可以变形为:(n3×m0)≥(r1-r2)/r0,其中(n3×m0)即为该新增的至少一个第五节点所包括的处理器核的总数。
假设每个处理器核的数据读取频率阈值r0为5QPS,该目标频率范围的上限r2为200QPS,且资源池中可用节点的节点规格均为4U16G,即m0=4。参考图17,若AASS组件通过AGW检测到目标索引的数据读取频率r1为210QPS,则AASS组件根据上述公式(7)可以确定需新增的一个节点规格为4U16G的第五节点。相应的,如图17所示,AASS组件可以在ES集群中新增节点3,并在节点3中新增一个副本,该一个副本由一个搜索进程托管,该搜索进程中集成有服务SDK。
作为第二种可能的示例,资源池中的可用节点具有互不相同的多种备选的节点规格。资源调度装置可以基于数据读取频率与该目标频率范围的上限的差值,以及该互不相同的多种备选的节点规格,确定待新增的至少一个第五节点的数量,以及每个第五节点的节点规格。其中,每个第五节点的节点规格是从多种备选节点的规格中选取的,且不同第五节点的节点规格可以相同,也可以不同。
在该第二种示例中,该至少一个第五节点所包括的处理器核的总数m5可以满足:
m5≥(r1-r2)/r0   公式(8)。
可选地,资源调度装置可以基于每种备选的节点规格的成本,采用成本优先的策略确定至少一个第五节点的数量,以及每个第五节点的节点规格。由此,可以在确保有效改善ES集群的数据读取性能的前提下,降低新增节点的成本。
在本申请实施例中,若目标索引的数据读取频率小于该目标频率范围的下限,则资源调度装置可以从多个第四节点中确定出至少一个第五目标节点,并可以删除每个第五目标节点中分布的副本。之后,资源调度装置即可删除该至少一个第五目标节点。
其中,该至少一个第五目标节点可以满足下述条件中的至少一种:节点中分布的副本的数量小于第六阈值;节点的数据读取频率小于第七阈值。也即是,资源调度装置可以删除分 片数量较少的第四节点,和/或,删除接收到的数据读取请求的数量较少的第四节点。该第六阈值和第七阈值均可以是资源调度装置中预先配置的固定值。或者,该第六阈值可以是基于各个第四节点中的副本数量确定的,例如可以是各个第四节点中的副本数量的均值或下四分位数。该第七阈值可以是基于各个第四节点的数据读取频率确定的,例如可以是各个第四节点中的数据读取频率的均值或下四分位数。
图18是本申请实施例提供的一种目标索引的数据读取频率的示意图,且图18以目标索引用于存储媒体日志数据为例进行示意。图18中的横轴为时间,单位为小时,纵轴为数据读取频率,单位为次/分钟。参考图18可以看出,该目标索引的数据读取频率整体较低,峰值约为7次/分钟。若ES集群中一个第四节点所支持的数据读取频率为20QPS,则可以确保较好的数据读取性能。
图19是本申请实施例提供的一种目标索引的数据写入频率的示意图,且图19以目标索引用于存储媒体日志数据为例进行示意。图19中的横轴为时间,单位为小时,纵轴为数据写入频率,单位为次/分钟。参考图19可以看出,目标索引的数据写入频率的峰值范围大约为0.56万(W)次/分钟至13.7W次/分钟。由于目标索引的数据写入频率较高,因此该目标索引的数据写入速率也较高。且从图19还可以看出,该目标索引的数据写入速率随时间的波动也较大。由于本申请实施例提供的方案能够根据目标索引的数据写入速率动态调节目标索引所占用的资源量,因此能够实现数据写入性能的动态弹性,从而在确保数据写入性能的前提下,有效提高ES集群的资源利用率。
可以理解的是,本申请实施例提供的ES集群的资源调度方法的步骤先后顺序可以进行适当调整,步骤也可以根据情况进行相应增减。例如,上述步骤103至步骤105可以根据情况删除;或者,上述步骤106和步骤107可以根据情况删除;又或者,上述步骤106和步骤107可以在步骤105之前执行;再或者,上述步骤103至步骤105可以在步骤102之前执行。
综上所述,本申请实施例提供了一种ES集群的资源调度方法。该方法能够统计目标索引的数据写入速率,并能够在该数据写入速率处于目标速率范围之外时,动态调整该目标索引的多个分片所占用的节点的资源量。由于目标索引的数据存储容量,以及所支持的最大数据写入速率均与该多个分片所占用的资源量相关,因此本申请实施例提供的方法能够在不改变目标索引所包括的分片数量的前提下,实现对目标索引的数据存储容量和最大数据写入速率的动态调节。由此,不仅有效提高了数据写入的灵活性,且有效提高了集群资源的利用率。
此外,本申请实施例提供的方法还可以基于目标索引的数据读取频率,灵活调节目标索引所包括的副本的数量,由此实现了ES集群的读弹性。又由于在ES集群中新增节点时,可以灵活选择新增的节点的节点规格以及节点所采用的资源的类型,因此有效提高了新增节点时的灵活性,并可以降低了新增节点的成本。例如,经测试,在目标索引存储日志数据的场景中,通过实现写集群的弹性,可以将ES集群的成本降低50%。若资源调度装置还能够基于成本优先的原则,灵活选择节点的节点规格以及节点所采用的资源的类型,则可以将ES集群的成本降低70%。
本申请实施例提供了一种ES集群的资源调度装置,该资源调度装置可以用于实现上述方法实施例提供的ES集群的资源调度方法。该ES集群包括用于承载目标索引的多个第一节点,该目标索引包括多个分片。该资源调度装置可以部署于云平台中,例如该资源调度装置可以是诸如图2所示的应用托管组件。如图20所示,该资源调度装置包括:
统计模块201,用于统计目标索引的数据写入速率。该统计模块201的功能实现可以参考上述步骤101的相关描述。
调整模块202,用于基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个分片所占用的节点的资源量。该调整模块202的功能实现可以参考上述步骤102的相关描述。
可选地,该调整模块202可以用于:基于该目标索引的数据写入速率大于该目标速率范围的上限,在该ES集群中新增至少一个第二节点;将该多个分片中的至少一个分片迁移至该至少一个第二节点。该调整模块202的功能实现还可以参考上述步骤102a1至步骤102a2的相关描述。
作为一种可选的实现方式,该调整模块202还可以用于:在该ES集群中新增至少一个第二节点之前,基于该目标索引的数据写入速率与该目标速率范围的上限的差值,确定待新增的该至少一个第二节点的数量。其中,该数量与该差值正相关,且该至少一个第二节点的节点规格均为预设规格。
作为另一种可选的实现方式,该调整模块202还可以用于:在该ES集群中新增至少一个第二节点之前,基于该目标索引的数据写入速率与该目标速率范围的上限的差值,以及互不相同的多种备选的节点规格,确定待新增的该至少一个第二节点的数量,以及每个第二节点的节点规格。其中,每个第二节点的节点规格是从该多种备选节点的规格中选取的。
可选地,该至少一个第二节点包括的处理器核的总数m1满足:m1≥(s1-s2)/s0。其中,s1为目标索引的数据写入速率,s2为目标速率范围的上限,s0为每个处理器核的数据写入速率阈值。
可选地,该至少一个第二节点所采用的资源为竞价资源。
可选地,该至少一个分片满足下述条件中的至少一种:分片中已写入的数据量小于第一阈值;分片所在的第一节点中分布的分片的总数大于第二阈值。
可选地,该调整模块202可以用于:基于该目标索引的数据写入速率小于该目标速率范围的下限,从该多个第一节点中确定待删除的至少一个第一目标节点;将该至少一个第一目标节点中分布的分片均迁移至除该至少一个第一目标节点之外的其他第一节点;删除该至少一个第一目标节点。该调整模块202的功能实现还可以参考上述步骤102b1至步骤102b3的相关描述。
可选地,该至少一个第一目标节点满足:节点中分布的分片的总数小于第三阈值。
可选地,该调整模块202可以用于:基于该目标索引的数据写入速率处于目标速率范围之外,调整该多个第一节点中至少一个第一节点的节点规格。
可选地,该调整模块202可以用于:基于该目标索引的数据写入速率大于该目标速率范围的上限,增大该多个第一节点中至少一个第二目标节点的节点规格。或者,基于该目标索引的数据写入速率小于该目标速率范围的下限,减小该多个第一节点中至少一个第三目标节点的节点规格。
可选地,该多个第一节点中第四目标节点所采用的资源为竞价资源;该调整模块202还可以用于:基于该第四目标节点所采用的竞价资源的剩余可用时长小于时长阈值,在该ES集群中新增至少一个第三节点;将该第四目标节点中分布的分片均迁移至该至少一个第三节点;删除该第四目标节点。该调整模块202的功能实现还可以参考上述步骤103至步骤105的相关描述。
可选地,该至少一个第三节点所采用的资源包括按需资源和/或竞价资源。
可选地,该ES集群还可以包括多个第四节点,该多个第四节点用于承载目标索引的多个副本。该统计模块201,还可以用于统计该目标索引的数据读取频率。该统计模块201的功能实现还可以参考上述步骤106的相关描述。
该调整模块202,还可以用于基于该目标索引的数据读取频率位于目标频率范围之外,调整该目标索引所包括的副本的数量。该调整模块202的功能实现还可以参考上述步骤107的相关描述。
可选地,该调整模块202可以用于:基于该目标索引的数据读取频率大于该目标频率范围的上限,在该ES集群中新增至少一个第五节点;在每个第五节点中新增该目标索引的至少一个副本。
可选地,该调整模块202可以用于:基于该目标索引的数据读取频率小于该目标频率范围的下限,删除该多个第四节点中至少一个第五目标节点中分布的副本,并删除该至少一个第五目标节点。
可以理解的是,若该资源调度装置为图2所示的应用托管组件,则该统计模块201的功能可以由服务SDK、AGW和AASS组件实现,该调整模块202的功能可以由AASS组件、客户端代理组件和全域调度组件实现。
综上所述,本申请实施例提供了一种ES集群的资源调度装置。该装置能够统计目标索引的数据写入速率,并能够在该数据写入速率处于目标速率范围之外时,动态调整该目标索引的多个分片所占用的节点的资源量。由于目标索引的数据存储容量,以及所支持的最大数据写入速率均与该多个分片所占用的资源量相关,因此本申请实施例提供的装置能够在不改变目标索引所包括的分片数量的前提下,实现对目标索引的数据存储容量和最大数据写入速率的动态调节。由此,不仅有效提高了数据写入的灵活性,且有效提高了集群资源的利用率。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的资源调度装置以及各模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
可以理解的是,资源调度装置中的各个模块(例如统计模块201和调整模块202)均可以通过软件实现,或者可以通过硬件实现。示例性的,下文以统计模块201为例,介绍统计模块201的实现方式。类似的,调整模块202的实现方式可以参考统计模块201的实现方式。
模块作为软件功能单元的一种举例,统计模块201可以包括运行在计算实例上的代码。其中,计算实例可以包括物理主机(计算设备)、虚拟机、容器中的至少一种。进一步地,上述计算实例可以是一台或者多台。例如,统计模块201可以包括运行在多个主机/虚拟机/容器上的代码。需要说明的是,用于运行该代码的多个主机/虚拟机/容器可以分布在相同的区域(region)中,也可以分布在不同的region中。进一步地,用于运行该代码的多个主机/虚拟机/容器可以分布在相同的可用区(availability zone,AZ)中,也可以分布在不同的AZ中,每个AZ包括一个数据中心或多个地理位置相近的数据中心。其中,通常一个region可以包括多个AZ。
同样,用于运行该代码的多个主机/虚拟机/容器可以分布在同一个虚拟私有云(virtual private cloud,VPC)中,也可以分布在多个VPC中。其中,通常一个VPC设置在一个region内,同一region内两个VPC之间,以及不同region的VPC之间跨区通信需在每个VPC内设置通信网关,经通信网关实现VPC之间的互连。
模块作为硬件功能单元的一种举例,统计模块201可以包括至少一个计算设备,如服务器等。或者,统计模块201也可以是利用专用集成电路(application-specific integrated circuit,ASIC)实现、或可编程逻辑器件(programmable logic device,PLD)实现的设备等。其中,上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD)、现场可编程门阵列(field-programmable gate array,FPGA)、通用阵列逻辑(generic array logic,GAL)或其任意组合实现。
统计模块201包括的多个计算设备可以分布在相同的region中,也可以分布在不同的region中。统计模块201包括的多个计算设备可以分布在相同的AZ中,也可以分布在不同的AZ中。同样,统计模块201包括的多个计算设备可以分布在同一个VPC中,也可以分布在多个VPC中。其中,所述多个计算设备可以是服务器、ASIC、PLD、CPLD、FPGA和GAL等计算设备的任意组合。
需要说明的是,在其他实施例中,统计模块201可以用于执行上述资源调度方法中的任意步骤,调整模块202也可以用于执行上述资源调度方法中的任意步骤。统计模块201和调整模块202负责实现的步骤可根据需要指定,通过统计模块201和调整模块202分别实现资源调度方法中不同的步骤来实现资源调度装置的全部功能。
图21是本申请实施例提供的一种计算设备的结构示意图。参考图21,该计算设备可以包括:总线2102、处理器2104、存储器2106和通信接口2108。处理器2104、存储器2106和通信接口2108之间通过总线2102通信。计算设备可以是服务器或终端设备。应理解,本申请实施例不限定计算设备中的处理器、存储器的个数。
总线2102可以是外设部件互连标准(peripheral component interconnect,PCI)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图21中仅用一条线表示,但并不表示仅有一根总线或一种类型的总线。总线2102可包括在计算设备各个部件(例如,存储器2106、处理器2104、通信接口2108)之间传送信息的通路。
处理器2104可以包括中央处理器(central processing unit,CPU)、图形处理器(graphics processing unit,GPU)、微处理器(micro processor,MP)或者数字信号处理器(digital signal processor,DSP)等处理器中的任意一种或多种。
存储器2106可以包括易失性存储器(volatile memory),例如随机存取存储器(random access memory,RAM)。处理器2104还可以包括非易失性存储器(non-volatile memory),例如只读存储器(read-only memory,ROM),快闪存储器,机械硬盘(hard disk drive,HDD)或固态硬盘(solid state drive,SSD)。
存储器2106中存储有可执行的程序代码,处理器2104执行该可执行的程序代码以分别实现前述统计模块和调整模块的功能,从而实现上述方法实施例提供的资源调度方法。也即,存储器2106上存有用于执行资源调度方法的指令。
通信接口2108使用例如但不限于网络接口卡、收发器一类的收发模块,来实现计算设备与其他设备或通信网络之间的通信。
本申请实施例还提供了一种计算设备集群。该计算设备集群包括至少一台计算设备。该计算设备可以是服务器,例如是中心服务器、边缘服务器,或者是本地数据中心中的本地服务器。在一些实施例中,计算设备也可以是台式机、笔记本电脑或者智能手机等终端设备。
如图22所示,该计算设备集群包括至少一个计算设备。该计算设备集群中的一个或多个计算设备中的存储器2106中可以存有相同的用于执行上述资源调度方法的指令。
在一些可能的实现方式中,该计算设备集群中的一个或多个计算设备的存储器2106中也可以分别存有用于执行上述资源调度方法的部分指令。换言之,一个或多个计算设备的组合可以共同执行用于执行上述资源调度方法的指令。
需要说明的是,计算设备集群中的不同的计算设备中的存储器2106可以存储不同的指令,分别用于执行资源调度装置的部分功能。也即,不同的计算设备中的存储器2106存储的指令可以实现统计模块和调整模块中的一个或多个模块的功能。
在一些可能的实现方式中,计算设备集群中的一个或多个计算设备可以通过网络连接。其中,所述网络可以是广域网或局域网等等。
本申请实施例还提供了一种计算机可读存储介质。所述计算机可读存储介质可以是计算设备能够存储的任何可用介质或者是包含一个或多个可用介质的数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘)等。该计算机可读存储介质包括指令,所述指令指示计算设备执行上述方法实施例提供的ES集群的资源调度方法。
本申请实施例还提供了一种包含指令的计算机程序产品。所述计算机程序产品可以是包含指令的,能够运行在计算设备上或被储存在任何可用介质中的软件或程序产品。当所述计算机程序产品在至少一个计算设备上运行时,使得至少一个计算设备执行上述方法实施例提供的ES集群的资源调度方法。
本申请实施例还提供了一种弹性搜索系统,该弹性搜索系统能够提供云搜索服务(cloud search service,CSS)。该弹性搜索系统可以包括诸如图1所示的ES集群,以及用于对该ES集群的资源进行调度的资源调度装置。
其中,该ES集群可以包括多个节点。该多个节点可以采用读写分离的方式部署,且可以采用存算分离的方式部署。
该资源调度装置可以用于实现上述方法实施例提供的ES集群的资源调度方法。例如,该资源调度装置可以是图2所示的应用托管组件,且该资源调度装置的结构可以参考图20至图22中的任一附图。
在本申请实施例中,术语“第一”、“第二”和“第三”仅用于描述目的,而不能理解为指示或暗示相对重要性。本申请中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前 述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的保护范围。

Claims (38)

  1. 一种弹性搜索集群的资源调度方法,其特征在于,所述弹性搜索集群包括多个第一节点,所述多个第一节点用于承载目标索引的多个分片;所述方法包括:
    统计所述目标索引的数据写入速率;
    基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个分片所占用的节点的资源量。
  2. 根据权利要求1所述的方法,其特征在于,所述基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个分片所占用的节点的资源量,包括:
    基于所述目标索引的数据写入速率大于所述目标速率范围的上限,在所述弹性搜索集群中新增至少一个第二节点;
    将所述多个分片中的至少一个分片迁移至所述至少一个第二节点。
  3. 根据权利要求2所述的方法,其特征在于,在所述弹性搜索集群中新增至少一个第二节点之前,所述方法还包括:
    基于所述目标索引的数据写入速率与所述目标速率范围的上限的差值,确定待新增的所述至少一个第二节点的数量;
    其中,所述数量与所述差值正相关,且所述至少一个第二节点的节点规格均为预设规格。
  4. 根据权利要求2所述的方法,其特征在于,在所述弹性搜索集群中新增至少一个第二节点之前,所述方法还包括:
    基于所述目标索引的数据写入速率与所述目标速率范围的上限的差值,以及互不相同的多种备选的节点规格,确定待新增的所述至少一个第二节点的数量,以及每个第二节点的节点规格;
    其中,每个第二节点的节点规格是从所述多种备选节点的规格中选取的。
  5. 根据权利要求2至4任一所述的方法,其特征在于,所述至少一个第二节点包括的处理器核的总数m1满足:
    m1≥(s1-s2)/s0;
    其中,s1为所述目标索引的数据写入速率,s2为所述目标速率范围的上限,s0为每个处理器核的数据写入速率阈值。
  6. 根据权利要求2至5任一所述的方法,其特征在于,所述至少一个第二节点所采用的资源为竞价资源。
  7. 根据权利要求2至6任一所述的方法,其特征在于,所述至少一个分片满足下述条件中的至少一种:
    分片中已写入的数据量小于第一阈值;
    分片所在的第一节点中分布的分片的总数大于第二阈值。
  8. 根据权利要求1所述的方法,其特征在于,所述基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个分片所占用的节点的资源量,包括:
    基于所述目标索引的数据写入速率小于所述目标速率范围的下限,从所述多个第一节点中确定待删除的至少一个第一目标节点;
    将所述至少一个第一目标节点中分布的分片均迁移至除所述至少一个第一目标节点之外的其他第一节点;
    删除所述至少一个第一目标节点。
  9. 根据权利要求8所述的方法,其特征在于,每个第一目标节点中分布的分片的总数小于第三阈值。
  10. 根据权利要求1至9任一所述的方法,其特征在于,所述基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个分片所占用的节点的资源量,包括:
    基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个第一节点中至少一个第一节点的节点规格。
  11. 根据权利要求10所述的方法,其特征在于,所述基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个第一节点中至少一个第一节点的节点规格,包括:
    基于所述目标索引的数据写入速率大于所述目标速率范围的上限,增大所述多个第一节点中至少一个第二目标节点的节点规格。
  12. 根据权利要求10所述的方法,其特征在于,所述基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个第一节点中至少一个第二目标节点的节点规格,包括:
    基于所述目标索引的数据写入速率小于所述目标速率范围的下限,减小所述多个第一节点中至少一个第三目标节点的节点规格。
  13. 根据权利要求1至12任一所述的方法,其特征在于,所述多个第一节点中第四目标节点所采用的资源为竞价资源;所述方法还包括:
    基于所述第四目标节点所采用的竞价资源的剩余可用时长小于时长阈值,在所述弹性搜索集群中新增至少一个第三节点;
    将所述第四目标节点中分布的分片均迁移至所述至少一个第三节点;
    删除所述第四目标节点。
  14. 根据权利要求13所述的方法,其特征在于,所述至少一个第三节点所采用的资源包括按需资源和/或竞价资源。
  15. 根据权利要求1至14任一所述的方法,其特征在于,所述弹性搜索集群还包括多个第四节点,所述多个第四节点用于承载所述目标索引的多个副本,所述方法还包括:
    统计所述目标索引的数据读取频率;
    基于所述目标索引的数据读取频率位于目标频率范围之外,调整所述目标索引所包括的 副本的数量。
  16. 根据权利要求15所述的方法,其特征在于,所述基于所述目标索引的数据读取频率位于目标频率范围之外,调整所述目标索引所包括的副本的数量,包括:
    基于所述目标索引的数据读取频率大于所述目标频率范围的上限,在所述弹性搜索集群中新增至少一个第五节点;
    在每个第五节点中新增所述目标索引的至少一个副本。
  17. 根据权利要求15所述的方法,其特征在于,所述基于所述目标索引的数据读取频率位于目标频率范围之外,调整所述目标索引所包括的副本的数量,包括:
    基于所述目标索引的数据读取频率小于所述目标频率范围的下限,删除所述多个第四节点中至少一个第五目标节点中分布的副本;
    删除所述至少一个第五目标节点。
  18. 一种弹性搜索集群的资源调度装置,其特征在于,所述弹性搜索集群包括用于承载目标索引的多个第一节点,所述目标索引包括多个分片;所述资源调度装置包括:
    统计模块,用于统计所述目标索引的数据写入速率;
    调整模块,用于基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个分片所占用的节点的资源量。
  19. 根据权利要求18所述的资源调度装置,其特征在于,所述调整模块,用于:
    基于所述目标索引的数据写入速率大于所述目标速率范围的上限,在所述弹性搜索集群中新增至少一个第二节点;
    将所述多个分片中的至少一个分片迁移至所述至少一个第二节点。
  20. 根据权利要求19所述的资源调度装置,其特征在于,所述调整模块,还用于:
    基于所述目标索引的数据写入速率与所述目标速率范围的上限的差值,确定待新增的所述至少一个第二节点的数量;
    其中,所述数量与所述差值正相关,且所述至少一个第二节点的节点规格均为预设规格。
  21. 根据权利要求19所述的资源调度装置,其特征在于,所述调整模块,还用于:
    基于所述目标索引的数据写入速率与所述目标速率范围的上限的差值,以及互不相同的多种备选的节点规格,确定待新增的所述至少一个第二节点的数量,以及每个第二节点的节点规格;
    其中,每个第二节点的节点规格是从所述多种备选节点的规格中选取的。
  22. 根据权利要求19至21任一所述的资源调度装置,其特征在于,所述至少一个第二节点包括的处理器核的总数m1满足:
    m1≥(s1-s2)/s0;
    其中,s1为所述目标索引的数据写入速率,s2为所述目标速率范围的上限,s0为每个处 理器核的数据写入速率阈值。
  23. 根据权利要求19至22任一所述的资源调度装置,其特征在于,所述至少一个第二节点所采用的资源为竞价资源。
  24. 根据权利要求19至23任一所述的资源调度装置,其特征在于,所述至少一个分片满足下述条件中的至少一种:
    分片中已写入的数据量小于第一阈值;
    分片所在的第一节点中分布的分片的总数大于第二阈值。
  25. 根据权利要求18所述的资源调度装置,其特征在于,所述调整模块,用于:
    基于所述目标索引的数据写入速率小于所述目标速率范围的下限,从所述多个第一节点中确定待删除的至少一个第一目标节点;
    将所述至少一个第一目标节点中分布的分片均迁移至除所述至少一个第一目标节点之外的其他第一节点;
    删除所述至少一个第一目标节点。
  26. 根据权利要求25所述的资源调度装置,其特征在于,每个第一目标节点中分布的分片的总数小于第三阈值。
  27. 根据权利要求18至26任一所述的资源调度装置,其特征在于,所述调整模块,用于:
    基于所述目标索引的数据写入速率处于目标速率范围之外,调整所述多个第一节点中至少一个第一节点的节点规格。
  28. 根据权利要求27所述的资源调度装置,其特征在于,所述调整模块,用于:
    基于所述目标索引的数据写入速率大于所述目标速率范围的上限,增大所述多个第一节点中至少一个第二目标节点的节点规格。
  29. 根据权利要求27所述的资源调度装置,其特征在于,所述调整模块,用于:
    基于所述目标索引的数据写入速率小于所述目标速率范围的下限,减小所述多个第一节点中至少一个第三目标节点的节点规格。
  30. 根据权利要求18至29任一所述的资源调度装置,其特征在于,所述多个第一节点中第四目标节点所采用的资源为竞价资源;所述调整模块,还用于:
    基于所述第四目标节点所采用的竞价资源的剩余可用时长小于时长阈值,在所述弹性搜索集群中新增至少一个第三节点;
    将所述第四目标节点中分布的分片均迁移至所述至少一个第三节点;
    删除所述第四目标节点。
  31. 根据权利要求30所述的资源调度装置,其特征在于,所述至少一个第三节点所采用的 资源包括按需资源和/或竞价资源。
  32. 根据权利要求18至31任一所述的资源调度装置,其特征在于,所述弹性搜索集群还包括多个第四节点,所述多个第四节点用于承载所述目标索引的多个副本,所述装置还包括:
    所述统计模块,还用于统计所述目标索引的数据读取频率;
    所述调整模块,还用于基于所述目标索引的数据读取频率位于目标频率范围之外,调整所述目标索引所包括的副本的数量。
  33. 根据权利要求32所述的资源调度装置,其特征在于,所述调整模块,用于:
    基于所述目标索引的数据读取频率大于所述目标频率范围的上限,在所述弹性搜索集群中新增至少一个第五节点;
    在每个第五节点中新增所述目标索引的至少一个副本。
  34. 根据权利要求32所述的资源调度装置,其特征在于,所述调整模块,用于:
    基于所述目标索引的数据读取频率小于所述目标频率范围的下限,删除所述多个第四节点中至少一个第五目标节点中分布的副本;
    删除所述至少一个第五目标节点。
  35. 一种计算设备集群,其特征在于,包括至少一个计算设备,每个计算设备包括处理器和存储器;
    所述至少一个计算设备的处理器用于执行所述至少一个计算设备的存储器中存储的指令,以使得所述计算设备集群执行如权利要求1至17任一所述的方法。
  36. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序指令,当所述计算机程序指令由计算设备集群执行时,所述计算设备集群执行如权利要求1至17任一所述的方法。
  37. 一种包含指令的计算机程序产品,其特征在于,当所述指令被计算设备集群运行时,使得所述计算设备集群执行如权利要求1至17任一所述的方法。
  38. 一种弹性搜索系统,其特征在于,所述系统包括:弹性搜索集群,以及所述弹性搜索集群的资源调度装置,所述资源调度装置用于实现如权利要求1至17任一所述的方法。
PCT/CN2022/136923 2022-05-11 2022-12-06 弹性搜索集群的资源调度方法、装置及系统 WO2023216571A1 (zh)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202210510751 2022-05-11
CN202210510751.2 2022-05-11
CN202210764591.4 2022-06-29
CN202210764591.4A CN117093357A (zh) 2022-05-11 2022-06-29 弹性搜索集群的资源调度方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2023216571A1 true WO2023216571A1 (zh) 2023-11-16

Family

ID=88729584

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/136923 WO2023216571A1 (zh) 2022-05-11 2022-12-06 弹性搜索集群的资源调度方法、装置及系统

Country Status (1)

Country Link
WO (1) WO2023216571A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117857568A (zh) * 2023-12-25 2024-04-09 慧之安信息技术股份有限公司 基于云边协同的边缘设备增容配置方法和系统
CN117908802A (zh) * 2024-03-19 2024-04-19 北京鉴智科技有限公司 数据存储方法、装置、电子设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107566531A (zh) * 2017-10-17 2018-01-09 厦门市美亚柏科信息股份有限公司 一种支持均衡资源的Elasticsearch集群扩展方法
CN111949494A (zh) * 2020-09-16 2020-11-17 北京浪潮数据技术有限公司 一种任务调控方法、装置及相关设备
CN113609245A (zh) * 2021-06-24 2021-11-05 济南浪潮数据技术有限公司 一种索引的分片扩容方法及系统
CN113986878A (zh) * 2021-10-26 2022-01-28 深信服科技股份有限公司 一种数据写入方法、数据迁移方法、装置及电子设备
US20220129468A1 (en) * 2020-10-23 2022-04-28 EMC IP Holding Company LLC Method, device, and program product for managing index of streaming data storage system
CN115129768A (zh) * 2022-05-25 2022-09-30 网易(杭州)网络有限公司 一种分布式搜索引擎的节点扩容的方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107566531A (zh) * 2017-10-17 2018-01-09 厦门市美亚柏科信息股份有限公司 一种支持均衡资源的Elasticsearch集群扩展方法
CN111949494A (zh) * 2020-09-16 2020-11-17 北京浪潮数据技术有限公司 一种任务调控方法、装置及相关设备
US20220129468A1 (en) * 2020-10-23 2022-04-28 EMC IP Holding Company LLC Method, device, and program product for managing index of streaming data storage system
CN113609245A (zh) * 2021-06-24 2021-11-05 济南浪潮数据技术有限公司 一种索引的分片扩容方法及系统
CN113986878A (zh) * 2021-10-26 2022-01-28 深信服科技股份有限公司 一种数据写入方法、数据迁移方法、装置及电子设备
CN115129768A (zh) * 2022-05-25 2022-09-30 网易(杭州)网络有限公司 一种分布式搜索引擎的节点扩容的方法

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117857568A (zh) * 2023-12-25 2024-04-09 慧之安信息技术股份有限公司 基于云边协同的边缘设备增容配置方法和系统
CN117908802A (zh) * 2024-03-19 2024-04-19 北京鉴智科技有限公司 数据存储方法、装置、电子设备及存储介质

Similar Documents

Publication Publication Date Title
WO2023216571A1 (zh) 弹性搜索集群的资源调度方法、装置及系统
US11157457B2 (en) File management in thin provisioning storage environments
US10382380B1 (en) Workload management service for first-in first-out queues for network-accessible queuing and messaging services
US20190163371A1 (en) Next generation storage controller in hybrid environments
CN111522636B (zh) 应用容器的调整方法、调整系统、计算机可读介质及终端设备
US20150201036A1 (en) Gateway device, file server system, and file distribution method
US20140173620A1 (en) Resource allocation method and resource management platform
US20170126583A1 (en) Method and electronic device for bandwidth allocation based on online media services
US8661055B2 (en) File server system and storage control method
US11262916B2 (en) Distributed storage system, data processing method, and storage node
US11861196B2 (en) Resource allocation method, storage device, and storage system
US9313270B2 (en) Adaptive asynchronous data replication in a data storage system
US20220075757A1 (en) Data read method, data write method, and server
JP2018525743A (ja) 負荷平衡方法及び装置
US11914894B2 (en) Using scheduling tags in host compute commands to manage host compute task execution by a storage device in a storage system
WO2017075967A1 (zh) 在线媒体服务的带宽分配方法及系统
JP2005031987A (ja) コンテンツ配信システムにおけるコンテンツ配置管理システム及びコンテンツ配置管理プログラム
CN113553179A (zh) 分布式键值存储负载均衡方法及系统
CN111857992A (zh) 一种Radosgw模块中线程资源分配方法和装置
US11231964B2 (en) Computing device shared resource lock allocation
US9893972B1 (en) Managing I/O requests
US20190317665A1 (en) Resource fairness control in distributed storage systems using congestion data
WO2020134786A1 (zh) 服务器的扩容方法及装置、服务器、存储介质
US11256440B2 (en) Method and distributed storage system for aggregating statistics
CN117093357A (zh) 弹性搜索集群的资源调度方法、装置及系统

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22941506

Country of ref document: EP

Kind code of ref document: A1