CN112988703A - Read-write request balancing method and device - Google Patents

Read-write request balancing method and device Download PDF

Info

Publication number
CN112988703A
CN112988703A CN201911313014.8A CN201911313014A CN112988703A CN 112988703 A CN112988703 A CN 112988703A CN 201911313014 A CN201911313014 A CN 201911313014A CN 112988703 A CN112988703 A CN 112988703A
Authority
CN
China
Prior art keywords
region
migration
regions
cluster
read
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN201911313014.8A
Other languages
Chinese (zh)
Other versions
CN112988703B (en
Inventor
杨名
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Sichuan Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Sichuan Co Ltd
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
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Sichuan Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201911313014.8A priority Critical patent/CN112988703B/en
Publication of CN112988703A publication Critical patent/CN112988703A/en
Application granted granted Critical
Publication of CN112988703B publication Critical patent/CN112988703B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/21Design, administration or maintenance of databases
    • G06F16/214Database migration support
    • 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/22Indexing; Data structures therefor; Storage structures
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • G06F18/232Non-hierarchical techniques
    • G06F18/2321Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions
    • G06F18/23213Non-hierarchical techniques using statistics or function optimisation, e.g. modelling of probability density functions with fixed number of clusters, e.g. K-means clustering

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Artificial Intelligence (AREA)
  • Probability & Statistics with Applications (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a read-write request balancing method and device, which utilize a preset clustering algorithm to cluster regions according to the request quantity information of each region to obtain a preset number of region cluster clusters; determining Region migration information aiming at each Region Server according to the regions contained in each Region cluster; the migration information is sent to the Hbase system. The regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, the read-write request quantity of the Region servers is timely, quickly and accurately balanced, and the data read-write response efficiency of the source database HBase is improved.

Description

Read-write request balancing method and device
Technical Field
The invention relates to the technical field of distributed data storage, in particular to a read-write request balancing method and device.
Background
At present, with the rapid development of the mobile internet and the arrival of the big data era, future data will continue to grow explosively, the data storage and access amount is greatly increased, and in order to meet the read-write operation of data, an open source database Hbase is adopted to store data and respond to the read request and the write request of a client. Among them, Hbase is a distributed, nematic, scalable based, mainly used for unstructured data storage, and has become an effective solution for mass data storage.
The Hbase serving as a distributed K-V storage database has excellent writing and reading efficiency and depends on memstore, and blockcache divided in a memory. The Region Server is the most main component in the open source database Hbase and is responsible for actual reading and writing of table data and managing data partition regions, and the regions are basic units for storing and managing the Hbase data. The Hbase table comprises a plurality of regions, each Region stores certain data, and the Region Server in the cluster can be distributed to one or more regions. The write request can consume the Memstore, the read request can consume the BlockCache, and the Memstore and the BlockCache share the Hbase JVM memory. And finally, the Hbase read-write requests are processed through regions, and the regions read and write can share the JVM memory. And aiming at the read request and the write request of the target data, the Region Server is positioned to the corresponding Region Server through the Region, and then the Region Server realizes the read-write operation of the data.
However, due to the difference of the data request amount on each Region, one or more Region hot spots may occur, where the Region hot spots are regions with read-write request amount exceeding a certain threshold, and if most of the Region hot spots are concentrated on some Region servers, this will inevitably affect the data processing efficiency of the Region servers, greatly affect the stability and availability of the whole cluster, and thus result in low read-write response efficiency of Hbase. Therefore, the Region read-write request quantity in the Region Server needs to be balanced, and currently, Region migration information is mainly manually input on an intervention interface by related personnel, and an Hbase system is triggered to migrate the Region based on the Region migration information, so that the purpose of balancing the Region Server read-write request quantity is achieved.
Therefore, the conventional method for balancing the read-write request quantity of the Region Server has the problems of certain hysteresis, low balancing efficiency and poor balancing accuracy.
Disclosure of Invention
The embodiment of the invention aims to provide a read-write request balancing method and device, and solves the problems of certain hysteresis, low balancing efficiency and poor balancing accuracy of the existing balancing method for the read-write request quantity of a Region Server.
In order to solve the above technical problem, the embodiment of the present invention is implemented as follows:
in a first aspect, an embodiment of the present invention provides a method for balancing read and write requests, including:
acquiring request quantity information of a plurality of regions under each Region Server in an Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
clustering the regions by using a preset clustering algorithm according to the request amount information to obtain a preset number of region clustering clusters, wherein each region clustering cluster corresponds to a region category;
determining Region migration information aiming at each Region Server according to each Region cluster;
and sending the Region migration information to the Hbase system so that the Hbase system migrates the regions to be migrated based on the Region migration information to balance the read-write request amount of each Region Server.
In a second aspect, an embodiment of the present invention provides an apparatus for equalizing read and write requests, including:
the request quantity obtaining module is used for obtaining request quantity information of a plurality of regions under each Region Server in the Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
the Region clustering module is used for clustering the regions according to the request amount information by using a preset clustering algorithm to obtain a preset number of Region clustering clusters, wherein each Region clustering cluster corresponds to a Region category;
the migration information determining module is used for determining the Region migration information aiming at each Region Server according to each Region cluster;
and the read-write request balancing module is used for sending the Region migration information to the Hbase system so that the Hbase system migrates the Region to be migrated based on the Region migration information to balance the read-write request quantity of each Region Server.
In a third aspect, an embodiment of the present invention provides a computer device, including a processor, a communication interface, a memory, and a communication bus; the processor, the communication interface and the memory complete mutual communication through a bus; the memory is used for storing a computer program; the processor is configured to execute the program stored in the memory, and implement the steps of the method for balancing read and write requests according to the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for equalizing read and write requests according to the first aspect are implemented.
The read-write request balancing method and device in the embodiment of the invention utilize a preset clustering algorithm to cluster the regions according to the request quantity information of each region to obtain a preset number of region clustering clusters; determining Region migration information aiming at each Region Server according to the regions contained in each Region cluster; the migration information is sent to the Hbase system. The regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, the read-write request quantity of the Region servers is timely, quickly and accurately balanced, and the data read-write response efficiency of the source database HBase is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic view of an application scenario of a read-write request balancing system according to an embodiment of the present invention;
fig. 2 is a first flowchart illustrating a method for balancing read/write requests according to an embodiment of the present invention;
fig. 3 is a second flowchart illustrating a method for balancing read/write requests according to an embodiment of the present invention;
fig. 4 is a schematic diagram illustrating an implementation principle of a region clustering process in the read-write request balancing method according to the embodiment of the present invention;
fig. 5 is a schematic flowchart of a third method for balancing read/write requests according to an embodiment of the present invention;
fig. 6 is a fourth flowchart illustrating a method for balancing read/write requests according to an embodiment of the present invention;
fig. 7 is a schematic diagram illustrating a module composition of an equalizing device for read/write requests according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a read-write request balancing method and device, which cluster regions by adopting a preset clustering algorithm, determine Region migration information according to a clustering result, dynamically and uniformly distribute the regions in each Region clustering cluster to each Region Server based on the migration information, realize timely, fast and accurately balancing the read-write request quantity of the Region Server, and further improve the data read-write response efficiency of a source database HBase.
Fig. 1 is a schematic view of an application scenario of a read-write request balancing system according to an embodiment of the present invention, as shown in fig. 1, the system includes: the Hbase system comprises a background Server and an Hbase system, wherein the background Server can be a Server used for balancing read-write requests of each Region Server in the Hbase system, and the background Server automatically determines Region migration information based on the request quantity information of the regions to trigger the Hbase system to perform Region migration based on the Region migration information, so that the read-write requests of the Region servers are balanced; the Hbase system comprises: the system comprises a plurality of distributed nodes, namely a plurality of distributed servers for reading and writing storage data, wherein each distributed node is deployed with a Region Server service, each Region Server provides services for a plurality of regions, and the regions are used for storing data, wherein the specific process of balancing read and write requests is as follows:
(1) the background Server acquires request quantity information of a plurality of regions under each Region Server in the Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
(2) the background server clusters the regions according to the acquired request amount information by using a preset clustering algorithm to obtain a preset number of region clustering clusters, wherein each region clustering cluster corresponds to a region category;
specifically, clustering a plurality of regions in a region set by using a preset clustering algorithm and based on the request quantity information of each region to obtain a plurality of region cluster clusters; the Region set comprises a plurality of regions corresponding to a plurality of Region servers in an Hbase system respectively;
for example, the cluster obtained by region clustering includes: clustering cluster A, clustering cluster B, clustering cluster C and clustering cluster D, wherein each region in each clustering cluster has the same or similar category; if the type of the region in the cluster A is read high write high, the type of the region in the cluster B is read high write low, the type of the region in the cluster C is read low write high, and the type of the region in the cluster D is read low write low;
(3) the background Server determines Region migration information aiming at each Region Server according to the regions contained in each Region cluster, wherein the Region migration information comprises: at least one item of identification information of the Region to be migrated, identification information of the source Region Server and identification information of the target Region Server;
(4) the background server sends the determined region migration information to an Hbase system;
(5) after receiving the Region migration information, the Hbase system migrates the Region to be migrated based on the Region migration information to balance the read-write request amount of each Region Server.
In the process, the regions are clustered by adopting a preset clustering algorithm and based on the read-write request quantity of the regions, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, and the read-write request quantity of the Region servers is timely, quickly and accurately balanced, so that the data read-write response speed of the source database HBase is improved, and the use efficiency of the source database HBase is improved.
Fig. 2 is a first flowchart of a method for balancing read and write requests according to an embodiment of the present invention, where the method in fig. 2 can be executed by the background server in fig. 1, as shown in fig. 2, the method at least includes the following steps:
s201, acquiring request quantity information of a plurality of regions under each Region Server in the Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
specifically, each region is taken as an analysis object, the read request quantity and the write request quantity of each region in the Hbase system are collected through an jmx interface, and the collected read request quantity and the collected write request quantity of each region are stored. Namely, the background server collects read-write data information of the region from a WEB page which is provided by the Hbase system and contains jmx information through an jmx interface, wherein the data format of the WEB page can be json format.
S202, clustering the regions according to the request amount information by using a preset clustering algorithm to obtain a preset number of region clustering clusters, wherein each region clustering cluster corresponds to a region category;
specifically, clustering the regions by using a preset clustering algorithm and based on the read request quantity and the write request quantity of each region, so that the regions with the same or similar types are divided into the same region clustering cluster, wherein the types of the regions are directly related to the request quantity information;
any existing clustering algorithm can be selected for clustering the regions, for example, a K-means algorithm, a DBSCAN clustering algorithm, a BIRCH clustering algorithm and the like can be selected;
in specific implementation, according to the size of the read request amount and the size of the write request amount, four cluster clusters may be divided, and each region in the Hbase system is divided into four cluster clusters, where the region categories corresponding to the four cluster clusters respectively may include: read high write high, read high write low, read low write high, read low write low.
S203, determining Region migration information aiming at each Region Server according to each Region cluster, wherein the Region migration information comprises: at least one item of identification information of the Region to be migrated, identification information of the source Region Server and identification information of the target Region Server;
specifically, the source identification information refers to identification information of a Region Server to which the Region Server belongs before migration, and the target identification information refers to identification information of a Region Server to which the Region Server belongs after migration, that is, for each Region to be migrated, which source Region Server needs to migrate the Region to be migrated to which target Region Server can be determined based on the migration information.
S204, sending the determined Region migration information to an Hbase system so that the Hbase system migrates the Region to be migrated based on the Region migration information to balance the read-write request quantity of each Region Server;
specifically, the regions to be migrated are migrated, that is, the regions to be migrated are migrated from the source Region Server to the target Region Server, so that the number of the regions of different types in each Region Server is balanced, the regions of the same type are evenly distributed to each Region Server, that is, the regions of each type are evenly distributed among a plurality of Region servers, the regions of the same type are intensively distributed to a part of the Region servers, the read-write balance among the plurality of Region servers of the Hbase system is dynamically adjusted, and the problem of large request quantity difference among the Region servers due to unbalanced distribution of hot spot data is solved, so that the data processing capability of the Region servers in the distributed cluster is optimized to the maximum, the read-write response speed of the utilization rate of the source database is improved to the maximum, and the use efficiency of the source database is improved.
In the embodiment provided by the invention, the regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, and the read-write request quantity of the Region servers is timely, quickly and accurately balanced, thereby improving the data read-write response efficiency of the source database HBase, and further enabling the source database HBase to externally provide high-speed data read-write performance.
As shown in fig. 3, in step S202, a preset clustering algorithm is used to cluster the regions according to the request amount information, so as to obtain a preset number of region cluster groups, where the clustering process for the regions preferably uses a K-means clustering algorithm to cluster the regions, and specifically includes:
s2021, clustering the regions according to the acquired request amount information by using a K-means clustering algorithm to obtain a preset number of region clustering clusters; specifically, the value of the preset number is K, and K region clustering clusters are obtained;
wherein the region cluster of the preset number includes: reading high-write high-cluster clusters, reading high-write low-cluster clusters, reading low-write high-cluster clusters, and reading low-write low-cluster clusters.
The K-Means clustering algorithm is that for a given sample set (namely a plurality of regions in an Hbase system), the sample set is divided into K clustering clusters according to the distance between samples (namely the size of a read request amount and the size of a write request amount), so that sample points in each clustering cluster are connected together as closely as possible, and the distance between the clustering clusters is as large as possible; convergence to a global minimum, rather than a local minimum, can be achieved using the K-Means clustering algorithm.
Specifically, if represented using data expressions, assuming cluster partitioning into clusters (C1, C2.. Ck), then the goal of clustering is to minimize the square error J (C, u):
Figure BDA0002325038670000071
wherein x is(i)Information indicating the request amount of the region,
Figure BDA0002325038670000072
the mean vector representing the cluster Ci, i.e., the centroid of the cluster Ci.
Specifically, the value of K is determined according to the number of the region categories to be divided, and if the region categories include: and if the read high write high, the read high write low, the read low write high and the read low write low are obtained, the value of K is 4, and then the multiple regions are clustered based on the request quantity information of each region to obtain four cluster clusters.
Specifically, for the region clustering process, selecting K regions from a plurality of regions to be used as clustering centers of K categories respectively, wherein K is the number of the categories obtained by classification;
the number of the categories can be determined according to a preset rule, the clustering centers of the K categories are continuously changed in the process of continuously performing region clustering convergence, the first determined clustering centers of the K categories can be randomly selected from a plurality of regions, the subsequent determined clustering centers of the K categories are determined according to the latest obtained clustering result, and specifically, the arithmetic mean of the respective dimensions of all elements in the clusters can be selected as the clustering centers of the K categories next time.
And then dividing the unselected multiple regions into the cluster where the selected K regions are located according to the request quantity information of the unselected multiple regions and the request quantity relation of the selected K regions to obtain K region cluster clusters.
As shown in fig. 4, the region cluster obtained by clustering includes: cluster a (corresponding region category is read high write high), cluster B (corresponding region category is read high write low), cluster C (corresponding region category is read low write high), cluster D (corresponding region category is read low write low), wherein each point in the cluster in fig. 4 corresponds to a region, and "+" represents the centroid position of the cluster.
In a specific embodiment, taking the number of Region servers in the Hbase system as N as an example, the collected request amount information of the Region is shown in table 1 below:
TABLE 1
RegionServer identification region identification Read request volume Volume of write requests
RS1 rg1-001 3422 124324
…… …… …… ……
RS2 rg2-001 1000 2000
…… …… …… ……
…… …… …… ……
RSN rgN-001 69783 253
…… …… …… ……
Wherein rg1-001 represents the region with sequence number 001 under RS1, and rg2-001 represents the region with sequence number 001 under RS 2.
Correspondingly, based on the request quantity information of the regions collected in table 1, four region cluster clusters obtained by clustering the regions are shown in table 2 below:
TABLE 2
Region cluster Region class Region contained in cluster
Cluster A Read high write high A={a1,a2,a3,a4,a5,a6…am}
Cluster B Read high write low B={b1,b2,b3,b4,b5,b6…bn}
Cluster C Read low write high C={c1,c2,c3,c4,c5,c6…cx}
Cluster D Read low write low D={d1,d2,d3,d4,d5,d6…dy}
Wherein a1 denotes a region classified into a cluster of a high-write-high category, b1 denotes a region classified into a cluster of a high-write-high category, c1 denotes a region classified into a cluster of a low-write-high category, and d1 denotes a region classified into a cluster of a low-write-low category.
Further, after obtaining a plurality of region cluster clusters through clustering, migration information needs to be generated based on the regions respectively included in the plurality of region cluster clusters, where for a case that a region is divided into cluster clusters respectively corresponding to four region categories, if the region category includes: high write read, low write read;
as shown in fig. 5, in S202, after clustering the regions according to the request amount information by using a preset clustering algorithm to obtain a preset number of region cluster clusters, the method further includes:
s205, determining the target Region number of each Region type expected to be contained under each Region Server;
specifically, before determining the Region migration information, it is necessary to determine, for each Region Server, the target Region number of each Region class that the Region Server expects to include, that is, the Region number of each class under the Region Server after the Region migration.
Correspondingly, in the step S203, determining the Region migration information for each Region Server according to each Region cluster, specifically includes:
s2031, determining the original Region number of each Region type actually contained in each Region Server according to each Region cluster; before the Region is migrated, the number of the regions of each category under the Region Server;
s2032, determining the Region migration information aiming at each Region Server according to the target Region number and the original Region number.
Specifically, for each Region Server, determining the migration number and the migration direction of each type under the Region Server according to the actual number (namely, the original Region number) before the Region migration of each type under the Region Server and the expected number (namely, the target Region number) after the migration; and generating Region migration information corresponding to the Region type according to the migration quantity and the migration direction corresponding to the Region type under each Region Server aiming at each Region type.
Specifically, for the process of determining the number of target regions corresponding to each Region type under each Region Server, the following two implementation modes may be adopted, one mode is an even distribution mode, and the other mode is an on-demand distribution mode, specifically:
A. a first implementation manner, in the step S205, determining the target Region number of each Region category that is respectively expected to be included in each Region Server specifically includes:
determining a first number of Region servers in an Hbase system; namely, determining the total number of Region servers in the Hbase system;
step two, aiming at each region cluster, determining a second number of regions in the region cluster; determining the number of regions contained in each region cluster, namely determining the total number of the regions under each region category;
and step three, determining the target region number of the region category corresponding to the region cluster according to the quotient of the second number and the first number.
Specifically, for each Region type, dividing the total number of the regions under the Region type by the total number of the Region servers to obtain the number of the target regions corresponding to the Region type, namely, averaging the total number of the regions under each Region type, so that the regions under the Region type are all distributed into a plurality of Region servers, and thus, after the regions are migrated, the number of the regions containing the same type in each Region Server is the same.
On the basis of tables 1 and 2, the second number of regions in each region cluster is respectively:
for cluster A, the second number of regions in cluster A is card (A), that is, the number m of elements in set A; wherein the set A comprises all types of regions with read-high and write-high under RS1, RS2, … … and RSN;
for cluster B, the second number of regions in cluster B is card (B), i.e. the number n of elements in set B; wherein, the set B comprises all types of regions with high read and low write under RS1, RS2, … … and RSN;
for cluster C, the second number of regions in cluster C is card (C), i.e. the number x of elements in set C; wherein, the set C comprises all types of regions with read high, low and write high under RS1, RS2, … … and RSN;
for cluster D, the second number of regions in cluster D is card (D), i.e. the number y of elements in set D; wherein, the set D comprises all the categories of RS1, RS2, … … and RSN, which are regions with low read-low write-low.
Specifically, if the first number of the Region servers is N, the target Region number corresponding to each Region type obtained in a uniform distribution manner is:
(1) aiming at the Region types with high read-high write-high, the number of target regions of the Region types expected to be contained under each Region Server is
Figure BDA0002325038670000101
(2) Aiming at the Region types with high reading and low writing, the number of target regions of the Region types expected to be contained under each Region Server is
Figure BDA0002325038670000102
(3) Aiming at reading the Region types with low writing height, the number of the target regions of the Region types expected to be contained under each Region Server is
Figure BDA0002325038670000111
(4) Aiming at the Region types with low reading and writing, the number of target regions of the Region types expected to be contained under each Region Server is as follows
Figure BDA0002325038670000112
B. In a second implementation manner, in the step S205, determining the target Region number of each Region type respectively expected to be included in each Region Server specifically includes:
step one, acquiring running state information of each Region Server; wherein the operation state information may include: at least one of read request response efficiency, write request response efficiency, request response timeout times and request error response times;
determining the number proportion of regions of each Region type expected to be contained under each Region Server according to the acquired running state information; wherein, aiming at each Region type, the sum of the ratio of the number of the regions corresponding to the Region type under each Region Server is 100%;
specifically, the operating performance of each Region Server may be scored according to the operating state information of the Region Server, and the Region quantity ratio may be determined according to a scoring result, where the scoring result may include: integrating the scoring score, the write performance score and the read performance score; specifically, a weighted average method may be adopted to determine the operation performance scoring result of each Region Server based on the operation state information of the Region Server.
The comprehensive scoring score is positively correlated with the proportion of the number of regions corresponding to the region types with high read-write height, and is negatively correlated with the proportion of the number of regions corresponding to the region types with low read-write height. That is, if the higher the comprehensive scoring score is, the better the operation performance of the Region Server is, the larger the Region number ratio of the Region category which is expected to contain high read-write is; if the lower the comprehensive scoring score is, the worse the operation performance of the Region Server is, the larger the Region number ratio of the Region category which is expected to contain low read-write is.
The writing performance score is positively correlated with the proportion of the number of the regions corresponding to the regions with low writing and high reading, and the proportion of the number of the regions corresponding to the regions with high writing and low reading is negatively correlated.
The reading performance score is positively correlated with the proportion of the number of the regions corresponding to the regions with high reading and low writing, and is negatively correlated with the proportion of the number of the regions corresponding to the regions with high reading and low writing.
Step three, determining a third number of regions in each region cluster; the third number is equal to the second number, that is, the number of the regions included in each region cluster is determined, that is, the total number of the regions under each region category is determined;
and step four, determining the target region number of the region category corresponding to the region cluster according to the product of the region number ratio and the third number.
Specifically, for each Region type, multiplying the ratio of the number of the regions corresponding to the Region type by the total number of the regions under the Region type to obtain the number of the target regions corresponding to the Region type, that is, based on the operating state of the Region Server, performing on-demand distribution on the total number of the regions under each Region type, so that the regions under the Region type are more accurately distributed to a plurality of Region servers, and thus after the Region migration, the number of the regions containing the same type in each Region Server may be different.
Specifically, after determining the expected number (i.e., the target Region number) of the regions of each category in each Region Server after the Region migration, as shown in fig. 6, for the process of determining the Region migration information based on the target Region number, the step S2032 of determining the Region migration information for each Region Server according to the target Region number and the original Region number specifically includes:
s20321, for each Region type, determining the migration number and the migration direction of the Region to be migrated under the Region type according to the original Region number and the target Region number corresponding to the Region type in each Region Server, wherein the migration direction comprises: migratory out, migratory in, or non-migratory;
if the difference value between the original region quantity and the target region quantity is greater than zero, the corresponding migration direction is migration, and if the difference value between the original region quantity and the target region quantity is less than zero, the corresponding migration direction is migration; and if the difference value between the original Region number and the target Region number is equal to zero, the Region corresponding to the Region type in the Region Server is not migrated.
S20322, determining the Region migration information corresponding to the Region type according to the migration quantity and the migration direction under the Region type in each Region Server.
Specifically, taking RS1 as an example, if the target region number is determined in a uniform distribution manner, the migration number corresponding to each region type is:
(1) for the region type of reading high writing high, the migration number of the region to be migrated corresponding to the RS1 is: | card (A)RS1) -aa |; wherein, card (A)RS1) Representing the original number of regions of read-high-write regions in RS1, i.e. the number of regions of the element contained in set A that belong to RS1 and are of the type read-high-write regions;
(2) for read high write lowThe region types, the migration number of the region to be migrated corresponding to the RS1 is: | card (B)RS1) -bb |; wherein, card (B)RS1) Representing the original number of the regions with read high and write low in the RS1, namely the number of the regions with read high and write low in the element contained in the set B and belonging to the RS1 category;
(3) for the region types of reading low and writing high, the migration number of the region to be migrated corresponding to the RS1 is: | card (C)RS1) -cc |; wherein, card (C)RS1) Representing the original number of the regions with read low and write high in the RS1, namely the number of the regions with read low and write high in the element contained in the set C belonging to the RS 1;
(4) for the region type of reading low writing low, the migration number of the region to be migrated corresponding to the RS1 is: | card (D)RS1) -dd |; wherein, card (D)RS1) Indicates the original number of regions of read low write low regions in RS1, i.e. the number of regions of the element contained in set D that belong to RS1 and are of the type read low write low.
Similarly, the migration number of the region to be migrated under each region category corresponding to RS2, RS3, … …, and RSN may be determined by the above method, and details are not described herein.
Further, in order to reduce the workload of Region migration as much as possible and improve the Region migration efficiency, based on this, in S20322, the determining, according to the migration number and the migration direction under the Region category in each Region Server, the Region migration information corresponding to the Region category specifically includes:
carrying out migration grouping on a plurality of Region servers according to the migration number and the migration direction of the Region type in each Region Server to obtain a plurality of RS migration groups, wherein each RS migration group comprises a first sub-migration group and a second sub-migration group which are opposite in migration direction and same in migration number;
specifically, for each Region type, in a plurality of Region servers, one Region Server is sequentially selected as a first currently paired sub-migration group according to the sequence from high to low of the migration number under the Region type;
judging whether a target Region Server with the same migration quantity as the currently paired first sub-migration group exists in the Region servers which are not successfully paired and have opposite migration directions;
if yes, determining the target Region Server as a second sub-migration group;
if not, determining at least two Region servers with the minimum number and the sum of the migration number being the same as the migration number of the currently paired first sub-migration group as a second sub-migration group until all Region servers are successfully paired.
Wherein, the first value of the Region Server contained in the first sub-migration group is greater than or equal to 1, and the second value of the Region Server contained in the second sub-migration group is also greater than or equal to 1;
preferably, if the first value is equal to 1, one Region Server which is opposite to the migration direction of the first sub-migration group and has the same migration number is determined as the second sub-migration group, that is, for two Region servers, if the to-be-migrated numbers corresponding to the same Region type are equal and have opposite migration directions, the two Region servers are determined as the RS migration group, so that one-to-one Region migration can be realized.
And step two, determining region migration information corresponding to the region types according to the determined plurality of RS migration groups.
Specifically, if the migration direction of the first sub-migration group is migration, and the migration direction of the second sub-migration group is migration, it is necessary to migrate the Region in the Region Server included in the first sub-migration group into the Region Server included in the second sub-migration group, that is, the Region Server included in the first sub-migration group is the source Region Server, and the Region Server included in the second sub-migration group is the target Region Server, or vice versa.
In specific implementation, the process of migrating the region to be migrated based on the determined region migration information specifically includes:
(1) in the Region to be migrated addressing process, that is, for each Region to be migrated, determining the identification information of the source Region Server and the identification information of the target Region Server corresponding to the Region to be migrated, specifically including:
in the Hbase system, reading and writing operations are all performed on Region servers, each Region Server serves a certain number of regions, a-ROOT-table and a META-table are stored, the-ROOT-table is used for recording Region information, and the META-table is used for recording original data;
specifically, -the ROOT-table is stored in the ZooKeeper, -the ROOT-table has the regionfo information of the meta-table recorded therein, and the ROOT-table is not split and corresponds to one Region, whereas the meta-table may be split into a plurality of regions, and thus, the identification information of the source Region Server and the identification information of the target Region Server corresponding to the Region to be migrated are determined based on the ROOT-table and the meta-table.
(2) The Region Server redistributes the Region process, namely the Region to be migrated is migrated from the source Region Server to the target Region Server, and the method specifically comprises the following steps:
and updating the relevant information of the Region to be migrated to a-ROOT-table of the target Region-Server on the zookeeper and a-ROOT-table of the source Region-Server on the zookeeper, and deleting the relevant information of the Region to be migrated from the META-table or marking the Region to be migrated as migrated. At the moment, the Region-Server only needs to organize the memory structure according to the updated table information and acquire the WAL file for playback.
The Region-Server and the DataNode are usually on one Server, after the loop iteration migration is completed, an HBase command 'HBase hbck-repairHoles' is executed to repair metadata of an HBase table, for example, table names, table structures and other contents can be re-registered in a Zookeeper of a new cluster, local DFSClient writing can be called during writing, a Data block can have one copy on the local machine, one copy is arranged on another machine frame, and another copy distributed randomly is arranged, so that Data Locality can be guaranteed during reading and writing.
If the Region-Server accepts a Region, most Data blocks are not in the local NameNode, the read-write performance is reduced, but the file is gradually written into the local DataNode in the subsequent Compact process, so that the Data Locality is recovered. Because the HDFS has one fewer DataNode and one fewer copy of the data block on the DataNode, the HDFS can also reestablish these copies on other datanodes to ensure reliability.
In particular implementation, for convenience of region migration, the region migration command may be encapsulated into a Shell script.
For example, the region migration command is as follows:
echo‘region’,’Region-Server’
"move
‘7f44b788a070ed8729d5f7f2df145e70‘,
‘dn3.tysci.com,60020,1456733389581‘”
|hbase shell
in the Region migration process, the identification information and the affiliated category of the plurality of regions contained in each Region Server before and after the Region migration can be checked through the hmaster management interface, so that the balance effect of the Region migration can be conveniently and quickly known.
Specifically, for the process of the Hbase system responding to the read request, an access request of a Client (Client) for zookeeper is received, the position information of the region is read from the meta table, and the data in the meta table is read. Wherein, the meta table stores the region information of the user table; according to the read namespace, table name and rowkey, searching the corresponding Region identification information and the Region Server identification information corresponding to the Region in the meta table; searching a corresponding Region in the Region Server; then, in order to improve the data reading efficiency, target data can be read from the MemStore, and if the target data is not read from the MemStore, the target data is read from the blockacache; if the target data is not read from the BlockCache, reading the target data from the StoreFile; and if the target data is read from the storeFile, writing the target data into the BlockCache, and returning the target data to the corresponding client.
Correspondingly, aiming at the process that the Hbase system responds to the write request, receiving the write request sent to a Region Server by a Client; after receiving the write request, the Region Server writes the target data to be written into HLog (write ahead log). The Region Server also writes the target data into a memory (MemStore) for the persistence and recovery of the data, and feeds back the success of data writing to the client.
The read-write request balancing method in the embodiment of the invention utilizes a preset clustering algorithm to cluster the regions according to the request quantity information of each region to obtain a preset number of region cluster clusters; determining Region migration information aiming at each Region Server according to the regions contained in each Region cluster; the migration information is sent to the Hbase system. The regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, the read-write request quantity of the Region servers is timely, quickly and accurately balanced, and the data read-write response efficiency of the source database HBase is improved.
Based on the same technical concept, an embodiment of the present invention further provides a read/write request balancing apparatus according to the same technical concept, where fig. 7 is a schematic diagram of modules of the read/write request balancing apparatus according to the embodiment of the present invention, where the read/write request balancing apparatus is configured to execute the read/write request balancing methods described in fig. 1 to 6, and as shown in fig. 7, the read/write request balancing apparatus includes:
a request amount obtaining module 701, configured to obtain request amount information of multiple regions under each Region Server in the Hbase system, where the request amount information includes: read request amount information and write request amount information;
a Region clustering module 702, configured to perform clustering processing on the regions according to the request amount information by using a preset clustering algorithm to obtain a preset number of Region clustering clusters, where each Region clustering cluster corresponds to a Region category;
a migration information determining module 703, configured to determine, according to each Region cluster, Region migration information for each Region Server;
and the read-write request balancing module 704 is configured to send the Region migration information to the Hbase system, so that the Hbase system migrates the regions to be migrated based on the Region migration information, so as to balance the read-write request amount of each Region Server.
In the embodiment of the invention, the regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, and the read-write request quantity of the Region servers is timely, quickly and accurately balanced, thereby improving the data read-write response efficiency of the source database HBase, and further enabling the source database HBase to externally provide high-speed data read-write performance.
Optionally, the Region clustering module 702 is specifically configured to:
clustering the regions by using a K-means clustering algorithm according to the request quantity information to obtain a preset number of region clustering clusters;
wherein the preset number of region cluster clusters comprises: reading high-write high-cluster clusters, reading high-write low-cluster clusters, reading low-write high-cluster clusters, and reading low-write low-cluster clusters.
Optionally, the region categories include: high write read, low write read; the above-mentioned device still includes: a target number determination module to:
determining the target Region number of each Region type expected to be contained under each Region Server;
correspondingly, the migration information determining module 703 is specifically configured to:
determining the original Region number of each Region type actually contained under each Region Server according to each Region cluster;
and determining Region migration information aiming at each Region Server according to the target Region number and the original Region number.
Optionally, the target number determining module is specifically configured to:
determining a first number of Region servers in an Hbase system; and the number of the first and second groups,
determining a second number of regions in each region cluster for each region cluster;
and determining the target region number of the region category corresponding to the region clustering cluster according to the quotient of the second number and the first number.
Optionally, the target number determination module is further configured to:
acquiring the running state information of each Region Server;
determining the number proportion of regions of each Region type expected to be contained under each Region Server according to the running state information; and the number of the first and second groups,
determining a third number of regions in each region cluster for each region cluster;
and determining the target region number of the region category corresponding to the region clustering cluster according to the product of the region number ratio and the third number.
Optionally, the migration information determining module 703 is further specifically configured to:
for each Region type, determining the migration number and the migration direction of the Region to be migrated under the Region type according to the original Region number and the target Region number corresponding to each Region Server, wherein the migration direction comprises: emigration, or emigration;
and determining Region migration information corresponding to the Region types according to the migration number and the migration direction of the Region types in each Region Server.
Optionally, the migration information determining module 703 is further specifically configured to:
performing migration grouping on the plurality of Region servers according to the migration number and the migration direction of the Region types in each Region Server to obtain a plurality of RS migration groups, wherein each RS migration group comprises a first sub-migration group and a second sub-migration group which have opposite migration directions and the same migration number;
and determining region migration information corresponding to the region types according to the plurality of RS migration groups.
The read-write request balancing device in the embodiment of the invention utilizes a preset clustering algorithm to cluster the regions according to the request quantity information of each region to obtain a preset number of region cluster clusters; determining Region migration information aiming at each Region Server according to the regions contained in each Region cluster; the migration information is sent to the Hbase system. The regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, the read-write request quantity of the Region servers is timely, quickly and accurately balanced, and the data read-write response efficiency of the source database HBase is improved.
The read-write request balancing device provided by the embodiment of the invention can realize each process in the embodiment corresponding to the read-write request balancing method, and is not described again to avoid repetition.
It should be noted that the read-write request balancing device provided in the embodiment of the present invention and the read-write request balancing method provided in the embodiment of the present invention are based on the same inventive concept, and therefore specific implementation of the embodiment may refer to implementation of the read-write request balancing method, and repeated details are not described again.
Based on the same technical concept, an embodiment of the present invention further provides a computer device for executing the method for balancing read/write requests, and fig. 8 is a schematic structural diagram of a computer device implementing various embodiments of the present invention, as shown in fig. 8. Computer devices may vary widely in configuration or performance and may include one or more processors 801 and memory 802, where one or more stored applications or data may be stored in memory 802. Wherein the memory 802 may be a transient storage or a persistent storage. The application program stored in memory 802 may include one or more modules (not shown), each of which may include a series of computer-executable instructions for a computing device. Still further, the processor 801 may be configured to communicate with the memory 802 to execute a series of computer-executable instructions in the memory 802 on a computer device. The computer apparatus may also include one or more power supplies 803, one or more wired or wireless network interfaces 804, one or more input-output interfaces 805, one or more keyboards 806.
In this embodiment, the computer device includes a processor, a communication interface, a memory, and a communication bus; the processor, the communication interface and the memory complete mutual communication through a bus; a memory for storing a computer program; a processor for executing the program stored in the memory, implementing the following method steps:
acquiring request quantity information of a plurality of regions under each Region Server in an Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
clustering the regions by using a preset clustering algorithm according to the request amount information to obtain a preset number of region clustering clusters, wherein each region clustering cluster corresponds to a region category;
determining Region migration information aiming at each Region Server according to each Region cluster;
and sending the Region migration information to the Hbase system so that the Hbase system migrates the regions to be migrated based on the Region migration information to balance the read-write request amount of each Region Server.
The computer equipment in the embodiment of the invention utilizes a preset clustering algorithm to cluster the regions according to the request quantity information of each region to obtain a preset number of region clustering clusters; determining Region migration information aiming at each Region Server according to the regions contained in each Region cluster; the migration information is sent to the Hbase system. The regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, the read-write request quantity of the Region servers is timely, quickly and accurately balanced, and the data read-write response efficiency of the source database HBase is improved.
The computer device provided by the embodiment of the present invention can implement each process in the embodiment corresponding to the above read-write request balancing method, and is not described herein again to avoid repetition.
It should be noted that the computer device provided in the embodiment of the present invention and the method for balancing read/write requests provided in the embodiment of the present invention are based on the same inventive concept, and therefore specific implementation of the embodiment may refer to implementation of the method for balancing read/write requests, and repeated details are not described herein.
Based on the same technical concept, the embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the following method steps are implemented:
acquiring request quantity information of a plurality of regions under each Region Server in an Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
clustering the regions by using a preset clustering algorithm according to the request amount information to obtain a preset number of region clustering clusters, wherein each region clustering cluster corresponds to a region category;
determining Region migration information aiming at each Region Server according to each Region cluster;
and sending the Region migration information to the Hbase system so that the Hbase system migrates the regions to be migrated based on the Region migration information to balance the read-write request amount of each Region Server.
The computer-readable storage medium in the embodiment of the invention utilizes a preset clustering algorithm to cluster the regions according to the request quantity information of each region to obtain a preset number of region clustering clusters; determining Region migration information aiming at each Region Server according to the regions contained in each Region cluster; the migration information is sent to the Hbase system. The regions are clustered by adopting a preset clustering algorithm, and the Region migration information is determined according to the clustering result, so that the regions in each Region clustering cluster are dynamically and uniformly distributed to each Region Server based on the migration information, the read-write request quantity of the Region servers is timely, quickly and accurately balanced, and the data read-write response efficiency of the source database HBase is improved.
The computer-readable storage medium provided in the embodiment of the present invention can implement each process in the embodiment corresponding to the above read-write request balancing method, and is not described here again to avoid repetition.
It should be noted that the computer-readable storage medium provided in the embodiment of the present invention and the method for balancing read/write requests provided in the embodiment of the present invention are based on the same inventive concept, and therefore specific implementation of the embodiment may refer to implementation of the method for balancing read/write requests, and repeated details are not repeated.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for balancing read and write requests is characterized by comprising the following steps:
acquiring request quantity information of a plurality of regions under each Region Server in an Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
clustering the regions by using a preset clustering algorithm according to the request amount information to obtain a preset number of region clustering clusters, wherein each region clustering cluster corresponds to a region category;
determining Region migration information aiming at each Region Server according to each Region cluster;
and sending the Region migration information to the Hbase system so that the Hbase system migrates the regions to be migrated based on the Region migration information to balance the read-write request amount of each Region Server.
2. The method according to claim 1, wherein the clustering the regions according to the request amount information by using a preset clustering algorithm to obtain a preset number of region cluster clusters comprises:
clustering the regions by using a K-means clustering algorithm according to the request quantity information to obtain a preset number of region clustering clusters;
wherein the preset number of region cluster clusters comprises: reading high-write high-cluster clusters, reading high-write low-cluster clusters, reading low-write high-cluster clusters, and reading low-write low-cluster clusters.
3. The method of claim 1, wherein the region categories comprise: high write read, low write read;
after clustering the regions according to the request amount information by using a preset clustering algorithm to obtain a preset number of region clustering clusters, the method further comprises the following steps:
determining the target Region number of each Region type expected to be contained under each Region Server;
the determining, according to each Region cluster, Region migration information for each Region Server includes:
determining the original Region number of each Region type actually contained under each Region Server according to each Region cluster;
and determining Region migration information aiming at each Region Server according to the target Region number and the original Region number.
4. The method of claim 3, wherein said determining a target number of regions of each of said Region classes expected to be included under each of said Region servers comprises:
determining a first number of Region servers in an Hbase system; and the number of the first and second groups,
determining a second number of regions in each region cluster for each region cluster;
and determining the target region number of the region category corresponding to the region clustering cluster according to the quotient of the second number and the first number.
5. The method of claim 3, wherein said determining a target number of regions of each of said Region classes expected to be included under each of said Region servers comprises:
acquiring the running state information of each Region Server;
determining the number proportion of regions of each Region type expected to be contained under each Region Server according to the running state information; and the number of the first and second groups,
determining a third number of regions in each region cluster for each region cluster;
and determining the target region number of the region category corresponding to the region clustering cluster according to the product of the region number ratio and the third number.
6. The method according to claim 3, wherein the determining Region migration information for each Region Server according to the target Region number and the original Region number comprises:
for each Region type, determining the migration number and the migration direction of the Region to be migrated under the Region type according to the original Region number and the target Region number corresponding to each Region Server, wherein the migration direction comprises: emigration, or emigration;
and determining Region migration information corresponding to the Region types according to the migration number and the migration direction of the Region types in each Region Server.
7. The method according to claim 6, wherein the determining, according to the migration number and the migration direction of the Region category in each Region Server, Region migration information corresponding to the Region category comprises:
performing migration grouping on the plurality of Region servers according to the migration number and the migration direction of the Region types in each Region Server to obtain a plurality of RS migration groups, wherein each RS migration group comprises a first sub-migration group and a second sub-migration group which have opposite migration directions and the same migration number;
and determining region migration information corresponding to the region types according to the plurality of RS migration groups.
8. An apparatus for equalizing read and write requests, comprising:
the request quantity obtaining module is used for obtaining request quantity information of a plurality of regions under each Region Server in the Hbase system, wherein the request quantity information comprises: read request amount information and write request amount information;
the Region clustering module is used for clustering the regions according to the request amount information by using a preset clustering algorithm to obtain a preset number of Region clustering clusters, wherein each Region clustering cluster corresponds to a Region category;
the migration information determining module is used for determining the Region migration information aiming at each Region Server according to each Region cluster;
and the read-write request balancing module is used for sending the Region migration information to the Hbase system so that the Hbase system migrates the Region to be migrated based on the Region migration information to balance the read-write request quantity of each Region Server.
9. A computer device comprising a processor, a communication interface, a memory, and a communication bus; the processor, the communication interface and the memory complete mutual communication through a bus; the memory is used for storing a computer program; the processor is used for executing the program stored on the memory to realize the read-write request balancing method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements a method for equalizing read and write requests according to any one of claims 1 to 7.
CN201911313014.8A 2019-12-18 2019-12-18 Read-write request balancing method and device Active CN112988703B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911313014.8A CN112988703B (en) 2019-12-18 2019-12-18 Read-write request balancing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911313014.8A CN112988703B (en) 2019-12-18 2019-12-18 Read-write request balancing method and device

Publications (2)

Publication Number Publication Date
CN112988703A true CN112988703A (en) 2021-06-18
CN112988703B CN112988703B (en) 2022-09-16

Family

ID=76344083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911313014.8A Active CN112988703B (en) 2019-12-18 2019-12-18 Read-write request balancing method and device

Country Status (1)

Country Link
CN (1) CN112988703B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104216989A (en) * 2014-09-09 2014-12-17 广东电网公司中山供电局 Method for storing transmission line integrated data based on HBase
CN104243621A (en) * 2014-10-17 2014-12-24 浪潮电子信息产业股份有限公司 Improved HBASE load balancing strategy
US20150121371A1 (en) * 2013-10-25 2015-04-30 Vmware, Inc. Multi-tenant distributed computing and database
CN104951561A (en) * 2015-07-08 2015-09-30 携程计算机技术(上海)有限公司 HBase hotspot eliminating method and system
CN106570126A (en) * 2016-11-02 2017-04-19 北京集奥聚合科技有限公司 Method and system for collecting HBase hotspot data block information
CN107301466A (en) * 2016-04-15 2017-10-27 中国移动通信集团四川有限公司 To business load and resource distribution and the Forecasting Methodology and forecasting system of property relationship
CN107741961A (en) * 2017-09-25 2018-02-27 阿里巴巴集团控股有限公司 Full table scan method and device based on Hbase
CN110347654A (en) * 2018-03-23 2019-10-18 北京京东尚科信息技术有限公司 A kind of method and apparatus of online cluster features
CN110515726A (en) * 2019-08-14 2019-11-29 苏州浪潮智能科技有限公司 A kind of database loads equalization methods and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150121371A1 (en) * 2013-10-25 2015-04-30 Vmware, Inc. Multi-tenant distributed computing and database
CN104216989A (en) * 2014-09-09 2014-12-17 广东电网公司中山供电局 Method for storing transmission line integrated data based on HBase
CN104243621A (en) * 2014-10-17 2014-12-24 浪潮电子信息产业股份有限公司 Improved HBASE load balancing strategy
CN104951561A (en) * 2015-07-08 2015-09-30 携程计算机技术(上海)有限公司 HBase hotspot eliminating method and system
CN107301466A (en) * 2016-04-15 2017-10-27 中国移动通信集团四川有限公司 To business load and resource distribution and the Forecasting Methodology and forecasting system of property relationship
CN106570126A (en) * 2016-11-02 2017-04-19 北京集奥聚合科技有限公司 Method and system for collecting HBase hotspot data block information
CN107741961A (en) * 2017-09-25 2018-02-27 阿里巴巴集团控股有限公司 Full table scan method and device based on Hbase
CN110347654A (en) * 2018-03-23 2019-10-18 北京京东尚科信息技术有限公司 A kind of method and apparatus of online cluster features
CN110515726A (en) * 2019-08-14 2019-11-29 苏州浪潮智能科技有限公司 A kind of database loads equalization methods and device

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
AINHOA AZQUETA-ALZÚAZ ET AL.: "Massive Data Load on Distributed Database Systems over HBase", 《2017 17TH IEEE/ACM INTERNATIONAL SYMPOSIUM ON CLUSTER, CLOUD AND GRID COMPUTING (CCGRID)》 *
何涛: "面向海量空间数据并行高效处理的存储模式设计与研究", 《中国优秀硕士学位论文全文数据库 基础科学辑》 *
祝烨: "分布式数据库系统热点负载均衡研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *
邵芳 等: "基于HBase的大数据平台负载均衡算法分析与优化", 《软件导刊》 *

Also Published As

Publication number Publication date
CN112988703B (en) 2022-09-16

Similar Documents

Publication Publication Date Title
US9740706B2 (en) Management of intermediate data spills during the shuffle phase of a map-reduce job
US10726356B1 (en) Target variable distribution-based acceptance of machine learning test data sets
US8677366B2 (en) Systems and methods for processing hierarchical data in a map-reduce framework
US20210294778A1 (en) Small-file storage optimization system based on virtual file system in kubernetes user-mode application
US20160350302A1 (en) Dynamically splitting a range of a node in a distributed hash table
US10616338B1 (en) Partitioning data according to relative differences indicated by a cover tree
TW201530328A (en) Method and device for constructing NoSQL database index for semi-structured data
US10909086B2 (en) File lookup in a distributed file system
CN112860777B (en) Data processing method, device and equipment
JP2018515844A (en) Data processing method and system
US10102267B2 (en) Method and apparatus for access control
CN112100185A (en) Indexing system and method for block chain data balance load
US11157456B2 (en) Replication of data in a distributed file system using an arbiter
Chang et al. Integration and optimization of multiple big data processing platforms
US11625192B2 (en) Peer storage compute sharing using memory buffer
CN111274004B (en) Process instance management method and device and computer storage medium
CN112988703B (en) Read-write request balancing method and device
US10146791B2 (en) Open file rebalance
US20210149746A1 (en) Method, System, Computer Readable Medium, and Device for Scheduling Computational Operation Based on Graph Data
US10509578B2 (en) Logical address space for storage resource pools
EP3264254A1 (en) System and method for a simulation of a block storage system on an object storage system
Khosla et al. Big data technologies
CN112148461A (en) Application scheduling method and device
CN111782834A (en) Image retrieval method, device, equipment and computer readable storage medium
KR101772955B1 (en) Record processing method using index data structure in distributed processing system based on mapreduce

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant