Request response method and device, equipment, medium and product

By constructing a cumulative weight range based on the read node status and performance evaluation weights in the distributed database, the read node is precisely selected to perform data reading operations, solving the inefficiency problem caused by random selection of read nodes and improving data reading performance and resource utilization efficiency.

CN120873082APending Publication Date: 2025-10-31XIAN TONGXING HENGYAO INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511022770.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-23
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

In distributed databases, randomly selecting read nodes for data reading operations without considering the actual state of the nodes leads to low data reading efficiency, affecting overall performance and resource utilization efficiency.

Method used

The target node set is determined based on the node status and priority of the read nodes in the server cluster. Weights are evaluated based on hardware configuration and performance data, a cumulative weight interval is constructed, and read nodes are selected to perform data reading operations by matching random values ​​with the interval.

Benefits of technology

It improved the targeting of data reading and the efficiency of server cluster resource utilization, optimized data reading performance, reduced network latency, and improved response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120873082A_ABST
    Figure CN120873082A_ABST
Patent Text Reader

Abstract

The invention provides a request response method and device, equipment, a medium and a product, can be applied to the technical field of big data and the technical field of computers, and comprises the following steps: in response to a received data reading request, determining a target node set according to node states of a plurality of reading nodes in a server cluster and priorities of the reading nodes, the priority is determined according to a matching relationship between a request address of the data reading request and an operation address of each sub-cluster in the server cluster; according to the weight of each read node in the target node set, multiple accumulative weight intervals are determined, and the weights are obtained based on hardware configuration and performance data evaluation of the read nodes; matching a random value generated in the cumulative weight interval with each cumulative weight interval to determine a target weight interval corresponding to the random value; and executing a data reading operation by using a reading node corresponding to the target weight interval in the target node set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the fields of big data technology and computer technology, and more specifically, to a request-response method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] In distributed databases, read-write separation is a common performance optimization technique. By distributing data read operations and data write operations to different nodes, the concurrent processing capability and response speed of distributed databases can be effectively improved.

[0003] However, when processing data read requests, a read node is usually randomly selected to perform the data read operation without considering the actual state of the read node, resulting in low efficiency of the data read operation and affecting the overall data processing performance of the distributed database. Summary of the Invention

[0004] In view of the above, this disclosure provides a request-response method, apparatus, electronic device, storage medium, and program product.

[0005] One aspect of this disclosure provides a request-response method, comprising: responding to a received data read request; determining a target node set based on the node status of multiple read nodes in a server cluster and the priority of each read node, wherein the priority is determined based on the matching relationship between the request address of the data read request and the running addresses of each sub-cluster in the server cluster; determining multiple cumulative weight intervals based on the weights of each read node in the target node set, wherein the weights are obtained based on the hardware configuration and performance data of the read nodes, and each of the cumulative weight intervals corresponds one-to-one with a read node in the target node set; matching a random value generated within the cumulative weight intervals with each of the cumulative weight intervals to determine a target weight interval corresponding to the random value; and performing a data read operation using the read node in the target node set that corresponds to the target weight interval.

[0006] According to embodiments of this disclosure, determining the target node set based on the node status of multiple read nodes in the server cluster and the priority of each read node includes: determining the node status of each read node in the server cluster; extracting multiple candidate nodes whose node status is online from the server cluster; matching the request address with the running address of the sub-cluster to which each candidate node belongs to obtain the priority of each candidate node; and determining the target node set based on the priority of each candidate node.

[0007] According to an embodiment of this disclosure, determining the target node set based on the priority of each of the candidate nodes includes: if it is determined that there are candidate nodes with a priority of the first level, determining the target node set based on the candidate nodes with the priority of the first level, wherein the first level indicates that the request address is consistent with the running address; if it is determined that the priority of each of the candidate nodes is the second level, determining the target node set based on the candidate nodes, wherein the second level indicates that the request address is different from the running address.

[0008] According to an embodiment of this disclosure, determining multiple cumulative weight intervals based on the weights of each read node in the target node set includes: summing the weights of each read node one by one to obtain multiple interval boundary values; generating multiple consecutive cumulative weight intervals based on the initial value and the multiple interval boundary values, wherein the upper limit value of each cumulative weight interval is the sum of the weights of the corresponding read node, and each cumulative weight interval forms a one-to-one correspondence with the read nodes in the target node set.

[0009] According to an embodiment of this disclosure, the request-response method further includes: determining a maximum boundary value from a plurality of the aforementioned interval boundary values; and generating the aforementioned random value within the interval formed by the aforementioned initial value and the aforementioned maximum boundary value.

[0010] According to an embodiment of this disclosure, the above-mentioned random value generated within the above-mentioned cumulative weight interval is matched with each of the above-mentioned cumulative weight intervals to determine the target weight interval corresponding to the random value, including: using a bisection method to determine the interval boundary value located in the middle position among the multiple above-mentioned cumulative weight intervals to obtain an intermediate value; comparing the above-mentioned random value with the above-mentioned intermediate value to determine the remaining interval in which the random value is located, the remaining interval including at least one of the above-mentioned cumulative weight intervals; repeating the above operation to gradually narrow the range of the remaining intervals until the target weight interval to which the random value belongs is determined.

[0011] According to embodiments of this disclosure, the request-response method further includes: continuously monitoring the hardware configuration and performance data of each of the aforementioned read nodes during the data reading operation; and dynamically updating the weight of each of the aforementioned read nodes when it is determined that the hardware configuration and performance data of the aforementioned read node have changed and a predetermined condition has been met.

[0012] Another aspect of this disclosure provides a request-response apparatus, comprising: a node determination module, configured to, in response to a received data read request, determine a target node set based on the node status of multiple read nodes in a server cluster and the priority of each read node, wherein the priority is determined based on a matching relationship between the request address of the data read request and the running addresses of each sub-cluster in the server cluster; an interval determination module, configured to determine multiple cumulative weight intervals based on the weights of each read node in the target node set, wherein the weights are obtained based on the hardware configuration and performance data of the read nodes, and each of the cumulative weight intervals corresponds one-to-one with a read node in the target node set; an interval matching module, configured to match a random value generated within the cumulative weight intervals with each of the cumulative weight intervals to determine a target weight interval corresponding to the random value; and a data read module, configured to perform a data read operation using the read nodes in the target node set that correspond to the target weight intervals.

[0013] Another aspect of this disclosure provides an electronic device comprising: one or more processors; and a memory for storing one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to perform the methods described above.

[0014] Another aspect of this disclosure provides a computer-readable storage medium storing computer-executable instructions, which, when executed, are used to implement the methods described above.

[0015] Another aspect of this disclosure provides a computer program product including computer-executable instructions that, when executed, implement the methods described above.

[0016] According to embodiments of this disclosure, by combining the node status and priority of read nodes to determine the target node set, available read nodes in the same data center as the application nodes can be selected, thereby improving the efficiency of data read operations. Furthermore, by evaluating weights based on read node hardware configuration and performance data and constructing a cumulative weight range, and then selecting read nodes by matching random values ​​with the range, suitable read nodes can be accurately and efficiently selected to perform data read operations based on data read requests and the actual server status, improving the targeting of data reads and the efficiency of server cluster resource utilization, and optimizing data read performance. Attached Figure Description

[0017] The above and other objects, features, and advantages of this disclosure will become clearer from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:

[0018] Figure 1This illustration schematically depicts an exemplary system architecture to which request-response methods can be applied according to embodiments of this disclosure;

[0019] Figure 2 A flowchart illustrating a request-response method according to an embodiment of the present disclosure is shown schematically.

[0020] Figure 3A The diagram illustrates the architecture of a server cluster according to a specific embodiment of the present disclosure.

[0021] Figure 3B The illustration shows a schematic diagram of a request-response method according to a specific embodiment of the present disclosure;

[0022] Figure 3C A schematic diagram illustrating a request-response method according to another specific embodiment of the present disclosure is shown.

[0023] Figure 4 The diagram illustrates the generation of a cumulative weight interval according to a specific embodiment of the present disclosure;

[0024] Figure 5 This illustration schematically shows a diagram of determining a target cumulative weight interval according to a specific embodiment of the present disclosure;

[0025] Figure 6 The illustration shows a schematic diagram of a page with a newly added node according to a specific embodiment of the present disclosure;

[0026] Figure 7 A block diagram of a request response apparatus according to an embodiment of the present disclosure is schematically shown; and

[0027] Figure 8 A block diagram of an electronic device suitable for implementing a request-response method according to an embodiment of the present disclosure is shown schematically. Detailed Implementation

[0028] The embodiments of the present disclosure will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the disclosure. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of the present disclosure for ease of explanation. However, it will be apparent that one or more embodiments may be practiced without these specific details. Furthermore, descriptions of well-known structures and techniques are omitted in the following description to avoid unnecessarily obscuring the concepts of the present disclosure.

[0029] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0030] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0031] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).

[0032] It should be noted that in the embodiments of this disclosure, the collection, updating, analysis, processing, use, transmission, and storage of data (e.g., including but not limited to user personal information) comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken to prevent unauthorized access to user personal information data and to safeguard user personal information security, network security, and national security.

[0033] In the embodiments disclosed herein, user authorization or consent is obtained before acquiring or collecting user personal information.

[0034] In distributed database systems, read-write separation is a common performance optimization technique. By distributing read and write operations to different nodes, the system's concurrent processing capability and response speed can be effectively improved.

[0035] In related technologies, database node information is stored on centralized storage. When the system starts, the database node metadata is loaded into memory. When processing user data read requests, the system randomly selects a read node for processing. However, this random selection method cannot dynamically allocate read requests based on the actual performance differences of read nodes. This leads to underutilization of high-performance node resources, while low-performance nodes may become system bottlenecks, affecting overall performance. Furthermore, if application nodes and read nodes are located in different data centers, cross-data center access may also impact overall performance. These issues not only limit the performance improvement of distributed databases but also increase operational complexity.

[0036] This disclosure provides a request-response method, comprising: responding to a received data read request; determining a target node set based on the node status and priority of multiple read nodes in a server cluster, wherein the priority is determined based on the matching relationship between the request address of the data read request and the running addresses of each sub-cluster in the server cluster; determining multiple cumulative weight intervals based on the weights of each read node in the target node set, wherein the weights are obtained based on the hardware configuration and performance data evaluation of the read nodes, and each cumulative weight interval corresponds one-to-one with a read node in the target node set; matching a random value generated within the cumulative weight interval with each cumulative weight interval to determine a target weight interval corresponding to the random value; and performing a data read operation using the read node in the target node set corresponding to the target weight interval. This disclosure, by combining the node status and priority of read nodes to determine the target node set, evaluating weights based on the hardware configuration and performance data of read nodes to construct cumulative weight intervals, and then selecting read nodes by matching random values ​​with intervals, can accurately and efficiently select suitable read nodes to perform data read operations based on the data read request and the actual state of the server, improving the targeting of data reads and the efficiency of server cluster resource utilization, and optimizing data read performance.

[0037] Figure 1 This illustration schematically depicts an exemplary system architecture to which a request-response method can be applied according to embodiments of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of system architectures that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used in other devices, systems, environments or scenarios.

[0038] like Figure 1 As shown, the exemplary system architecture 100 according to this embodiment may include a first terminal device 110, a second terminal device 120, a third terminal device 130, a network 140, and a server cluster 150. The network 140 serves as a medium for providing communication links between the first terminal device 110, the second terminal device 120, the third terminal device 130, and the server cluster 150. The network 140 may include various connection types, such as wired or wireless communication links, or fiber optic cables, etc. The server cluster 150 may include multiple application nodes 151 and multiple data nodes 152. The multiple application nodes 151 include application node 151_1 and application node 151_2, and the multiple data nodes 152 include write node 152_1, read node 152_2, and read node 152_3. Application nodes 151_1 and 151_2 can perform write operations on data in write node 152_1 and read operations on data in read nodes 152_2 and 152_3.

[0039] Users can use the first terminal device 110, the second terminal device 120, and the third terminal device 130 to interact with the server cluster 150 via the network 140 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 110, the second terminal device 120, and the third terminal device 130, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social media platform software, etc. (for example only).

[0040] The first terminal device 110, the second terminal device 120, and the third terminal device 130 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0041] Server cluster 150 may be a server cluster that provides various services, such as a backend management server that supports websites browsed by users using first terminal device 110, second terminal device 120, and third terminal device 130 (for example only). For example, application node 151 in server cluster 150 may handle user requests such as data read requests, data node 152 may be used to store the data required to provide the service, and application node 151 may select a data node from multiple data nodes 152 to handle user requests.

[0042] It should be noted that the request-response method provided in this embodiment can generally be executed by server cluster 150. Correspondingly, the request-response device provided in this embodiment can generally be located within server cluster 150. The request-response method provided in this embodiment can also be executed by a server or server cluster that is different from server cluster 150 and capable of communicating with the first terminal device 110, the second terminal device 120, the third terminal device 130, and / or server cluster 150. Correspondingly, the request-response device provided in this embodiment can also be located within a server or server cluster that is different from server cluster 150 and capable of communicating with the first terminal device 110, the second terminal device 120, the third terminal device 130, and / or server cluster 150.

[0043] For example, a user can use a first terminal device 110, a second terminal device 120, and a third terminal device 130 to send a data read request to a server cluster 150 via a network 140. In response to the received data read request, the server cluster 150 determines a target node set based on the node status and priority of multiple read nodes in the server cluster. The priority is determined by the matching relationship between the request address of the data read request and the running addresses of each sub-cluster in the server cluster. Based on the weight of each read node in the target node set, multiple cumulative weight intervals are determined. The weights are obtained based on the hardware configuration and performance data evaluation of the read nodes, and each cumulative weight interval corresponds one-to-one with a read node in the target node set. Random values ​​generated within the cumulative weight intervals are matched with each cumulative weight interval to determine the target weight interval corresponding to the random value. Finally, the data read operation is performed using the read nodes in the target node set that correspond to the target weight interval.

[0044] It should be understood that Figure 1 The number of terminal devices, networks, server clusters, application nodes, read nodes, and write nodes shown in the diagram is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, server clusters, application nodes, read nodes, and write nodes can be included.

[0045] Figure 2 A flowchart illustrating a request-response method according to an embodiment of the present disclosure is shown schematically.

[0046] like Figure 2 As shown, the method includes operations S210~S240.

[0047] In operation S210, in response to the received data read request, the target node set is determined based on the node status of multiple read nodes in the server cluster and the priority of each read node.

[0048] In operation S220, multiple cumulative weight intervals are determined based on the weights of each read node in the target node set.

[0049] In operation S230, the random value generated within the cumulative weight interval is matched with each cumulative weight interval to determine the target weight interval corresponding to the random value.

[0050] In operation S240, the data reading operation is performed using the read node in the target node set that corresponds to the target weight interval.

[0051] In distributed database systems, read and write operations are typically separated by distributing them across different nodes in a server cluster. Specifically, a server cluster can include application nodes, read nodes, and write nodes. When a user sends a data operation request to the server cluster via a terminal, the application nodes in the cluster can respond to the request and determine the node to perform the data operation based on the type of request. For example, read nodes might be used to perform data reading operations, while write nodes might be used to perform data writing operations.

[0052] In the embodiments of this disclosure, when a user sends a data read request to the server cluster via a terminal, the server cluster responds to the data read request by selecting an application node from multiple application nodes through load balancing or other methods. This application node, in response to the data read request, selects a read node from multiple read nodes to perform the data read operation and sends the data read request to that read node to execute the data read operation. After executing the data read operation, the read node can return the read result to the application node, which then returns the data read result to the user's terminal.

[0053] Since multiple nodes in a server cluster are located in multiple data centers, and the nodes in each data center correspond to a sub-cluster, different sub-clusters have different operating addresses. When application nodes access read nodes across data centers, the response speed decreases due to the increased transmission distance. Therefore, priority can be determined based on the matching relationship between the request address of the data read request and the operating address of each read node, so that the read node whose operating address matches the request address is selected first to perform the data read operation.

[0054] Specifically, when filtering read nodes, the target node set can be filtered out first based on the node status and priority of the read nodes to filter out the read nodes that are in the same data center as the application nodes and are available. Then, the read nodes can be further filtered using the weights obtained from the evaluation of the hardware configuration and performance data of the read nodes to filter out the read nodes with better hardware configuration and performance data, thereby improving the data reading efficiency.

[0055] In some embodiments, hardware configuration may include the processor, memory, and hard drive models of the read node. Performance data may include the response time and throughput of the read node when performing data read operations. Specifically, better hardware configuration and performance data can be given higher weight.

[0056] After accumulating the weights of the read nodes, multiple cumulative weight intervals can be obtained, each corresponding one-to-one with a read node in the target node set. In some embodiments, the weights of multiple read nodes in the target node set can be sequentially added together to obtain multiple cumulative weight intervals, and the size of the cumulative weight interval can be the size of the weights. For example, the first read node corresponds to the first cumulative weight interval, the second read node corresponds to the second cumulative weight interval, and the third read node corresponds to the third cumulative weight interval.

[0057] When determining a target weight interval from multiple cumulative weight intervals, a random value can be generated first, and the cumulative weight interval containing the random value can be identified as the target weight interval. To avoid the generated random value falling outside the multiple cumulative weight intervals, which would prevent the determination of the target weight interval corresponding to the random value, the generation range of the random value can be determined based on the multiple cumulative weight intervals, ensuring that the generated random value falls within any of the multiple cumulative weight intervals. In some embodiments, the random value can be sequentially matched with each cumulative weight interval to determine the target weight interval.

[0058] Since the larger the weight of a read node, the larger the corresponding cumulative weight range, the greater the probability that the generated random value falls within that cumulative weight range. Therefore, matching the random value with each cumulative weight range can increase the probability of selecting a read node with better hardware configuration and performance data.

[0059] For example, if the first cumulative weight range is 0-50, the second cumulative weight range is 50-150, and the third cumulative weight range is 150-200, the probability of selecting the second read node is relatively high. With a random value of 52, the target weight range corresponding to the random value can be determined as the second cumulative weight range.

[0060] According to embodiments of this disclosure, by combining the node status and priority of read nodes to determine the target node set, available read nodes in the same data center as the application nodes can be selected, thereby improving the efficiency of data read operations. Furthermore, by evaluating weights based on read node hardware configuration and performance data and constructing a cumulative weight range, and then selecting read nodes by matching random values ​​with the range, suitable read nodes can be accurately and efficiently selected to perform data read operations based on data read requests and the actual server status, improving the targeting of data reads and the efficiency of server cluster resource utilization, and optimizing data read performance.

[0061] According to embodiments of this disclosure, determining a target node set based on the node status of multiple read nodes in a server cluster and the priority of each read node includes: determining the node status of each read node in the server cluster; extracting multiple candidate nodes whose node status is online from the server cluster; matching the request address with the running address of the sub-cluster to which each candidate node belongs to obtain the priority of each candidate node; and determining the target node set based on the priority of each candidate node.

[0062] Since read nodes may fail or be disabled, to avoid selecting a failed or disabled read node and thus preventing successful data read operations, read nodes can be filtered based on their status. Specifically, node status can be divided into online and offline states. For example, online read nodes are those that are enabled and healthy, while offline read nodes are those that are disabled or failed.

[0063] After filtering out multiple candidate nodes that are online from multiple read nodes, the candidate nodes can be further filtered by matching the request address with the running address to determine the multiple candidate nodes with higher priority as the target node set, so as to give priority to using the read nodes located in the same data center as the application node to perform data reading operations.

[0064] When matching the request address with the running address of the candidate node, it can be determined whether the request address and the running address are consistent. If the request address and the running address are consistent, the priority of the candidate node can be determined to be the highest priority.

[0065] Furthermore, the priority of a candidate node can also be determined based on the distance between the location of the request address and the location of the candidate node's running address. For example, if the distance between the location of the request address and the location of the candidate node's running address is relatively short, the candidate node can be assigned a higher priority.

[0066] According to embodiments of this disclosure, by determining the target node set based on the node status and priority of each read node, a suitable read node can be selected from multiple read nodes to process data read requests, thereby improving data read efficiency.

[0067] According to embodiments of this disclosure, determining a target node set based on the priority of each candidate node includes: determining a target node set based on the candidate node with priority of first level when it is determined that there is a candidate node with priority of first level; and determining a target node set based on the candidate node when it is determined that the priority of each candidate node is second level.

[0068] According to embodiments of this disclosure, a first level indicates that the request address and the running address are the same, while a second level indicates that the request address and the running address are different. When the request address and the running address are the same, the application node and the read node are located in the same data center; when the request address and the running address are different, the application node and the read node are not located in the same data center.

[0069] If there are candidate nodes with a priority of first level, it means that there are candidate nodes in the same data center as the application node. At this time, multiple candidate nodes with a priority of first level can be identified as the target node set, so that the read nodes in the same data center can be used to process data read operations first.

[0070] However, if all candidate nodes have a priority level of 2, it means that there are no read nodes in the same data center as the application node, or that all read nodes in the same data center as the application node are offline. In this case, all candidate nodes can be identified as target nodes to ensure that the data reading operation is completed.

[0071] When all candidate nodes have a priority level of 2, the request address and the running address of the candidate node can be further compared to determine the distance between the location of the request address and the location of the running address. This allows the multiple candidate nodes with a priority level of 2 to be further divided into multiple different priorities, so that the read node that is closer to the application node can be used to perform data reading operations.

[0072] According to embodiments of this disclosure, by determining the target node set based on priority, read nodes whose running addresses match the requested addresses can be selected first to perform data reading operations, thereby improving data reading efficiency.

[0073] Figure 3A The diagram illustrates the architecture of a server cluster according to a specific embodiment of the present disclosure.

[0074] like Figure 3A As shown, the server cluster is deployed in data center A and data center B. Data center A contains application node A, application node B, write node A, read node A, and read node B, while data center B contains application node C, application node D, read node C, read node D, and read node E.

[0075] For example, when application node C receives a data read request, read nodes C, D, and E, which are in the same data center as application node C, have the highest priority, while read nodes A and B, which are in different data centers from application node C, have the highest priority.

[0076] Figure 3B The illustration shows a schematic diagram of a request-response method according to a specific embodiment of the present disclosure.

[0077] like Figure 3B As shown, when application node C in data center B receives a data read request, read nodes A, B, C, D, and E are all online, thus identifying read nodes A, B, C, D, and E as candidate nodes.

[0078] like Figure 3B As shown, among the candidate nodes, the C read nodes, D read nodes, and E read nodes in the same data center as the C application node have the highest priority. The C read nodes, D read nodes, and E read nodes are determined as the target node set. The C read nodes, D read nodes, or E read nodes are used to perform data reading operations first to reduce network latency and improve response speed. Furthermore, the read nodes of the C read nodes, D read nodes, and E read nodes that correspond to the target weight range are selected to perform data reading operations. For example, the D read node is selected to perform data reading operations.

[0079] Figure 3C A schematic diagram of a request-response method according to another specific embodiment of the present disclosure is shown.

[0080] like Figure 3C As shown, when application node C in data center B receives a data read request, read nodes A and B are online, while read nodes C, D, and E are offline (e.g., due to system crash or network failure). Read nodes A and B are identified as candidate nodes to ensure service continuity and availability.

[0081] like Figure 3C As shown, the priority of read node A and read node B in the candidate nodes is the second level. Read node A and read node B are determined as the target node set, and then read node A and read node B that corresponds to the target weight interval are selected to perform data reading operation. For example, read node A is selected to perform data reading operation.

[0082] According to embodiments of this disclosure, when an application node initiates a read request, it preferentially selects a read node in the same data center to perform the data reading operation, thereby reducing network latency and improving response speed. If a read node in the same data center becomes unavailable (e.g., due to downtime or network failure), the system automatically switches to a read node in another data center to ensure service continuity and availability. This mechanism not only optimizes read performance but also enhances the system's fault tolerance.

[0083] According to embodiments of this disclosure, multiple cumulative weight intervals are determined based on the weights of each read node in the target node set, including: summing the weights of each read node one by one to obtain multiple interval boundary values; and generating multiple consecutive cumulative weight intervals based on the initial values ​​and the multiple interval boundary values.

[0084] After accumulating the weights of each read node one by one, the upper limit of each cumulative weight interval is the sum of the weights of the corresponding read nodes. Each cumulative weight interval forms a one-to-one correspondence with the read nodes in the target node set. The initial value can be the lower limit of the first cumulative weight interval.

[0085] Specifically, a write lock can be acquired first to ensure thread safety in memory. Then, all read nodes are traversed, weights are accumulated, and the identifier arrays and interval boundary value arrays of all read nodes are filled. If read nodes exist within the same data center, the read nodes within that data center are traversed, weights are accumulated, and the identifier arrays and interval boundary value arrays of each read node within that data center are filled. Finally, the write lock is released, thus initializing the interval boundary values.

[0086] The cumulative weight intervals are generated based on the initial value and multiple interval boundary values. For example, with an initial value of 0, the first cumulative weight interval corresponding to the C read node is 0-50, the second cumulative weight interval corresponding to the D read node is 50-150, and the third cumulative weight interval corresponding to the E read node is 150-200.

[0087] According to embodiments of this disclosure, multiple consecutive cumulative weight intervals are obtained by accumulating the weights of each read node, so that the range of the cumulative weight interval corresponding to the read node with a larger weight is larger, thereby improving the selection of read nodes with higher hardware configuration and performance data to perform read operations and improving request response speed.

[0088] Figure 4 The diagram illustrates the generation of a cumulative weight interval according to a specific embodiment of the present disclosure.

[0089] If only read node A is offline among read nodes A through E, the candidate nodes include read nodes B through E, with read node B having a weight of 50, read node C having a weight of 50, read node D having a weight of 100, and read node E having a weight of 50. After traversing all read nodes and accumulating the weights, the identifier array for all read nodes is [read node B, read node C, read node D, read node E], the interval boundary value array for all read nodes is [50, 100, 200, 250], and the total weight of all read nodes is 250. After traversing the read nodes in the same data center and calculating the cumulative weights, the identifier array for the read nodes in data center B is [read node C, read node D, read node E], and the interval boundary value array is [50, 150, 200].

[0090] like Figure 4As shown, with an initial value of 0, the first cumulative weight range corresponding to the C read node is 0-50, the second cumulative weight range corresponding to the D read node is 50-150, and the third cumulative weight range corresponding to the E read node is 150-200.

[0091] According to embodiments of this disclosure, random values ​​are generated by the following operations: determining the maximum boundary value from a plurality of interval boundary values; and generating random values ​​within the interval formed by the initial value and the maximum boundary value.

[0092] To ensure that the generated random values ​​fall within multiple cumulative weight intervals and avoid generating invalid random values ​​that could lead to low request response efficiency, the range of generated random values ​​can be limited to these intervals. For example, the range of generated random values ​​could be between 0 and 200, allowing for the selection of the read node to perform the data reading operation from read nodes C, D, and E.

[0093] When determining the range of multiple cumulative weight intervals, since these intervals are consecutive, the maximum boundary value of the multiple cumulative weight intervals can be the upper limit of the largest cumulative weight interval. Specifically, when there are three read nodes in the target node set, there are three corresponding cumulative weight intervals. In this case, the upper limit of the third cumulative weight interval can be determined as the maximum boundary value.

[0094] According to embodiments of this disclosure, by generating random values ​​within the interval formed by the initial value and the maximum boundary value, it is possible to ensure that the generated random values ​​are within the range of multiple cumulative weight intervals, thereby improving the request response speed.

[0095] According to embodiments of this disclosure, a random value generated within a cumulative weight interval is matched with each cumulative weight interval to determine the target weight interval corresponding to the random value. This includes: using a bisection method to determine the interval boundary value located in the middle position among multiple cumulative weight intervals to obtain an intermediate value; comparing the random value with the intermediate value to determine the remaining interval where the random value is located; repeating the above operation to gradually narrow the range of the remaining interval until the target weight interval to which the random value belongs is determined.

[0096] When determining the read node to perform data read operations from the target node set, the read node can be dynamically selected based on its weight and the data center it belongs to. For example, first, a read lock is acquired to ensure thread safety; second, if all read nodes in the same data center are online, a random value is generated and a read node is selected from among them; if all read nodes in the same data center are offline, a random value is generated and a read node is selected from among all them; finally, the read lock is released.

[0097] When determining the target weight interval, a binary search approach can be used to identify it from multiple cumulative weight intervals, thus improving efficiency. When all read nodes in the same data center are online, the binary search method can be used to determine the target weight interval from the cumulative weight intervals of read nodes within the same data center based on a random value, and then the read node corresponding to the target weight interval will perform the data reading operation. When all read nodes in the same data center are offline, the binary search method can be used to determine the target weight interval from the cumulative weight intervals of all read nodes based on a random value, and then the read node corresponding to the target weight interval will perform the data reading operation. Specifically, when using the binary search method, the random value can be compared with the median value of the cumulative weight interval, gradually narrowing down the cumulative weight interval until the target weight interval is determined.

[0098] When determining the median value, if the number of cumulative weight intervals is odd, the cumulative weight interval located in the middle position can be determined from multiple cumulative weight intervals, and the upper or lower limit value of the cumulative weight interval in the middle position can be determined as the median value. If the number of cumulative weight intervals is even, the boundary value between two cumulative weight intervals located in the middle position can be determined as the median value.

[0099] According to embodiments of this disclosure, the remaining interval includes at least one cumulative weight interval. If the random value is less than the median value, multiple cumulative weight intervals less than the median value can be identified as the remaining interval; conversely, multiple cumulative weight intervals greater than the median value can be identified as the remaining interval.

[0100] When determining the target weight interval, the random value is compared with the interval boundary value located in the middle of the remaining interval to gradually narrow the range of the remaining interval until the remaining interval includes only a single cumulative weight interval, and this cumulative weight interval is determined to be the target weight interval to which the random value belongs.

[0101] The second cumulative weight interval is the cumulative weight interval in the middle position. Therefore, the lower limit of the second cumulative weight interval, 50, or the upper limit, 150, can be determined as the interval boundary value in the middle position. If the lower limit of the second cumulative weight interval, 50, is the interval boundary value in the middle position and the random value is 52, then the second and third cumulative weight intervals can be determined as the remaining intervals. Furthermore, by comparing the random value with 150, the target weight interval is determined to be the second cumulative weight interval.

[0102] According to embodiments of this disclosure, by using a binary search method to select a target weight interval from multiple cumulative weight intervals, the efficiency of determining the target weight interval can be improved, thereby improving the efficiency of determining the read node to perform the data reading operation.

[0103] Figure 5The diagram illustrates a process for determining a target cumulative weight interval according to a specific embodiment of the present disclosure.

[0104] like Figure 5 As shown, the initial value is 0, the maximum boundary value is 200, and the interval formed by the initial value and the maximum boundary value is 0-200. Within this interval, a random value of 52 is generated. Comparing the random value 52 with the median value 50, it is determined that the remaining interval containing the random value 52 includes the second cumulative weight interval and the third cumulative weight interval. Further comparing the random value 52 with the median value 150, the target weight interval is determined to be the second cumulative weight interval.

[0105] According to embodiments of this disclosure, the request-response method further includes: continuously monitoring the hardware configuration and performance data of each read node during the data reading operation; and dynamically updating the weight of each read node when it is determined that the hardware configuration and performance data of the read node have changed and a predetermined condition has been met.

[0106] Since the hardware configuration and performance data of read nodes are subject to change—for example, changes in hardware configuration due to replacing faulty components of a faulty read node, or changes in performance data due to read nodes performing data reading operations—the hardware configuration and performance data of read nodes can be continuously monitored to update the weight of read nodes in real time based on the changed hardware configuration and performance data.

[0107] When updating the weight of a read node, the weight can be updated only if the hardware configuration and performance data of the read node meet predetermined conditions. Specifically, predetermined conditions may include the model of the processor, memory, and hard drive, as well as preset thresholds for performance data. For example, the weight of the read node can be updated when a change in the model of the processor, memory, or hard drive is detected, or the weight of the read node can be updated when the performance data of the read node is detected to be greater than a preset threshold.

[0108] According to embodiments of this disclosure, by continuously monitoring the hardware configuration and performance data of read nodes and updating the weights of read nodes accordingly, the weights are made timely, thereby improving the accuracy of selecting read nodes and further improving the request response speed.

[0109] In some embodiments, when the hardware configuration and performance data of each read node are low, additional read nodes can be added to perform data read operations. Specifically, users can maintain information about the server cluster through a visual interface, such as configuring key metadata for newly added read nodes, including their running address, port, read / write type, online status, read / write weight, and data center affiliation.

[0110] Figure 6The illustration shows a schematic diagram of a page with a newly added node according to a specific embodiment of the present disclosure.

[0111] like Figure 6 As shown, when adding a new node, users can configure information such as node name, running address, port, primary / standby type, read / write type, online status, read weight, and data center affiliation on the page.

[0112] like Figure 6 As shown, users also need to enter their username and password on the page so that their identity and permissions can be verified based on their username and password, thus improving security.

[0113] According to embodiments of this disclosure, the system can also utilize a distributed key-value storage system to store the metadata of each node. Since the distributed key-value storage system is based on a distributed consensus algorithm, it can ensure the reliability and real-time performance of the server cluster's metadata in a distributed environment. Furthermore, the asynchronous, non-blocking, proactive notification mode of the distributed key-value storage system enables real-time notification of node information changes. Therefore, when the node information stored in the distributed storage system changes, the system can select a read node based on the latest node information, improving flexibility and responsiveness.

[0114] When a user accesses the client through a terminal, the client can pull the metadata stored in the distributed key-value storage system into memory to determine the read node based on the metadata in memory.

[0115] Clients can enable read / write splitting via annotation configuration. This is done by configuring annotations at the service layer to specify which transactions should be routed to the read database, thus enabling read / write splitting. Furthermore, when configuring the data source, the request address or data center information must be explicitly specified to ensure that the data center priority policy takes effect.

[0116] Figure 7 A block diagram of a request response apparatus according to an embodiment of the present disclosure is shown schematically.

[0117] like Figure 7 As shown, the request response device 700 includes a node determination module 710, an interval determination module 720, an interval matching module 730, and a data reading module 740.

[0118] The node determination module 710 is used to respond to a received data read request and determine a target node set based on the node status and priority of multiple read nodes in the server cluster. The priority is determined based on the matching relationship between the request address of the data read request and the running addresses of each sub-cluster in the server cluster. In one embodiment, the node determination module 710 can be used to perform the operation S210 described above, which will not be repeated here.

[0119] The interval determination module 720 is used to determine multiple cumulative weight intervals based on the weights of each read node in the target node set. The weights are obtained by evaluating the hardware configuration and performance data of the read nodes, and each cumulative weight interval corresponds one-to-one with a read node in the target node set. In one embodiment, the interval determination module 720 can be used to perform the operation S220 described above, which will not be repeated here.

[0120] The interval matching module 730 is used to match the random value generated within the cumulative weight interval with each cumulative weight interval to determine the target weight interval corresponding to the random value. In one embodiment, the interval matching module 730 can be used to perform the operation S230 described above, which will not be repeated here.

[0121] The data reading module 740 is used to perform data reading operations using the read nodes in the target node set that correspond to the target weight interval. In one embodiment, the data reading module 740 can be used to perform the operation S240 described above, which will not be repeated here.

[0122] According to embodiments of this disclosure, the node determination module 710 includes a state determination submodule, a candidate extraction submodule, an address matching submodule, and a target determination submodule.

[0123] The status determination submodule is used to determine the node status of each read node in the server cluster.

[0124] The candidate extraction submodule is used to extract multiple candidate nodes from the server cluster whose node status is online.

[0125] The address matching submodule is used to match the request address with the running address of the sub-cluster to which each candidate node belongs, so as to obtain the priority of each candidate node.

[0126] The target determination submodule is used to determine the set of target nodes based on the priority of each candidate node.

[0127] According to embodiments of this disclosure, the target determination submodule includes a first determination unit and a second determination unit.

[0128] The first determining unit is used to determine the target node set based on the candidate nodes with priority level 1 when it is determined that there are candidate nodes with priority level 1. The first level indicates that the request address and the running address are consistent.

[0129] The second determining unit is used to determine the target node set based on the candidate nodes, provided that the priority of each candidate node is determined to be at the second level. The second level indicates that there is a difference between the request address and the running address.

[0130] According to embodiments of this disclosure, the interval determination module 720 includes a weight accumulation submodule and an interval generation submodule.

[0131] The weight accumulation submodule is used to accumulate the weights of each read node one by one to obtain multiple interval boundary values.

[0132] The interval generation submodule is used to generate multiple consecutive cumulative weight intervals based on initial values ​​and multiple interval boundary values. The upper limit of each cumulative weight interval is the sum of the weights of the corresponding read nodes. Each cumulative weight interval has a one-to-one correspondence with the read nodes in the target node set.

[0133] According to embodiments of this disclosure, the interval determination module 720 further includes a boundary determination submodule and a random generation submodule.

[0134] The boundary determination submodule is used to determine the maximum boundary value from multiple interval boundary values.

[0135] The random generation submodule is used to generate random values ​​within the interval formed by the initial value and the maximum boundary value.

[0136] According to embodiments of the present disclosure, the interval matching module 730 includes an intermediate determination submodule, a comparison submodule, and an interval determination submodule.

[0137] The intermediate determination submodule is used to determine the interval boundary value located in the middle position among multiple cumulative weight intervals using the binary search method, so as to obtain the intermediate value.

[0138] The comparison submodule is used to compare random values ​​with median values ​​to determine the remaining interval in which the random value is located. The remaining interval includes at least one cumulative weight interval.

[0139] The interval determination submodule is used to repeatedly perform the above operations, gradually narrowing down the range of the remaining intervals until the target weight interval to which the random value belongs is determined.

[0140] According to embodiments of this disclosure, the request response device further includes a node monitoring module and a weight update module.

[0141] The node monitoring module is used to continuously monitor the hardware configuration and performance data of each read node during the data read operation.

[0142] The weight update module is used to dynamically update the weight of each read node when the hardware configuration and performance data of the read node change and a predetermined condition is met.

[0143] Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as hardware circuitry, such as a Field-Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a System-on-Chip, a System-on-a-Substrate, a System-on-Package, an Application-Specific Integrated Circuit (ASIC), or implemented in hardware or firmware by any other reasonable means of integrating or packaging circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, one or more of the modules, submodules, units, and subunits according to embodiments of the present disclosure can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.

[0144] For example, any plurality of the node determination module 710, interval determination module 720, interval matching module 730, and data reading module 740 can be combined into one module / unit / subunit, or any one of these modules / units / subunits can be split into multiple modules / units / subunits. Alternatively, at least part of the functionality of one or more of these modules / units / subunits can be combined with at least part of the functionality of other modules / units / subunits and implemented in one module / unit / subunit. According to embodiments of the present disclosure, at least one of the node determination module 710, interval determination module 720, interval matching module 730, and data reading module 740 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any suitable combination of any of these three implementation methods. Alternatively, at least one of the node determination module 710, interval determination module 720, interval matching module 730, and data reading module 740 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.

[0145] It should be noted that the request response device part in the embodiments of this disclosure corresponds to the request response method part in the embodiments of this disclosure. For a detailed description of the request response device part, please refer to the request response method part, which will not be repeated here.

[0146] Figure 8 A block diagram of an electronic device suitable for implementing the methods described above, according to embodiments of the present disclosure, is illustrated schematically. Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0147] like Figure 8 As shown, an electronic device 800 according to an embodiment of this disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage portion 808 into a random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this disclosure.

[0148] RAM 803 stores various programs and data required for the operation of electronic device 800. Processor 801, ROM 802, and RAM 803 are interconnected via bus 804. Processor 801 performs various operations of the method flow according to embodiments of the present disclosure by executing programs in ROM 802 and / or RAM 803. It should be noted that programs may also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in one or more memories.

[0149] According to embodiments of this disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to a bus 804. The electronic device 800 may also include one or more of the following components connected to the input / output (I / O) interface 805: an input section 806 including a keyboard, mouse, etc.; an output section 807 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the input / output (I / O) interface 805 as needed. A removable medium 811, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 810 as needed so that computer programs read from it can be installed into the storage section 808 as needed.

[0150] According to embodiments of this disclosure, the method flow according to embodiments of this disclosure can be implemented as a computer software program. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 809, and / or installed from removable medium 811. When the computer program is executed by processor 801, it performs the functions defined in the system of embodiments of this disclosure. According to embodiments of this disclosure, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0151] This disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs that, when executed, implement the method according to the embodiments of this disclosure.

[0152] According to embodiments of this disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0153] For example, according to embodiments of this disclosure, a computer-readable storage medium may include the ROM 802 and / or RAM 803 described above and / or one or more memories other than ROM 802 and RAM 803.

[0154] Embodiments of this disclosure also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of this disclosure. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the request-response method provided in the embodiments of this disclosure.

[0155] When the computer program is executed by the processor 801, it performs the functions defined in the system / apparatus of this disclosure embodiments. According to embodiments of this disclosure, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.

[0156] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 809, and / or installed from a removable medium 811. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.

[0157] According to embodiments of this disclosure, program code for executing the computer programs provided in embodiments of this disclosure can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, languages ​​such as Java, C++, Python, "C", or similar programming languages. The program code can execute entirely on a user's computing device, partially on a user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0158] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways, even if such combinations are not explicitly described in the present disclosure. In particular, the features described in the various embodiments of this disclosure may be combined and / or combined in various ways without departing from the spirit and teachings of this disclosure. All such combinations and / or combinations fall within the scope of this disclosure.

[0159] The embodiments of this disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of this disclosure. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of this disclosure, and all such substitutions and modifications should fall within the scope of this disclosure.

Claims

1. A request-response method, comprising: In response to a received data read request, a target node set is determined based on the node status of multiple read nodes in the server cluster and the priority of each read node. The priority is determined based on the matching relationship between the request address of the data read request and the running address of each sub-cluster in the server cluster. Based on the weight of each read node in the target node set, multiple cumulative weight intervals are determined. The weights are obtained based on the hardware configuration and performance data of the read nodes, and each cumulative weight interval corresponds one-to-one with a read node in the target node set. The random value generated within the cumulative weight interval is matched with each of the cumulative weight intervals to determine the target weight interval corresponding to the random value; The data reading operation is performed using the read nodes in the target node set that correspond to the target weight interval.

2. The method according to claim 1, wherein, The step of determining the target node set based on the node status of multiple read nodes in the server cluster and the priority of each read node includes: Determine the node status of each read node in the server cluster; Extract multiple candidate nodes whose node status is online from the server cluster; The request address is matched with the running address of the sub-cluster to which each candidate node belongs to obtain the priority of each candidate node; The target node set is determined based on the priority of each candidate node.

3. The method according to claim 2, wherein, Determining the target node set based on the priority of each candidate node includes: If it is determined that there are candidate nodes with the first priority level, the target node set is determined based on the candidate nodes with the first priority level, where the first priority level indicates that the request address is consistent with the running address; Given that the priority of each candidate node is determined to be at the second level, the target node set is determined based on the candidate nodes, where the second level indicates that there is a difference between the request address and the running address.

4. The method according to claim 1, wherein, The step of determining multiple cumulative weight intervals based on the weights of each read node in the target node set includes: The weights of each read node are summed one by one to obtain multiple interval boundary values; Based on the initial value and multiple interval boundary values, multiple consecutive cumulative weight intervals are generated. The upper limit value of each cumulative weight interval is the sum of the weights of the corresponding read nodes. Each cumulative weight interval forms a one-to-one correspondence with the read nodes in the target node set.

5. The method according to claim 4, further comprising: Determine the maximum boundary value from among the multiple interval boundary values; The random value is generated within the interval formed by the initial value and the maximum boundary value.

6. The method according to claim 1, wherein, The step of matching the random value generated within the cumulative weight interval with each of the cumulative weight intervals to determine the target weight interval corresponding to the random value includes: Using the bisection method, the boundary value of the interval located in the middle position is determined among the multiple cumulative weight intervals to obtain the median value; The random value is compared with the median value to determine the remaining interval in which the random value is located, and the remaining interval includes at least one of the cumulative weight intervals. Repeat the above operation to gradually narrow down the range of the remaining interval until the target weight interval to which the random value belongs is determined.

7. The method according to claim 1, further comprising: During the data reading operation, the hardware configuration and performance data of each read node are continuously monitored; For each read node, the weight of the read node is dynamically updated when it is determined that the hardware configuration and performance data of the read node have changed and a predetermined condition is met.

8. A request-response device, comprising: The node determination module is used to respond to a received data read request and determine a target node set based on the node status of multiple read nodes in the server cluster and the priority of each read node. The priority is determined based on the matching relationship between the request address of the data read request and the running address of each sub-cluster in the server cluster. The interval determination module is used to determine multiple cumulative weight intervals based on the weights of each read node in the target node set. The weights are obtained based on the hardware configuration and performance data of the read nodes, and each cumulative weight interval corresponds one-to-one with a read node in the target node set. An interval matching module is used to match random values ​​generated within the cumulative weight intervals with each of the cumulative weight intervals to determine the target weight interval corresponding to the random values. The data reading module is used to perform data reading operations using the read nodes in the target node set that correspond to the target weight interval.

9. An electronic device, comprising: One or more processors; Memory, used to store one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1 to 7.

10. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 7.

11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Load balancing weight configuration method and device for database cluster and medium

    CN122285307A

  • A load balancing weight configuration method, device and medium of a database cluster

    CN122285307B