CN110609855A - Query processing and query rate threshold determination method and distributed query system - Google Patents

Query processing and query rate threshold determination method and distributed query system Download PDF

Info

Publication number
CN110609855A
CN110609855A CN201810530917.0A CN201810530917A CN110609855A CN 110609855 A CN110609855 A CN 110609855A CN 201810530917 A CN201810530917 A CN 201810530917A CN 110609855 A CN110609855 A CN 110609855A
Authority
CN
China
Prior art keywords
query
server
rate threshold
processing server
query processing
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
CN201810530917.0A
Other languages
Chinese (zh)
Other versions
CN110609855B (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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology 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 Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN201810530917.0A priority Critical patent/CN110609855B/en
Publication of CN110609855A publication Critical patent/CN110609855A/en
Application granted granted Critical
Publication of CN110609855B publication Critical patent/CN110609855B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a query processing method, a query rate threshold determining method and a distributed query system, wherein the query processing method comprises the following steps: the query processing server acquires a corresponding first query rate threshold value; the query processing server counts the query rate of receiving the query request in a preset time period; when the query rate is greater than or equal to the first query rate threshold value, the query processing server receives a first query request issued by the central server and refuses to receive second query requests issued by other query processing servers except the central server; and the query processing server queries corresponding data from a corresponding database according to the first query request. The problem that the request quantity of the server with the overlarge request quantity can not be limited in the first time in the prior art is solved, and the request quantity of the server with the overlarge request quantity can be limited in the first time, so that the normal operation of the system is ensured.

Description

Query processing and query rate threshold determination method and distributed query system
Technical Field
The embodiment of the invention relates to the technical field of networks, in particular to a query processing and query rate threshold determining method and a distributed query system.
Background
Each server in the distributed query system can process and respond to the request, so that the total request amount needs to be reasonably distributed to each server, each server can process the request as much as possible within the maximum processing capacity, and the distributed query system can achieve the optimal performance. However, in practical applications, when the processing capacity of the server is insufficient to process the amount of requests received by the server, the amount of requests from the server needs to be limited.
In the prior art, the request amount of a distributed query system is limited by a random extraction mode. The method mainly comprises the following steps: firstly, randomly extracting a plurality of servers from a distributed query system; then, verifying whether the request quantity received by the randomly extracted server in a certain time period is greater than the specified quantity; and finally, when the received request quantity is larger than the specified quantity, limiting the request quantity of the server.
However, since a certain time is required for authentication, the amount of requests cannot be limited for a server having an excessively large amount of requests in the first time.
Disclosure of Invention
The invention provides a query processing and query rate threshold determining method and a distributed query system, which are used for solving the problems of the distributed query system in the prior art.
According to a first aspect of the present invention, there is provided a query processing method applied to a distributed query system, the distributed query system including: at least one query processing server, wherein the query processing server comprises at least one central server, the query processing server corresponds to a database, and the method comprises the following steps:
the query processing server acquires a corresponding first query rate threshold value;
the query processing server counts the query rate of receiving the query request in a preset time period;
when the query rate is greater than or equal to the first query rate threshold value, the query processing server receives a first query request issued by the central server and refuses to receive second query requests issued by other query processing servers except the central server;
and the query processing server queries corresponding data from a corresponding database according to the first query request.
According to a second aspect of the present invention, there is provided a method for determining a query rate threshold, which is applied to a distributed query system, the distributed query system including: the method comprises the following steps that a registration server and at least one query processing server are adopted, the query processing server comprises at least one central server, the query processing server corresponds to a database, and the method comprises the following steps:
the registration server determines a second query rate threshold of the distributed query system and the weight of each query processing server;
the registration server determines a first query rate threshold of each query processing server according to the second query rate threshold and the weight of each query processing server;
the registration server issues the first query rate threshold to each corresponding query processing server; each query processing server is used for counting the query rate of receiving the query request in a preset time period; and when the query rate is greater than or equal to a first query rate threshold corresponding to the query processing server, receiving a first query request issued by the central server, and querying corresponding data from a corresponding database according to the first query request.
According to a third aspect of the present invention there is provided a distributed query system, the system comprising: the system comprises a registration server and at least one query processing server, wherein the query processing server comprises at least one central server, and the query processing server corresponds to a database.
According to a fourth aspect of the present invention, there is provided an electronic apparatus comprising:
a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the query processing method of the first aspect when executing the program.
According to a fifth aspect of the present invention, there is provided an electronic apparatus comprising:
a processor, a memory and a computer program stored on the memory and executable on the processor, the processor implementing the method for determining the query rate threshold according to the second aspect when executing the program.
According to a sixth aspect of the present invention, there is provided a readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to perform the query processing method of the first aspect.
According to a seventh aspect of the present invention, there is provided a readable storage medium, wherein instructions, when executed by a processor of an electronic device, enable the electronic device to execute the method for determining a query rate threshold according to the foregoing second aspect.
The embodiment of the invention provides a query processing method, a query rate threshold determining method and a distributed query system, wherein the query processing method comprises the following steps: the query processing server acquires a corresponding first query rate threshold value; the query processing server counts the query rate of receiving the query request in a preset time period; when the query rate is greater than or equal to the first query rate threshold value, the query processing server receives a first query request issued by the central server and refuses to receive second query requests issued by other query processing servers except the central server; and the query processing server queries corresponding data from a corresponding database according to the first query request. The problem that the request quantity of the server with the overlarge request quantity can not be limited in the first time in the prior art is solved, and the request quantity of the server with the overlarge request quantity can be limited in the first time, so that the normal operation of the system is ensured.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
Fig. 1 is a flowchart illustrating specific steps of a query processing method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating specific steps of a query processing method according to a second embodiment of the present invention;
FIG. 2A is a schematic diagram of the interaction between a registration server and a query processing server according to an embodiment of the present invention;
FIG. 2B is a schematic diagram of a policy chain according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating specific steps of a method for determining a query rate threshold according to a third embodiment of the present invention;
fig. 4 is a flowchart illustrating specific steps of a method for determining a query rate threshold according to a fourth embodiment of the present invention;
fig. 5 is a structural diagram of a distributed query system according to a fifth embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. 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.
Example one
Referring to fig. 1, a flowchart illustrating specific steps of a query processing method according to an embodiment of the present invention is shown.
Step 101, the query processing server obtains a corresponding first query rate threshold.
The embodiment of the invention is applied to a distributed query system, and the distributed query system comprises: the system comprises at least one query processing server, wherein the query processing server comprises at least one central server and corresponds to a database.
The query processing server is used for receiving the query request, querying corresponding data from the corresponding database according to the query request, and returning the data to the user. It is to be appreciated that the query processing servers can be associated with each other and can communicate with each other.
The database is used for storing data to be inquired. In practical applications, there may be one or more databases, and the embodiment of the present invention does not limit the databases. When the number of the databases is one, all the query processing servers query data from the databases, and the storage capacity of the databases is large; when the number of the databases is multiple, one database correspondingly designates one or more query processing servers, and the one or more query processing servers can query data from the corresponding database.
The central server is a special query processing server, has all functions of the query processing server, and can perform limited query on all the query processing servers in the whole distributed query system in a unified manner. It can be understood that the central server may be set according to an actual application scenario, and the embodiment of the present invention does not limit the central server.
The first query rate threshold is a maximum query rate of the query processing server, and is used for limiting the query rate of the query processing server. When the query rate of the query processing server receiving the query is greater than or equal to a first query rate threshold value, performing query limitation on the query processing server; and when the query rate of the query processing server for receiving the query is less than the first query rate threshold value, not performing query limitation on the query processing server. Wherein, the query rate is represented by the number of query requests received in unit time. In practical applications, the query rate is often expressed in terms of the number of queries received per second, i.e.: QPS (Query per second, Query rate). It is to be understood that the query rate may also be expressed by the number of received query requests in other units of time, which is not limited by the embodiment of the present invention.
And 102, counting the query rate of receiving the query request in a preset time period by the query processing server.
The preset time period is used for counting the query rate of the query processing server. When the preset time period is longer, the query rate per second is more accurate, but the query limit delay of the query processing server exceeding the query request amount is larger; when the preset time period is shorter, the query rate per second is less accurate, but the query limit delay for the query processing server with the query request amount exceeding is smaller. Therefore, an appropriate value needs to be set according to an actual application scenario, which is not limited by the embodiment of the present invention.
Specifically, firstly, counting the number of query requests received by a query processing server within a preset time period; then, the number of query requests is divided by a preset time period and converted into a query rate of a specified unit time.
Step 103, when the query rate is greater than or equal to the first query rate threshold, the query processing server receives the first query request issued by the central server, and rejects receiving the second query requests issued by other query processing servers except the central server.
When the query rate of the query processing server reaches the first query rate threshold value, the embodiment of the invention stops receiving the query requests issued by other query processing servers and only receives the query requests issued by the central server. And the central server can judge whether to issue the query request according to the query request received by the whole system when issuing the query request. Therefore, the system and the query requests received by the query processing servers can be ensured to be in a processing range, and the normal operation of the system is further ensured.
And 104, the query processing server queries corresponding data from a corresponding database according to the first query request.
The database is divided into a mesh database, a relational database, a tree database, an object-oriented database and the like according to a storage model. Among the commercial applications are relational databases such as Oracle, DB2, Sybase, MS SQL Server, Informatx, MySQL, and the like. The database is different according to the service type of the distributed query system, and the embodiment of the present invention does not limit the database.
In summary, an embodiment of the present invention provides a query processing method, where the method includes: the query processing server acquires a corresponding first query rate threshold value; the query processing server counts the query rate of receiving the query request in a preset time period; when the query rate is greater than or equal to the first query rate threshold value, the query processing server receives a first query request issued by the central server and refuses to receive second query requests issued by other query processing servers except the central server; and the query processing server queries corresponding data from a corresponding database according to the first query request. The problem that the request quantity of the server with the overlarge request quantity can not be limited in the first time in the prior art is solved, and the request quantity of the server with the overlarge request quantity can be limited in the first time, so that the normal operation of the system is ensured.
Example two
Referring to fig. 2, a flowchart illustrating specific steps of a query processing method according to a second embodiment of the present invention is shown.
Step 201, receiving a first query rate threshold value for the query processing server issued by the registration server.
In the distributed query system, the registration server is used for registering and storing information of each query processing server. In the embodiment of the present invention, the registration server is further configured to determine a first query rate threshold of the query processing server, and send the first query rate threshold to the corresponding query processing server.
As shown in fig. 2A, the registration server receives registration requests of the query processing servers a and B and saves information of the query processing servers a and B. In addition, the registration server calculates a first query rate threshold of 50 for query processing server a and a first query rate threshold of 80 for query processing server B, and issues 50 and 80 to query processing servers a and B, respectively.
Step 202, adding the first query rate threshold of the query processing server to the policy chain according to the preset priority of the first query rate threshold.
The preset priority of the first query rate threshold may be set according to an actual application scenario, which is not limited in the embodiments of the present invention. When the first query rate threshold is inserted to the front position, the query is limited by the first query rate threshold preferentially; when the first query rate threshold is inserted to a later position, the query is preferentially restricted by other strategies.
According to the embodiment of the invention, the first query rate threshold value is stored in the strategy chain, so that the first query rate threshold value is prevented from being frequently acquired from the registration server, and the interaction cost is reduced.
In actual practice, the policy chain is stored in a local cache of the query processing server. As shown in fig. 2B, the shaded portion is a policy chain, one for each query processing server.
It is to be understood that the policy chain may also be used to store other policies for query processing, which is not limited by the embodiment of the present invention.
Step 203, the query processing server reads a corresponding first query rate threshold from a preset policy chain of the query processing server.
Specifically, each query processing server reads a first query rate threshold in the policy chain from a respective cache location.
Step 204, the query processing server counts the query rate of receiving the query request in a preset time period.
This step can refer to the detailed description of step 102, and is not described herein again.
Step 205, when the query rate is greater than or equal to the first query rate threshold, the query processing server receives the first query request issued by the central server, and rejects to receive the second query request issued by other query processing servers except the central server.
This step can refer to the detailed description of step 103, which is not repeated herein.
Optionally, in another embodiment of the present invention, the central server is configured to: and when the sum of the query rates of the query processing servers is greater than or equal to a second query rate threshold of the distributed query system, stopping issuing the first query request to the query processing servers, wherein the second query rate threshold is obtained from the registration server.
Wherein, the second query rate threshold of the distributed query system may be set according to the processing capability of the distributed query system. After the setting, the second query rate threshold may be saved to the registry server. It is understood that a larger second query rate threshold indicates a higher processing capability of the distributed query system; the smaller the second query rate threshold, the worse the processing power of the distributed query system.
When the sum of the query rates of the query processing servers is greater than or equal to a second query rate threshold value, the central server stops issuing the first query request to the query processing servers; and when the sum of the query rates of the query processing servers is smaller than the second query rate threshold value, continuously issuing the first query request to the query processing servers.
Specifically, the central server may record the total number of requests issued to each query processing server, thereby determining the sum of the query rates.
Step 206, the query processing server queries corresponding data from a corresponding database according to the first query request.
This step can refer to the detailed description of step 104, and will not be described herein.
In summary, an embodiment of the present invention provides a query processing method, where the method includes: the query processing server acquires a corresponding first query rate threshold value; the query processing server counts the query rate of receiving the query request in a preset time period; when the query rate is greater than or equal to the first query rate threshold value, the query processing server receives a first query request issued by the central server and refuses to receive second query requests issued by other query processing servers except the central server; and the query processing server queries corresponding data from a corresponding database according to the first query request. The problem that the request quantity of the server with the overlarge request quantity can not be limited in the first time in the prior art is solved, and the request quantity of the server with the overlarge request quantity can be limited in the first time, so that the normal operation of the system is ensured. In addition, the first query rate threshold may also be saved to the policy chain, thereby reducing the number of interactions with the registry.
EXAMPLE III
Referring to fig. 3, a flowchart illustrating specific steps of a method for determining a query rate threshold according to a third embodiment of the present invention is shown.
Step 301, the registration server determines a second query rate threshold of the distributed query system and a weight of each query processing server.
Wherein, the larger the weight of the query processing server is, the larger the number of query requests received by the query processing server is represented; the smaller the weight of a query processing server, the smaller the number of query requests received on behalf of that query processing server. In practical application, the query processing system can be determined according to the number of the query requests received by each query processing server in historical time, and can also be determined according to structural analysis of the distributed query system. The weight of each query processing server may be stored in the registration server as unique information of each query processing server.
The second query rate threshold may refer to the detailed description in step 205, and is not described herein again.
Step 302, the registration server determines a first query rate threshold of each query processing server according to the second query rate threshold and the weight of each query processing server.
Specifically, the larger the second query rate threshold is, the larger the weight of each query processing server is, and the larger the first query rate threshold of each query processing server is; the smaller the second query rate threshold is, the smaller the weight of each query processing server is, and the smaller the first query rate threshold of each query processing server is.
Step 303, the registration server issues the first query rate threshold to each corresponding query processing server; each query processing server is used for counting the query rate of receiving the query request in a preset time period; and when the query rate is greater than or equal to a first query rate threshold corresponding to the query processing server, receiving a first query request issued by the central server, and querying corresponding data from a corresponding database according to the first query request.
Specifically, the registration server may issue the first query rate threshold to each query processing server through a message in a fixed format. It can be understood that the message may be issued in a broadcast manner, or in a point-to-point manner. When the query is issued in a broadcast manner, the identifier of the query processing server needs to be carried, so that the first query rate threshold is ensured to be sent to each correct query processing server.
It can be understood that the message format carrying the first query rate threshold may be set according to an actual application scenario, and the embodiment of the present invention does not limit the message format.
In summary, an embodiment of the present invention provides a method for determining a query rate threshold, where the method includes: the registration server determines a second query rate threshold of the distributed query system and the weight of each query processing server; the registration server determines a first query rate threshold of each query processing server according to the second query rate threshold and the weight of each query processing server; the registration server issues the first query rate threshold to each corresponding query processing server; each query processing server is used for counting the query rate of receiving the query request in a preset time period; and when the query rate is greater than or equal to a first query rate threshold corresponding to the query processing server, receiving a first query request issued by the central server, and querying corresponding data from a corresponding database according to the first query request. The problem that the request quantity of the server with the overlarge request quantity can not be limited in the first time in the prior art is solved, and the request quantity of the server with the overlarge request quantity can be limited in the first time, so that the normal operation of the system is ensured.
Example four
Referring to fig. 4, a flowchart of specific steps of a method for determining a query rate threshold according to a fourth embodiment of the present invention is shown.
Step 401, the registration server determines a second query rate threshold of the distributed query system and a weight of each query processing server.
This step can refer to the detailed description of step 301, and is not described herein again.
Step 402, the registry server determines a root node server in the distributed query system and at least one target server that directly interacts with the root node server.
In practical application, the distributed query system corresponds to a tree structure, so that a root node server, a leaf node server and an intermediate node server exist. The root node server corresponds to a first server, and the server only has a downstream server and does not have an upstream server; the leaf node server only has an upstream server and does not have a downstream server; the intermediate node server exists as both an upstream server and a downstream server.
According to the tree structure, a root node server and a target server directly interacting with the root node server receive query requests firstly, and the number of received query requests is large.
It is understood that the target server may be a leaf node server or an intermediate node server.
Step 403, the registration server preferentially determines a second query rate threshold of the root node server and at least one target server according to the first query rate threshold and the weight of each query processing server.
The embodiment of the invention can preferentially determine and issue the second query rate threshold values of the root node server and the target server, thereby preferentially carrying out query limitation on the root node server and the target server. The number of the queries received by the root node server and the target node server is more in the whole system, so that query limitation can be performed more timely, and system breakdown is avoided.
Optionally, in another embodiment of the present invention, step 403 includes the sub-steps of:
substep 4031, determining an early warning threshold according to the second query rate threshold, where the early warning threshold is smaller than the second query rate threshold.
And the early warning threshold and the second query rate threshold are equal unit quantities. It can be understood that the early warning threshold may be determined according to an actual application scenario, which is not limited in the embodiment of the present invention.
In practical applications, the query rate of the system may exceed the second query rate threshold during a period of time since the control query process needs to monitor the query rate during the period of time. The embodiment of the invention can further ensure that the system query rate exceeds the second query rate threshold in the query control process by utilizing the surplus query rate between the second query rate threshold and the early warning threshold.
It can be understood that the closer the early warning threshold is to the second query rate threshold, the easier the system query rate exceeds the second query rate threshold in the process of controlling query, but the system query rate is lower; the smaller the early warning threshold is, the lower the system query rate is, but the higher the system query rate is, in the process of controlling query.
Substep 4032, calculate the sum of the weights of the query processing servers to obtain the total weight.
For a distributed query system with N query processing servers, the overall weight Q is calculated as follows:
wherein q isiThe weight of the ith query processing server.
Substep 4033, for each query processing server, calculating a ratio of the weight of each query processing server to the total weight to obtain a corresponding weight parameter.
For the ith query processing server, the weight parameter piThe calculation formula of (a) is as follows:
and a substep 4034, calculating a product of the early warning threshold and the weight parameter of each query processing server for each query processing server to obtain a corresponding first query rate threshold.
For the ith query processing server, a first query rate threshold YiThe calculation formula of (a) is as follows:
wherein Y is an early warning threshold. The embodiment of the invention can preferentially issue the first query rate threshold values of the root node server and the target server calculated by the formula (3) through the step 404, then calculate the first query rate threshold values of other rest query processing servers through the formula (3), and then issue the first query rate threshold values through the step 404.
Step 404, the registration server issues the first query rate threshold to each corresponding query processing server; each query processing server is used for counting the query rate of receiving the query request in a preset time period; and when the query rate is greater than or equal to a first query rate threshold corresponding to the query processing server, receiving a first query request issued by the central server, and querying corresponding data from a corresponding database according to the first query request.
This step can refer to the detailed description of step 303, which is not described herein.
In summary, an embodiment of the present invention provides a method for determining a query rate threshold, where the method includes: the registration server determines a second query rate threshold of the distributed query system and the weight of each query processing server; the registration server determines a first query rate threshold of each query processing server according to the second query rate threshold and the weight of each query processing server; the registration server issues the first query rate threshold to each corresponding query processing server; each query processing server is used for counting the query rate of receiving the query request in a preset time period; and when the query rate is greater than or equal to a first query rate threshold corresponding to the query processing server, receiving a first query request issued by the central server, and querying corresponding data from a corresponding database according to the first query request. The problem that the request quantity of the server with the overlarge request quantity can not be limited in the first time in the prior art is solved, and the request quantity of the server with the overlarge request quantity can be limited in the first time, so that the normal operation of the system is ensured. In addition, the first query rate threshold of the root node server and the servers directly interacting with the root node server can be preferentially determined, so that the normal operation of the system can be further ensured.
EXAMPLE five
Referring to fig. 5, a structural diagram of a distributed query system according to a fifth embodiment of the present invention is shown, which is described in detail below.
The system comprises a registration server 501, at least one query processing server 502, at least one central server 5022 and a database 5021, wherein the query processing server 502 is used for acquiring a corresponding first query rate threshold; counting the query rate of receiving the query request in a preset time period; when the query rate is greater than or equal to the first query rate threshold, receiving a first query request issued by the central server 5022, and rejecting to receive second query requests issued by other query processing servers 502 except the central server 5022; and querying corresponding data from the corresponding database 5021 according to the first query request.
Optionally, in another embodiment of the present invention, the query processing server 502 is further configured to: reading a corresponding first query rate threshold from a preset policy chain of the query processing server 502.
Optionally, in another embodiment of the present invention, the query processing server 502 is further configured to: receiving a first query rate threshold value for the query processing server 502 issued by the registration server 501; adding the first query rate threshold of the query processing server 502 to the policy chain according to the preset priority of the first query rate threshold.
Optionally, in another embodiment of the present invention, the central server 5022 is configured to: when the sum of the query rates of the query processing servers 502 is greater than or equal to a second query rate threshold of the distributed query system, the issuing of the first query request to each query processing server 502 is stopped, and the second query rate threshold is obtained from the registration server 501.
Optionally, in another embodiment of the present invention, the registration server 501 is configured to: determining a second query rate threshold for the distributed query system, and a weight for each query processing server 502; determining a first query rate threshold of each query processing server 502 according to the second query rate threshold and the weight of each query processing server 502; issuing the first query rate threshold to each corresponding query processing server 502; each query processing server 502 is configured to count a query rate of receiving a query request within a preset time period; and when the query rate is greater than or equal to the first query rate threshold corresponding to the query processing server 502, receiving a first query request issued by the central server 5022, and querying corresponding data from a corresponding database 5021 according to the first query request.
Optionally, in another embodiment of the present invention, the registration server 501 is further configured to: determining an early warning threshold according to the second query rate threshold, wherein the early warning threshold is smaller than the second query rate threshold; calculating the sum of the weights of the query processing servers 502 to obtain a total weight; for each query processing server 502, calculating a ratio of the weight of each query processing server 502 to the total weight to obtain a corresponding weight parameter; for each query processing server 502, calculating a product of the early warning threshold and the weight parameter of each query processing server 502 to obtain a corresponding first query rate threshold.
Optionally, in another embodiment of the present invention, the registration server 501 is further configured to: determining a root node server in the distributed query system and at least one target server directly interacting with the root node server; and preferentially determining a second query rate threshold of the root node server and at least one target server according to the first query rate threshold and the weight of each query processing server 502.
In summary, an embodiment of the present invention provides a distributed query system, where the system includes: the system comprises a registration server and at least one query processing server, wherein the query processing server comprises at least one central server, corresponds to a database and is used for acquiring a corresponding first query rate threshold; counting the query rate of receiving the query request in a preset time period; when the query rate is greater than or equal to the first query rate threshold, receiving a first query request issued by the central server, and refusing to receive second query requests issued by other query processing servers except the central server; and inquiring corresponding data from the corresponding database according to the first inquiry request. The problem that the request quantity of the server with the overlarge request quantity can not be limited in the first time in the prior art is solved, and the request quantity of the server with the overlarge request quantity can be limited in the first time, so that the normal operation of the system is ensured.
An embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor, the processor implementing the query processing method of the first or second embodiment when executing the program.
An embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor, the processor implementing the method for determining a query rate threshold of the first or second embodiments when executing the program.
Embodiments of the present invention further provide a readable storage medium, and when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the query processing method of the first embodiment or the second embodiment.
The embodiment of the present invention further provides a readable storage medium, and when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for determining the query rate threshold in the first embodiment or the second embodiment.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components in a distributed querying device according to embodiments of the present invention. The present invention may also be embodied as an apparatus or device program for carrying out a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (18)

1. The query processing method is applied to a distributed query system, and is characterized in that the distributed query system comprises: at least one query processing server, wherein the query processing server comprises at least one central server, the query processing server corresponds to a database, and the method comprises the following steps:
the query processing server acquires a corresponding first query rate threshold value;
the query processing server counts the query rate of receiving the query request in a preset time period;
when the query rate is greater than or equal to the first query rate threshold value, the query processing server receives a first query request issued by the central server and refuses to receive second query requests issued by other query processing servers except the central server;
and the query processing server queries corresponding data from a corresponding database according to the first query request.
2. The method of claim 1, wherein the step of obtaining the corresponding first query rate threshold comprises:
and reading a corresponding first query rate threshold value from a preset strategy chain of the query processing server.
3. The method of claim 2, wherein the distributed query system further comprises a registration server, and before the step of reading the corresponding first query rate threshold from the preset policy chain of the query processing server, the method further comprises:
receiving a first query rate threshold value aiming at the query processing server and issued by the registration server;
and adding the first query rate threshold of the query processing server into the policy chain according to the preset priority of the first query rate threshold.
4. The method of claim 1, wherein the central server is configured to: and when the sum of the query rates of the query processing servers is greater than or equal to a second query rate threshold of the distributed query system, stopping issuing the first query request to the query processing servers, wherein the second query rate threshold is obtained from the registration server.
5. A method for determining a query rate threshold is applied to a distributed query system, and the distributed query system comprises: the method comprises the following steps that a registration server and at least one query processing server are adopted, the query processing server comprises at least one central server, the query processing server corresponds to a database, and the method comprises the following steps:
the registration server determines a second query rate threshold of the distributed query system and the weight of each query processing server;
the registration server determines a first query rate threshold of each query processing server according to the second query rate threshold and the weight of each query processing server;
the registration server issues the first query rate threshold to each corresponding query processing server; each query processing server is used for counting the query rate of receiving the query request in a preset time period; and when the query rate is greater than or equal to a first query rate threshold corresponding to the query processing server, receiving a first query request issued by the central server, and querying corresponding data from a corresponding database according to the first query request.
6. The method of claim 5, wherein the step of determining the first query rate threshold for each query processing server according to the second query rate threshold and the weight of each query processing server comprises:
determining an early warning threshold according to the second query rate threshold, wherein the early warning threshold is smaller than the second query rate threshold;
calculating the sum of the weights of all the query processing servers to obtain a total weight;
aiming at each query processing server, calculating the ratio of the weight of each query processing server to the total weight to obtain a corresponding weight parameter;
and aiming at each query processing server, calculating the product of the early warning threshold and the weight parameter of each query processing server to obtain a corresponding first query rate threshold.
7. The method of claim 5, wherein the step of determining the first query rate threshold for each query processing server according to the second query rate threshold and the weight of each query processing server comprises:
determining a root node server in the distributed query system and at least one target server directly interacting with the root node server;
preferentially determining a second query rate threshold of the root node server and at least one target server according to the first query rate threshold and the weight of each query processing server;
subtracting the first query rate threshold of the root node server and at least one target server from the second query rate threshold to obtain a residual query rate threshold;
and determining a first query rate threshold of the remaining query processing servers in the distributed query system according to the remaining query rate threshold and the weight of each query processing server, wherein the remaining query processing servers comprise the root node server and other query processing servers except for at least one target server.
8. A distributed query system, the distributed query system comprising: the system comprises a registration server and at least one query processing server, wherein the query processing server comprises at least one central server, corresponds to a database and is used for acquiring a corresponding first query rate threshold; counting the query rate of receiving the query request in a preset time period; when the query rate is greater than or equal to the first query rate threshold, receiving a first query request issued by the central server, and refusing to receive second query requests issued by other query processing servers except the central server; and inquiring corresponding data from the corresponding database according to the first inquiry request.
9. The system of claim 8, wherein the query processing server is further configured to: and reading a corresponding first query rate threshold value from a preset strategy chain of the query processing server.
10. The system of claim 9, wherein the distributed query system further comprises a registration server, and wherein the query processing server is further configured to: receiving a first query rate threshold value aiming at the query processing server and issued by the registration server; and adding the first query rate threshold of the query processing server into the policy chain according to the preset priority of the first query rate threshold.
11. The system of claim 8, wherein the central server is configured to: and when the sum of the query rates of the query processing servers is greater than or equal to a second query rate threshold of the distributed query system, stopping issuing the first query request to the query processing servers, wherein the second query rate threshold is obtained from the registration server.
12. The system of claim 8, wherein the registration server is configured to: determining a second query rate threshold of the distributed query system and the weight of each query processing server; determining a first query rate threshold of each query processing server according to the second query rate threshold and the weight of each query processing server; issuing the first query rate threshold to each corresponding query processing server; each query processing server is used for counting the query rate of receiving the query request in a preset time period; and when the query rate is greater than or equal to a first query rate threshold corresponding to the query processing server, receiving a first query request issued by the central server, and querying corresponding data from a corresponding database according to the first query request.
13. The system of claim 8, wherein the registration server is further configured to: determining an early warning threshold according to the second query rate threshold, wherein the early warning threshold is smaller than the second query rate threshold; calculating the sum of the weights of all the query processing servers to obtain a total weight; aiming at each query processing server, calculating the ratio of the weight of each query processing server to the total weight to obtain a corresponding weight parameter; and aiming at each query processing server, calculating the product of the early warning threshold and the weight parameter of each query processing server to obtain a corresponding first query rate threshold.
14. The system of claim 8, wherein the registration server is further configured to: determining a root node server in the distributed query system and at least one target server directly interacting with the root node server; and preferentially determining a second query rate threshold of the root node server and at least one target server according to the first query rate threshold and the weight of each query processing server.
15. An electronic device, comprising:
processor, memory and computer program stored on the memory and executable on the processor, characterized in that the processor implements the query processing method according to one or more of claims 1-5 when executing the program.
16. An electronic device, comprising:
processor, memory and computer program stored on the memory and executable on the processor, characterized in that the processor implements the method for determining a query rate threshold as claimed in one or more of claims 6-8 when executing the program.
17. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the query processing method according to one or more of method claims 1-5.
18. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of determining a query rate threshold as claimed in one or more of method claims 6-8.
CN201810530917.0A 2018-05-29 2018-05-29 Query processing and query rate threshold determination method and distributed query system Active CN110609855B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810530917.0A CN110609855B (en) 2018-05-29 2018-05-29 Query processing and query rate threshold determination method and distributed query system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810530917.0A CN110609855B (en) 2018-05-29 2018-05-29 Query processing and query rate threshold determination method and distributed query system

Publications (2)

Publication Number Publication Date
CN110609855A true CN110609855A (en) 2019-12-24
CN110609855B CN110609855B (en) 2021-06-04

Family

ID=68887864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810530917.0A Active CN110609855B (en) 2018-05-29 2018-05-29 Query processing and query rate threshold determination method and distributed query system

Country Status (1)

Country Link
CN (1) CN110609855B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111291252A (en) * 2020-02-21 2020-06-16 北京奇艺世纪科技有限公司 Method and device for adjusting query rate per second, electronic equipment and storage medium
CN113765969A (en) * 2020-09-28 2021-12-07 北京沃东天骏信息技术有限公司 Flow control method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070162558A1 (en) * 2006-01-12 2007-07-12 International Business Machines Corporation Method, apparatus and program product for remotely restoring a non-responsive computing system
CN105610934A (en) * 2015-12-25 2016-05-25 北京奇虎科技有限公司 Data request concurrency processing method and apparatus
CN106170016A (en) * 2016-07-28 2016-11-30 深圳市创梦天地科技有限公司 A kind of method and system processing high concurrent data requests
CN107402810A (en) * 2016-05-20 2017-11-28 阿里巴巴集团控股有限公司 Thread distribution method and device
CN108023936A (en) * 2017-11-07 2018-05-11 深圳市天下房仓科技有限公司 A kind of distributed interface access control method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070162558A1 (en) * 2006-01-12 2007-07-12 International Business Machines Corporation Method, apparatus and program product for remotely restoring a non-responsive computing system
CN105610934A (en) * 2015-12-25 2016-05-25 北京奇虎科技有限公司 Data request concurrency processing method and apparatus
CN107402810A (en) * 2016-05-20 2017-11-28 阿里巴巴集团控股有限公司 Thread distribution method and device
CN106170016A (en) * 2016-07-28 2016-11-30 深圳市创梦天地科技有限公司 A kind of method and system processing high concurrent data requests
CN108023936A (en) * 2017-11-07 2018-05-11 深圳市天下房仓科技有限公司 A kind of distributed interface access control method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111291252A (en) * 2020-02-21 2020-06-16 北京奇艺世纪科技有限公司 Method and device for adjusting query rate per second, electronic equipment and storage medium
CN111291252B (en) * 2020-02-21 2024-03-08 北京奇艺世纪科技有限公司 Method and device for adjusting query rate per second, electronic equipment and storage medium
CN113765969A (en) * 2020-09-28 2021-12-07 北京沃东天骏信息技术有限公司 Flow control method and device

Also Published As

Publication number Publication date
CN110609855B (en) 2021-06-04

Similar Documents

Publication Publication Date Title
CN107464117B (en) Block chain based data management method and block chain system
CN108427705A (en) Electronic device, distributed system journal querying method and storage medium
US20160267501A1 (en) Calculation method and apparatus for user retention ratio
CN114157666B (en) Load balancing system, method, medium and device based on intelligent cloud platform
CN111262795B (en) Service interface-based current limiting method and device, electronic equipment and storage medium
CN109117275B (en) Account checking method and device based on data slicing, computer equipment and storage medium
CN110609855B (en) Query processing and query rate threshold determination method and distributed query system
CN106130972B (en) resource access control method and device
CN106997546A (en) A kind of order processing method and device
CN108595254A (en) A kind of query scheduling method
CN109360042A (en) Order allocation method, device, electronic equipment and storage medium
CN106657399B (en) Background server selection method and device based on middleware
CN106936877A (en) A kind of content distribution method, apparatus and system
WO2019174185A1 (en) Electronic device, dynamic code request processing method and storage medium
CN109885384B (en) Task parallelism optimization method and device, computer equipment and storage medium
CN111159131A (en) Performance optimization method, device, equipment and computer readable storage medium
CN111311310B (en) Advertisement order pushing method and device, storage medium and electronic device
CN106530084B (en) Information processing method and server
CN104166596B (en) A kind of memory allocation method and node
CN110634086B (en) Beverage order processing method, server and storage medium
CN111008071A (en) Task scheduling system, method and server
CN106874336B (en) Data matching method, data query method and device
CN110069340B (en) Thread number evaluation method and device
CN112003900B (en) Method and system for realizing high service availability under high-load scene in distributed system
CN110232590B (en) Scheme generation method and equipment

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