Data processing method, device and related equipment

By obtaining the status information of the ElasticSearch cluster and the data to be written, and optimizing the storage location and time point, the problem of low data writing efficiency of the cluster under high load is solved, and higher query performance and data processing efficiency are achieved.

CN118170737BActive Publication Date: 2024-10-18CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410579112.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-11
Publication Date
2024-10-18
Estimated Expiration
2044-05-11

AI Technical Summary

Technical Problem

In the ElasticSearch cluster, when the number of shards in a single cluster reaches tens of thousands and the number of data nodes reaches hundreds, node detachment and network glitches lead to reduced query performance, lower data writing efficiency, increased maintenance costs, and possible data writing. Bugs or slowness issues.

Method used

By obtaining multiple data to be written and status information of the cluster, cache information is generated to indicate the storage location and time point of each data to be written, and the data is migrated to a storage location with higher query performance after a preset period of time, using Load dynamic evaluation algorithm and time wheel mechanism optimize data storage and query.

Benefits of technology

It improves data processing efficiency, reduces data writing error rate and maintenance costs, improves query performance, and ensures the stability and reliability of data under high load conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118170737B_ABST
    Figure CN118170737B_ABST
Patent Text Reader

Abstract

The present application provides a data processing method, device and related equipment, the method comprising: obtaining multiple state information corresponding to multiple data to be written and multiple clusters; generating cache information according to the multiple state information and the multiple data to be written; based on the cache information, storing each of the data to be written in the corresponding first storage location; when the storage time of the data to be written in the corresponding first storage location exceeds the preset time, migrating the data to be written from the first storage location to the corresponding second storage location. After determining the multiple state information corresponding to the multiple clusters, the present application allocates corresponding cache information to the multiple data to be written based on the multiple state information, thereby accurately allocating a cluster for storage for each data to be written, thereby improving data processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of cloud computing, and in particular, to a data processing method, apparatus, and related equipment. Background Art

[0002] ElasticSearch is an excellent search engine tool in the industry, and is usually used in log scenarios for writing, storing, and searching logs. However, due to its own architectural design, when the number of shards in a single cluster reaches tens of thousands and the number of data nodes reaches hundreds, nodes often detach, resulting in cluster network glitches, and significantly reduced query performance in scenarios such as concurrent queries, aggregations, and scrolls. In severe cases, it may even affect normal data access, and the maintenance cost of the cluster will increase significantly. As a result, data writing errors or slow speeds often occur when writing data, resulting in low data processing efficiency. Summary of the invention

[0003] The embodiments of the present application provide a data processing method, apparatus and related equipment to solve the problem of low data writing efficiency in the prior art.

[0004] To solve the above problems, this application is implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:

[0006] Acquire multiple pieces of data to be written and multiple pieces of status information corresponding to multiple clusters, wherein the multiple clusters correspond to the multiple pieces of status information one-to-one, and the status information is used to indicate the current load status of the corresponding cluster;

[0007] Generate cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate storage information of each of the multiple data to be written, and the storage information of the target data includes: a time point when the target data is written into a target cluster and a first storage location where the target data is written into the target cluster, the target data is any one of the multiple data to be written, and the target cluster is a cluster with the highest matching degree with the target data among the multiple clusters;

[0008] Based on the cache information, storing each of the to-be-written data in the corresponding first storage location;

[0009] When the storage time of the data to be written in the corresponding first storage location exceeds a preset time, the data to be written is migrated from the first storage location to the corresponding second storage location, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data.

[0010] Optionally, generating cache information according to the multiple pieces of state information and the multiple pieces of data to be written includes:

[0011] Calculate the multiple pieces of state information and the multiple pieces of data to be written according to a load dynamic evaluation algorithm to obtain a first calculation result, where the first calculation result is used to indicate a first storage location corresponding to the data to be written;

[0012] Determine a second calculation result according to the first calculation result, where the second calculation result is used to indicate a writing time point corresponding to the data to be written;

[0013] The cache information is generated according to the first calculation result and the second calculation result.

[0014] Optionally, storing each of the to-be-written data in a corresponding first storage location based on the cache information includes:

[0015] Determine multiple target time points based on the cache information, the multiple target time points correspond one-to-one to the multiple data to be written, and the multiple target time points are time points when the corresponding data to be written is written into the cluster;

[0016] generating a time wheel according to the plurality of target time points, the time wheel comprising the plurality of target time points sequentially arranged in chronological order;

[0017] According to the time wheel and the cache information, each of the to-be-written data is stored in the corresponding first storage location.

[0018] Optionally, storing each of the to-be-written data in a corresponding first storage location according to the time wheel and the cache information includes:

[0019] Generate a plurality of metadata mapping tables based on the plurality of clusters and the cache information, wherein the plurality of metadata mapping tables correspond to the plurality of clusters one by one, and the metadata mapping tables are used to indicate the location and storage time of the content stored in the corresponding cluster;

[0020] According to the time wheel and the plurality of metadata mapping information, each of the to-be-written data is stored in the corresponding first storage location.

[0021] Optionally, storing each of the to-be-written data in a corresponding first storage location according to the time wheel and the plurality of metadata mapping information includes:

[0022] In a case where the index corresponding to the target data is an index other than the preset index, determining a first cluster among the multiple clusters, the first cluster being a cluster with the lowest current load among the multiple clusters;

[0023] Writing the target data to the first cluster according to the time wheel and the plurality of metadata mapping information;

[0024] When the index corresponding to the target data is a preset index and the load index of the target cluster is greater than a preset threshold, updating the time wheel to obtain a target time wheel;

[0025] storing the target data in a corresponding first storage location according to the target time wheel and the plurality of metadata mapping tables;

[0026] In a case where the index corresponding to the target data is a preset index and the load index of the target cluster is less than a preset threshold, determining a second cluster from among the multiple clusters, the second cluster being a cluster with the lowest current load among the multiple clusters;

[0027] The target data is written to the second cluster for storage according to the time wheel and the plurality of metadata mapping information.

[0028] Optionally, when the storage time of the data to be written in the corresponding first storage location exceeds a preset time, after migrating the data to be written from the first storage location to the corresponding second storage location, the method further includes:

[0029] Obtaining a data query request, where the data query request is used to query first data in the multiple clusters;

[0030] Acquire storage information in the plurality of clusters, where the storage information is used to indicate at least one storage location of the first data in the plurality of clusters;

[0031] Screening the at least one storage location according to a preset condition to determine a target storage location, wherein the preset condition includes at least one of the following: whether the storage location is within the preset time length, whether the storage location is located at the first storage location, and whether the storage location is located at the second storage location;

[0032] The first data is acquired according to the target storage location.

[0033] In a second aspect, an embodiment of the present application further provides a data processing device, the device comprising:

[0034] An acquisition module, used for acquiring a plurality of data to be written and a plurality of status information corresponding to a plurality of clusters, wherein the plurality of clusters correspond to the plurality of status information one by one, and the status information is used for indicating a current load status of the corresponding cluster;

[0035] A generating module, configured to generate cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate storage information of each of the multiple data to be written, and the storage information of the target data includes: a time point when the target data is written into a target cluster and a first storage location where the target data is written into the target cluster, the target data is any one of the multiple data to be written, and the target cluster is a cluster with the highest matching degree with the target data among the multiple clusters;

[0036] A writing module, used for storing each of the to-be-written data in the corresponding first storage location based on the cache information;

[0037] A migration module is used to migrate the data to be written from the first storage location to the corresponding second storage location when the storage time of the data to be written in the corresponding first storage location exceeds a preset time, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data.

[0038] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor; the processor is used to read the program in the memory to implement the steps of the method described in the first aspect above.

[0039] In a fourth aspect, an embodiment of the present application further provides a readable storage medium for storing a program, which, when executed by a processor, implements the steps in the method described in the first aspect above.

[0040] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps in the method described in the first aspect.

[0041] The present application provides a data processing method, device and related equipment, the method comprising: obtaining multiple state information corresponding to multiple data to be written and multiple clusters, the multiple clusters corresponding to the multiple state information one-to-one, the state information being used to indicate the current load state of the corresponding cluster; generating cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate the storage information of each of the multiple data to be written, the storage information of the target data comprising: the time point when the target data is written into the target cluster and the first storage location where the target data is written into the target cluster, the target data being any one of the multiple data to be written, and the target cluster being the cluster with the highest degree of matching with the target data among the multiple clusters; based on the cache information, storing each of the data to be written into the corresponding first storage location; when the storage time of the data to be written into the corresponding first storage location exceeds a preset time, migrating the data to be written from the first storage location to the corresponding second storage location, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data. After determining multiple state information corresponding to multiple clusters, the present application allocates corresponding cache information to multiple data to be written based on the multiple state information, thereby accurately allocating a cluster for storage for each data to be written, thereby improving data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0043] Figure 1 It is a flowchart of a data processing method provided in an embodiment of the present application;

[0044] Figure 2 This is one of the structural diagrams of the server provided in the embodiment of the present application;

[0045] Figure 3 This is one of the data writing process diagrams provided in the embodiment of the present application;

[0046] Figure 4 This is the second data writing process diagram provided by the embodiment of the present application;

[0047] Figure 5 This is a schematic diagram of a data query process provided by an embodiment of the present application;

[0048] Figure 6This is the second structural diagram of the server provided in the embodiment of the present application;

[0049] Figure 7 is a structural schematic diagram of a data processing device provided in an embodiment of the present application;

[0050] Figure 8 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0052] The terms "first", "second" etc. in the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. In addition, "and / or" is used in the present application to represent at least one of connected objects, such as A and / or B and / or C, representing the inclusion of separate A, separate B, separate C, and A and B all exist, B and C all exist, A and C all exist, and 7 situations that A, B and C all exist.

[0053] See also Figure 1 , Figure 1 It is a flowchart of the data processing method provided in the embodiment of the present application. Figure 1 The data processing method shown can be executed by a server.

[0054] like Figure 1 As shown, the data processing method may include the following steps:

[0055] Step 101: Acquire multiple pieces of data to be written and multiple pieces of status information corresponding to multiple clusters, wherein the multiple clusters correspond to the multiple pieces of status information one-to-one, and the status information is used to indicate the current load status of the corresponding cluster.

[0056] In this embodiment, the data method used in this application can be applied to the ElasticSearch search engine, where ElasticSearch is an excellent search engine tool in the industry, which is usually used in log scenarios to write, store, and search logs. It can easily enable large amounts of data to have the ability to search, analyze, and explore. Making full use of the horizontal scalability of Elasticsearch can make data more valuable in a production environment. The implementation principle of Elasticsearch is mainly divided into the following steps. First, the user submits the data to the Elasticsearch database, and then the corresponding statement is segmented through the word segmentation controller, and its weight and word segmentation results are stored in the data together. When the user searches for data, the results are ranked and scored according to the weight, and then the returned results are presented to the user.

[0057] Specifically, Figure 2 As shown, Figure 2 This is a schematic diagram of the server structure in this embodiment. ElasticSearch includes multiple clusters. The data written from the client will first be written into the distributed cache queue. With the help of the directional routing and dynamic load evaluation capabilities in the multi-cluster controller, the write traffic is dynamically and evenly distributed according to the carrying capacity of the cluster, node, and shard. And through the management and control of ElasticSearch's own life cycle management capability data, accurate management of index data is achieved.

[0058] The data stored in different clusters may be different. For example, cluster 1 corresponds to data with indexes A3, B1, and C2, while cluster 2 corresponds to data with index A2, and cluster 3 corresponds to data with indexes A1, B2, C3, B3, and C1. It should be noted that different clusters include cold nodes and hot nodes, and the query performance of cold nodes is lower than that of hot nodes. Therefore, data with more queries is generally stored in hot nodes, and data with fewer queries is stored in cold nodes.

[0059] The status information corresponding to the multiple clusters is used to indicate the load status of the multiple clusters. For example, when the load status is higher, the pressure on the cluster to write data is greater, and when the load status is lower, the pressure on the cluster to write data is lower.

[0060] Step 102: Generate cache information based on the multiple status information and the multiple data to be written, wherein the cache information is used to indicate the storage information of each of the multiple data to be written, and the storage information of the target data includes: the time point when the target data is written to the target cluster and the first storage location where the target data is written to the target cluster, the target data is any one of the multiple data to be written, and the target cluster is the cluster with the highest degree of match with the target data among the multiple clusters.

[0061] In this embodiment, cache information is generated by using multiple state information and index information corresponding to multiple data to be written, wherein the cache information indicates storage information of each data to be written stored in a cluster. Specifically, the first storage location of each data to be written in a cluster and the time point of being stored in a cluster are both included in the storage information, thereby generating multiple storage information, and the cache information is generated as a whole through the multiple storage information, and the storage paths of multiple data to be written are indicated through the cache information.

[0062] It should be noted that in this embodiment, target data is defined, and the target data is any one of multiple data to be written, wherein the target data is written into a target cluster corresponding to the target data, wherein the target cluster is the cluster with the highest degree of match with the target data, wherein the degree of match can be that the index of the target data is the same as that of the target cluster, and the current load state of the target cluster is not high, and data can be written.

[0063] Step 103: Based on the cache information, store each of the to-be-written data in the corresponding first storage location.

[0064] In this embodiment, each data to be written is stored in the first storage location of the corresponding cluster through the determined cache information, wherein the first storage location is a hot node, therefore, the newly written data is generally stored in the hot node first.

[0065] Step 104: When the storage time of the data to be written in the corresponding first storage location exceeds a preset time, the data to be written is migrated from the first storage location to the corresponding second storage location, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data.

[0066] In this embodiment, the preset duration is the life cycle of data storage, and the second storage location is a cold node. After the data storage reaches the life cycle, it is assumed that the number of queries for the data becomes lower, so the data is moved from the hot node to the cold node. Specifically, the hot and cold cluster architecture solution is the separation of hot and cold data. The essence is to separate and store data with different access frequencies, so that data with high access volume is stored in disks with better performance to achieve more reasonable resource allocation and scheduling. The life cycle is mainly used for business needs such as log systems. The stored data will gradually reduce the retrieval requirements over time, and the early data needs to be compressed and deleted. ElasticSearch life management provides a means of managing timed data for such scenarios.

[0067] The present application provides a data processing method, which includes: obtaining multiple state information corresponding to multiple data to be written and multiple clusters, the multiple clusters corresponding to the multiple state information one-to-one, and the state information being used to indicate the current load state of the corresponding cluster; generating cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate the storage information of each of the multiple data to be written, and the storage information of the target data includes: the time point when the target data is written into the target cluster and the first storage location where the target data is written into the target cluster, the target data is any one of the multiple data to be written, and the target cluster is the cluster with the highest degree of matching with the target data among the multiple clusters; based on the cache information, storing each of the data to be written into the corresponding first storage location; when the storage time of the data to be written into the corresponding first storage location exceeds a preset time, migrating the data to be written from the first storage location to the corresponding second storage location, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data. After determining multiple state information corresponding to multiple clusters, the present application allocates corresponding cache information to multiple data to be written based on the multiple state information, thereby accurately allocating a cluster for storage for each data to be written, thereby improving data processing efficiency.

[0068] In some feasible implementation manners, optionally, generating cache information according to the multiple pieces of state information and the multiple pieces of data to be written includes:

[0069] Calculate the multiple pieces of state information and the multiple pieces of data to be written according to a load dynamic evaluation algorithm to obtain a first calculation result, where the first calculation result is used to indicate a first storage location corresponding to the data to be written;

[0070] Determine a second calculation result according to the first calculation result, where the second calculation result is used to indicate a writing time point corresponding to the data to be written;

[0071] The cache information is generated according to the first calculation result and the second calculation result.

[0072] In this embodiment, if Figure 3 As shown, Figure 3 This is a flowchart of data writing in this application. Specifically, data is written to the cache queue of the message with the index as the dimension. By analyzing the collected overall cluster operation indicators, including cluster availability, JVM, CPU, memory, number of shards, write traffic, thread pool, node status, node type and other information. The load dynamic evaluation algorithm is used to calculate the cluster, node and shard recommended for writing to the current index, that is, the first calculation result. In addition, the recommended cluster time for writing is calculated to obtain the second calculation result.

[0073] It should be noted that the load dynamic assessment algorithm normalizes the weighted deviation of indicators such as the number of CPU cores, JVM usage, number of shards, write volume, write threads, and disk usage of hot nodes, and converts and maps the characteristic values ​​into values ​​between [0-1] to facilitate comparison of thresholds when allocating time rounds:

[0074]

[0075] Among them, cur is the data recorded at the current time, min is the initialization data, and max is the maximum theoretical allowable value of the current indicator. For example, the disk cluster initialization value is 0.05, and the maximum peak value can be set to 0.85. When it exceeds 0.85, ElasticSearch will trigger the management restriction of the disk. Therefore, by assigning a weighted value to each indicator and calculating each parameter, a data is finally obtained for threshold comparison before time round allocation.

[0076] Optionally, storing each of the to-be-written data in a corresponding first storage location based on the cache information includes:

[0077] Determine multiple target time points based on the cache information, the multiple target time points correspond one-to-one to the multiple data to be written, and the multiple target time points are time points when the corresponding data to be written is written into the cluster;

[0078] generating a time wheel according to the plurality of target time points, the time wheel comprising the plurality of target time points sequentially arranged in chronological order;

[0079] According to the time wheel and the cache information, each of the to-be-written data is stored in the corresponding first storage location.

[0080] In this embodiment, a time wheel is allocated to the writing thread that obtains the priority, wherein the time period includes multiple writing time points of the data to be written, namely the target time point. Thus, the writing task within the time wheel periodically reads data from the message cache queue. The data is written to the specified cluster, node and shard position until the allocated time wheel expires. The metadata information is recorded in the metadata mapping table, including information such as time range, cluster, node, shard, life cycle stage, etc. For the data that failed to be written, consumption replay is performed according to the generation time of the log data, and it is written to the target location shard and index for execution according to the metadata mapping table; after a time wheel cycle ends, the next execution time wheel cycle is judged.

[0081] Optionally, storing each of the to-be-written data in a corresponding first storage location according to the time wheel and the cache information includes:

[0082] Generate a plurality of metadata mapping tables based on the plurality of clusters and the cache information, wherein the plurality of metadata mapping tables correspond to the plurality of clusters one by one, and the metadata mapping tables are used to indicate the location and storage time of the content stored in the corresponding cluster;

[0083] According to the time wheel and the plurality of metadata mapping information, each of the to-be-written data is stored in the corresponding first storage location.

[0084] In this embodiment, the basic composition logic of the metadata mapping table information is a multi-linked list structure. The metadata information of each cluster is stored by a linked list. The linked list records the metadata Map pointer of each index in time sequence. The index name is used as the key in the Map, and the cluster, node, shard, life cycle and other information of the index are stored.

[0085] It should be noted that the data structure designed above can efficiently complete the addressing and management of written data: the metadata information storage of multiple clusters is centrally managed, and there will be no problems with information synchronization and inconsistency; when a new index of the time wheel write priority is obtained, an information bit will be inserted at the head of the linked list to achieve fast data recording; when data needs to be replayed, the linked list can be traversed sequentially to find the corresponding time, and the corresponding write position record in the Map can be queried to achieve time-series writing of data; when the data enters the deletion cycle, the index information in the Map can be directly deleted according to the life cycle policy saved in the multi-cluster management data. If there is no data that needs to be retained during the entire time period of the linked list node, the entire node information is deleted.

[0086] Optionally, storing each of the to-be-written data in a corresponding first storage location according to the time wheel and the plurality of metadata mapping information includes:

[0087] In a case where the index corresponding to the target data is an index other than the preset index, determining a first cluster among the multiple clusters, the first cluster being a cluster with the lowest current load among the multiple clusters;

[0088] Writing the target data to the first cluster according to the time wheel and the plurality of metadata mapping information;

[0089] When the index corresponding to the target data is a preset index and the load index of the target cluster is greater than a preset threshold, updating the time wheel to obtain a target time wheel;

[0090] storing the target data in a corresponding first storage location according to the target time wheel and the plurality of metadata mapping tables;

[0091] In a case where the index corresponding to the target data is a preset index and the load index of the target cluster is less than a preset threshold, determining a second cluster from among the multiple clusters, the second cluster being a cluster with the lowest current load among the multiple clusters;

[0092] The target data is written to the second cluster for storage according to the time wheel and the plurality of metadata mapping information.

[0093] In this embodiment, when the target data is written to the target cluster, it is necessary to determine whether the target data is a preset index, wherein the preset index is an index already included in the current server. Figure 4 As shown, determine whether it is a new index; if it is a new index, directly allocate a time wheel and select the cluster, node, and shard with the lowest load for writing; if it is an existing index, first determine whether the load of the current writing target location is exceeded; if it exceeds the load, reallocate the time wheel, modify the route and write to the new target location; if it does not exceed the load, automatically extend a time wheel and continue writing to the original target location; repeat the above steps until the writing task is completed.

[0094] Optionally, when the storage time of the data to be written in the corresponding first storage location exceeds a preset time, after migrating the data to be written from the first storage location to the corresponding second storage location, the method further includes:

[0095] Obtaining a data query request, where the data query request is used to query first data in the multiple clusters;

[0096] Acquire storage information in the plurality of clusters, where the storage information is used to indicate at least one storage location of the first data in the plurality of clusters;

[0097] Screening the at least one storage location according to a preset condition to determine a target storage location, wherein the preset condition includes at least one of the following: whether the storage location is within the preset time length, whether the storage location is located at the first storage location, and whether the storage location is located at the second storage location;

[0098] The first data is acquired according to the target storage location.

[0099] In this embodiment, a performance optimization algorithm for multi-cluster scenarios is used. The algorithm uses the information recorded in the metadata mapping table to prune requests, cut unnecessary query request links, and improve the utilization efficiency of the entire multi-cluster link. In view of the fact that cold data is usually not modified, the cache is reasonably set to improve the query hit rate of cold nodes. In addition, an external processing engine is set for cross-node and cross-cluster scenarios to reduce the pressure on the ElasticSearch coordination node.

[0100] Specifically, Figure 5 As shown in the figure, when querying data, the high-load and unavailable target nodes are directly pruned, and the request will no longer traverse to such node locations; according to the time range record in the metadata mapping table, if the query time exists, the query will continue to be executed; according to the index record in the metadata mapping table, it is determined whether the request is across clusters; if the request is across clusters, the request is distributed and searched; if the request is made within the cluster, it is determined whether the request falls within the hot node interval based on the time range and the life cycle of the current index; if the request falls within the hot interval, the request is distributed to the hot node for search; if the request falls within the cold interval, the cold node historical query cache is queried to increase the response efficiency of the request; after filtering through the above steps, the remaining requests are requests with a large impact range such as cross-lifecycle nodes and cross-clusters. If it is determined that the cluster load is high, you can choose to perform result merging, deduplication, and sorting operations in the external engine to avoid query denial of service in the ElasticSearch cluster.

[0101] It should be noted that the purpose of multi-cluster management is to make multiple ElasticSearch clusters look like a single cluster from the user's perspective, which can reduce the cost of cluster usage and learning. By adding a front-end multi-cluster controller to the ElasticSearch multi-cluster, it is uniformly encapsulated as an externally exposed controller address. In addition, the multi-cluster controller is also responsible for the cluster's routing rule formulation and distribution, lifecycle policy management and distribution, metadata mapping information, and data collection policy management.

[0102] like Figure 6 As shown, Figure 6This is a schematic diagram of the structure of the data processing method implemented in this application, which can be specifically divided into four modules: write control layer, query control layer, storage control layer and management control layer. Specifically, the storage control layer includes monitoring data, metadata, and distributed cache queues. The monitoring data stores the JVM, I / O, memory, disk capacity, index write traffic, query concurrency, cluster node status, ElasticSearch node status, sharding and other information of each ElasticSearch cluster, which is used as the decision basis for allocating time wheels for concurrent writes in multiple clusters; the metadata mapping table stores information such as life cycle policies, cluster status, routing rules, and the mapping relationship between indexes and time slices; the distributed cache queue is used to buffer write traffic to prevent overload of instantaneous data, write the consumption data of the task that obtains the time wheel to the cluster of the corresponding route, and replay the data that failed to write.

[0103] The write control layer determines the expected load of cluster writes by analyzing the current index history monitoring data, implements the staggered write of traffic in different clusters according to the time wheel algorithm, and seamlessly connects with the life cycle strategy to ensure dynamic load balancing of cluster writes and achieve optimal status. At the same time, by using the index and time slice mapping relationship table saved in the metadata, cache data replay of write failure logs is achieved, and written to the index of the specified cluster according to time to ensure the time series characteristics of the logs.

[0104] The query control layer includes three management modules: time window filtering, slow query pruning, and external processing engine. In the log scenario, hot and cold architecture is usually used to store data in layers. By setting lifecycle policies, historical data can be migrated from hot nodes to cold nodes for storage. For the management of multiple clusters, it is proposed to use multiple linked lists to manage and connect them in series according to time ranges to facilitate the access of time series logs. Through the dimensions such as nodes, indexes, shards, and lifecycle policies managed in the metadata, the query range is fixed to a specific range to avoid query requests covering all nodes, increasing the load of the overall cluster, and thus affecting the cluster's read and write capabilities. In addition, when the data enters the cold node, the data will basically not change. At this time, the query request that hits the cold node can be fully cached, and when the next query condition is hit, it can be read directly from the cache. When the query request spans hot nodes, cold nodes, and even clusters, the external processing engine can be used to optionally perform the merging, deduplication, and sorting of search results to avoid excessive load on the coordination node and affect the overall request concurrent execution efficiency.

[0105] The management and control layer includes three parts: rule definition, unified entry, and lifecycle policy distribution. Rule definition is responsible for defining writing, querying, and indexing routing definitions; the unified entry is used for unified encapsulation of externally exposed addresses; lifecycle policy distribution controls the unified distribution, modification, and deletion of policies, including lifecycle policies, routing policies, data collection policies, etc.

[0106] In this application, a multi-cluster management solution is established based on the ElasticSearch lifecycle and hot-cold architecture. The write end introduces a load dynamic evaluation algorithm and a time wheel staggered index writing method to ensure data synchronization, concurrency, and cross-link multiplexing writing. At the same time, a cache queue replay mechanism is added to ensure the consistency and timing of log data writing. And by recording the metadata of the lifecycle and index write target location, the data distribution of the entire cluster can be observed. On the query side, pruning, caching, and external processing engine technologies are proposed for multi-cluster scenarios to limit the coverage of each request and reduce the resource consumption of a single request, thereby improving the concurrent query performance and capabilities of multiple clusters as a whole. Finally, based on the above scheme, a complete multi-cluster system management solution and system are designed.

[0107] In addition, the product of this application has been put online. At present, this technical solution has been applied in cloud products, and about 200+ multi-cluster nodes are hosted in the log scenario of Internet companies. In some business areas, there is a demand for the online launch of multiple clusters. It is expected that 180TB of data will be accessed in the first phase. The resource pool has been built and is about to enter the business access period. There are also business opportunities outside of Mobile, for example: business opportunities of a domestic leading car company. The multi-cluster capability of this application can help expand the cloud log management capability (underlying call ES) from 30TB to 500TB.

[0108] After determining multiple state information corresponding to multiple clusters, the present application allocates corresponding cache information to multiple data to be written based on the multiple state information, thereby accurately allocating a cluster for storage for each data to be written, thereby improving data processing efficiency.

[0109] See also Figure 7 , Figure 7 is a structural diagram of a data processing device provided in an embodiment of the present application. Figure 7 As shown, the data processing device 700 includes:

[0110] An acquisition module 710 is used to acquire multiple pieces of data to be written and multiple pieces of status information corresponding to multiple clusters, wherein the multiple clusters correspond to the multiple pieces of status information one by one, and the status information is used to indicate the current load status of the corresponding cluster;

[0111] A generating module 720 is used to generate cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate the storage information of each data to be written in the multiple data to be written, and the storage information of the target data includes: the time point when the target data is written into the target cluster and the first storage location where the target data is written into the target cluster, the target data is any one of the multiple data to be written, and the target cluster is the cluster with the highest matching degree with the target data among the multiple clusters;

[0112] A writing module 730, configured to store each of the to-be-written data in a corresponding first storage location based on the cache information;

[0113] The migration module 740 is used to migrate the data to be written from the first storage location to the corresponding second storage location when the storage time of the data to be written in the corresponding first storage location exceeds a preset time, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data.

[0114] Optionally, the generating module 720 includes:

[0115] A calculation submodule, used for calculating the plurality of state information and the plurality of data to be written according to a load dynamic evaluation algorithm to obtain a first calculation result, wherein the first calculation result is used for indicating a first storage location corresponding to the data to be written;

[0116] A first determining submodule, used to determine a second calculation result according to the first calculation result, wherein the second calculation result is used to indicate a writing time point corresponding to the data to be written;

[0117] The first generating submodule is used to generate the cache information according to the first calculation result and the second calculation result.

[0118] Optionally, the writing module 730 includes:

[0119] A second determination submodule is used to determine a plurality of target time points based on the cache information, wherein the plurality of target time points correspond one-to-one to the plurality of data to be written, and the plurality of target time points are time points at which the corresponding data to be written are written into the cluster;

[0120] A second generating submodule, configured to generate a time wheel according to the plurality of target time points, the time wheel comprising the plurality of target time points sequentially arranged in chronological order;

[0121] The writing submodule is used to store each of the to-be-written data in the corresponding first storage location according to the time wheel and the cache information.

[0122] Optionally, the writing submodule includes:

[0123] A generating unit, configured to generate a plurality of metadata mapping tables based on the plurality of clusters and the cache information, wherein the plurality of metadata mapping tables correspond to the plurality of clusters one by one, and the metadata mapping tables are used to indicate the location and storage time of the content stored in the corresponding cluster;

[0124] A writing unit is used to store each of the to-be-written data in the corresponding first storage location according to the time wheel and the plurality of metadata mapping information.

[0125] Optionally, the writing unit is also used to:

[0126] In a case where the index corresponding to the target data is an index other than the preset index, determining a first cluster among the multiple clusters, the first cluster being a cluster with the lowest current load among the multiple clusters;

[0127] Writing the target data to the first cluster according to the time wheel and the plurality of metadata mapping information;

[0128] When the index corresponding to the target data is a preset index and the load index of the target cluster is greater than a preset threshold, updating the time wheel to obtain a target time wheel;

[0129] storing the target data in a corresponding first storage location according to the target time wheel and the plurality of metadata mapping tables;

[0130] In a case where the index corresponding to the target data is a preset index and the load index of the target cluster is less than a preset threshold, determining a second cluster from among the multiple clusters, the second cluster being a cluster with the lowest current load among the multiple clusters;

[0131] The target data is written to the second cluster for storage according to the time wheel and the plurality of metadata mapping information.

[0132] Optionally, also include:

[0133] A query module, used to obtain a data query request, where the data query request is used to query the first data in the multiple clusters;

[0134] an information acquisition module, which acquires storage information in the plurality of clusters, wherein the storage information is used to indicate at least one storage location of the first data in the plurality of clusters;

[0135] a screening module, configured to screen the at least one storage location according to a preset condition to determine a target storage location, wherein the preset condition includes at least one of the following: whether the storage location is within the preset time length, whether the storage location is located at the first storage location, and whether the storage location is located at the second storage location;

[0136] A data acquisition module is used to acquire the first data according to the target storage location.

[0137] After determining multiple state information corresponding to multiple clusters, the present application allocates corresponding cache information to multiple data to be written based on the multiple state information, thereby accurately allocating a cluster for storage for each data to be written, thereby improving data processing efficiency.

[0138] The present application also provides an electronic device. Figure 8 , the electronic device may include a processor 801, a memory 802, and a program 8021 stored in the memory 802 and executable on the processor 801.

[0139] When the program 8021 is executed by the processor 801, it can achieve Figure 1 Any step in the corresponding method embodiment:

[0140] Acquire multiple pieces of data to be written and multiple pieces of status information corresponding to multiple clusters, wherein the multiple clusters correspond to the multiple pieces of status information one-to-one, and the status information is used to indicate the current load status of the corresponding cluster;

[0141] Generate cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate storage information of each of the multiple data to be written, and the storage information of the target data includes: a time point when the target data is written into a target cluster and a first storage location where the target data is written into the target cluster, the target data is any one of the multiple data to be written, and the target cluster is a cluster with the highest matching degree with the target data among the multiple clusters;

[0142] Based on the cache information, storing each of the to-be-written data in the corresponding first storage location;

[0143] When the storage time of the data to be written in the corresponding first storage location exceeds a preset time, the data to be written is migrated from the first storage location to the corresponding second storage location, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data.

[0144] Optionally, generating cache information according to the multiple pieces of state information and the multiple pieces of data to be written includes:

[0145] Calculate the multiple pieces of state information and the multiple pieces of data to be written according to a load dynamic evaluation algorithm to obtain a first calculation result, where the first calculation result is used to indicate a first storage location corresponding to the data to be written;

[0146] Determine a second calculation result according to the first calculation result, where the second calculation result is used to indicate a writing time point corresponding to the data to be written;

[0147] The cache information is generated according to the first calculation result and the second calculation result.

[0148] Optionally, storing each of the to-be-written data in a corresponding first storage location based on the cache information includes:

[0149] Determine multiple target time points based on the cache information, the multiple target time points correspond one-to-one to the multiple data to be written, and the multiple target time points are time points when the corresponding data to be written is written into the cluster;

[0150] generating a time wheel according to the plurality of target time points, the time wheel comprising the plurality of target time points sequentially arranged in chronological order;

[0151] According to the time wheel and the cache information, each of the to-be-written data is stored in the corresponding first storage location.

[0152] Optionally, storing each of the to-be-written data in a corresponding first storage location according to the time wheel and the cache information includes:

[0153] Generate a plurality of metadata mapping tables based on the plurality of clusters and the cache information, wherein the plurality of metadata mapping tables correspond to the plurality of clusters one by one, and the metadata mapping tables are used to indicate the location and storage time of the content stored in the corresponding cluster;

[0154] According to the time wheel and the plurality of metadata mapping information, each of the to-be-written data is stored in the corresponding first storage location.

[0155] Optionally, storing each of the to-be-written data in a corresponding first storage location according to the time wheel and the plurality of metadata mapping information includes:

[0156] In a case where the index corresponding to the target data is an index other than the preset index, determining a first cluster among the multiple clusters, the first cluster being a cluster with the lowest current load among the multiple clusters;

[0157] Writing the target data to the first cluster according to the time wheel and the plurality of metadata mapping information;

[0158] When the index corresponding to the target data is a preset index and the load index of the target cluster is greater than a preset threshold, updating the time wheel to obtain a target time wheel;

[0159] storing the target data in a corresponding first storage location according to the target time wheel and the plurality of metadata mapping tables;

[0160] In a case where the index corresponding to the target data is a preset index and the load index of the target cluster is less than a preset threshold, determining a second cluster from among the multiple clusters, the second cluster being a cluster with the lowest current load among the multiple clusters;

[0161] The target data is written to the second cluster for storage according to the time wheel and the plurality of metadata mapping information.

[0162] Optionally, when the storage time of the data to be written in the corresponding first storage location exceeds a preset time, after migrating the data to be written from the first storage location to the corresponding second storage location, the method further includes:

[0163] Obtaining a data query request, where the data query request is used to query first data in the multiple clusters;

[0164] Acquire storage information in the plurality of clusters, where the storage information is used to indicate at least one storage location of the first data in the plurality of clusters;

[0165] Screening the at least one storage location according to a preset condition to determine a target storage location, wherein the preset condition includes at least one of the following: whether the storage location is within the preset time length, whether the storage location is located at the first storage location, and whether the storage location is located at the second storage location;

[0166] The first data is acquired according to the target storage location.

[0167] After determining multiple state information corresponding to multiple clusters, the present application allocates corresponding cache information to multiple data to be written based on the multiple state information, thereby accurately allocating a cluster for storage for each data to be written, thereby improving data processing efficiency.

[0168] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned data processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0169] An embodiment of the present application further provides a computer program product, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the various processes of the above-mentioned data processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0170] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0171] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0172] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A data processing method, characterized in that: The method comprises: Acquire multiple pieces of data to be written and multiple pieces of status information corresponding to multiple clusters, wherein the multiple clusters correspond to the multiple pieces of status information one-to-one, and the status information is used to indicate the current load status of the corresponding cluster; Generate cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate the storage information of each of the multiple data to be written, and the storage information of the target data includes: the time point when the target data is written into the target cluster and the first storage location where the target data is written into the target cluster, the target data is any one of the multiple data to be written, and the target cluster is the cluster with the highest degree of matching with the target data among the multiple clusters, and the generating cache information according to the multiple state information and the multiple data to be written includes: calculating the multiple state information and the multiple data to be written according to a load dynamic evaluation algorithm to obtain a first calculation result, the first calculation result is used to indicate the first storage location corresponding to the data to be written; determining a second calculation result according to the first calculation result, the second calculation result is used to indicate the writing time point corresponding to the data to be written; generating the cache information according to the first calculation result and the second calculation result; Based on the cache information, each of the data to be written is stored in the corresponding first storage location, and based on the cache information, each of the data to be written is stored in the corresponding first storage location, including: determining multiple target time points based on the cache information, the multiple target time points correspond to the multiple data to be written one by one, and the multiple target time points are the time points when the corresponding data to be written is written to the cluster; generating a time wheel according to the multiple target time points, the time wheel includes the multiple target time points arranged in sequence according to time order; according to the time wheel and the cache information, storing each of the data to be written in the corresponding first storage location; When the storage time of the data to be written in the corresponding first storage location exceeds a preset time, the data to be written is migrated from the first storage location to the corresponding second storage location, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data.

2. The method according to claim 1, characterized in that: According to the time wheel and the cache information, storing each of the to-be-written data in the corresponding first storage location includes: Generate a plurality of metadata mapping tables based on the plurality of clusters and the cache information, wherein the plurality of metadata mapping tables correspond to the plurality of clusters one by one, and the metadata mapping tables are used to indicate the location and storage time of the content stored in the corresponding cluster; According to the time wheel and the plurality of metadata mapping tables, each of the to-be-written data is stored in a corresponding first storage location.

3. The method according to claim 2, characterized in that According to the time wheel and the plurality of metadata mapping tables, storing each of the to-be-written data in a corresponding first storage location includes: In a case where the index corresponding to the target data is an index other than the preset index, determining a first cluster among the multiple clusters, the first cluster being a cluster with the lowest current load among the multiple clusters; Writing the target data to the first cluster according to the time wheel and the plurality of metadata mapping tables; When the index corresponding to the target data is a preset index and the load index of the target cluster is greater than a preset threshold, updating the time wheel to obtain a target time wheel; storing the target data in a corresponding first storage location according to the target time wheel and the plurality of metadata mapping tables; In a case where the index corresponding to the target data is a preset index and the load index of the target cluster is less than a preset threshold, determining a second cluster from among the multiple clusters, the second cluster being a cluster with the lowest current load among the multiple clusters; The target data is written to the second cluster for storage according to the time wheel and the plurality of metadata mapping tables.

4. The method according to claim 1, characterized in that: When the storage time of the data to be written in the corresponding first storage location exceeds a preset time, after migrating the data to be written from the first storage location to the corresponding second storage location, the method further includes: Obtaining a data query request, where the data query request is used to query first data in the multiple clusters; Acquire storage information in the plurality of clusters, where the storage information is used to indicate at least one storage location of the first data in the plurality of clusters; Screening the at least one storage location according to a preset condition to determine a target storage location, wherein the preset condition includes at least one of the following: whether the storage location is within the preset time length, whether the storage location is located at the first storage location, and whether the storage location is located at the second storage location; The first data is acquired according to the target storage location.

5. A data processing device, characterized in that: The device comprises: An acquisition module, used for acquiring a plurality of data to be written and a plurality of status information corresponding to a plurality of clusters, wherein the plurality of clusters correspond to the plurality of status information one by one, and the status information is used for indicating a current load status of the corresponding cluster; A generation module, configured to generate cache information according to the multiple state information and the multiple data to be written, wherein the cache information is used to indicate the storage information of each of the multiple data to be written, and the storage information of the target data includes: the time point when the target data is written into the target cluster and the first storage location where the target data is written into the target cluster, the target data is any one of the multiple data to be written, and the target cluster is the cluster with the highest degree of matching with the target data among the multiple clusters, and the generation module includes: a calculation submodule, configured to calculate the multiple state information and the multiple data to be written according to a load dynamic evaluation algorithm to obtain a first calculation result, the first calculation result is used to indicate the first storage location corresponding to the data to be written; a first determination submodule, configured to determine a second calculation result according to the first calculation result, the second calculation result is used to indicate the writing time point corresponding to the data to be written; a first generation submodule, configured to generate the cache information according to the first calculation result and the second calculation result; A writing module, used for storing each of the data to be written in the corresponding first storage location based on the cache information, the writing module comprising: a second determining submodule, used for determining a plurality of target time points based on the cache information, the plurality of target time points corresponding one-to-one to the plurality of data to be written, the plurality of target time points being the time points at which the corresponding data to be written is written into the cluster; a second generating submodule, used for generating a time wheel according to the plurality of target time points, the time wheel comprising the plurality of target time points arranged in sequence in chronological order; a writing submodule, used for storing each of the data to be written in the corresponding first storage location according to the time wheel and the cache information; A migration module is used to migrate the data to be written from the first storage location to the corresponding second storage location when the storage time of the data to be written in the corresponding first storage location exceeds a preset time, wherein the query performance of the first storage location corresponding to the target data is higher than the query performance of the second storage location corresponding to the target data.

6. An electronic device comprising: A memory, a processor, and a program stored in the memory and executable on the processor; wherein the processor is used to read the program in the memory to implement the steps in the data processing method as described in any one of claims 1 to 4.

7. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 4 are implemented.

8. A computer program product, characterized in that The computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps in the data processing method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Data storage method and device

    CN111045598A

  • Time sequence database cluster data processing method and device, medium and electronic equipment

    CN113778746A