CN-115455045-B - Control method and device for database query request and electronic equipment
Abstract
The application discloses a control method and device for database query requests and electronic equipment, wherein the method comprises the steps of at least once adjusting an estimated pressure value of the database query request according to any database query request in a request queue, and executing the query request if a second judgment value determined based on the adjusted estimated pressure value and a current database system pressure value meets the first preset condition and the duration of the database query request in the request queue does not exceed the waiting duration. The database can be guaranteed to provide optimal performance and throughput over a normal pressure load range.
Inventors
- HE FAN
- ZHU LINHAO
- ZHOU MINGWEI
Assignees
- 浙江大华技术股份有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20220922
Claims (8)
- 1. A method for controlling a database query request, the method comprising: The method comprises the steps of carrying out adjustment on the estimated pressure value of a database query request for any one database query request in a request queue for at least one time, wherein the request queue comprises a database query request which is not executed, the database query request contained in the request queue is added after a first judgment value determined by the estimated pressure value corresponding to the database query request and the currently acquired database system pressure value meets a first preset condition, and the adjustment mode when the estimated pressure value of the database query request is adjusted each time is as follows, if the number of query requests in the current request queue and the current database system pressure value meet a second preset condition, the estimated pressure value of the database query request is reduced based on a first coefficient, and if the number of query requests in the current request queue and the current database system pressure value do not meet the second preset condition, the estimated pressure value of the database query request is increased based on a second coefficient; and if the second judgment value determined based on the adjusted estimated pressure value and the current database system pressure value meets the first preset condition and the duration of the database query request in the request queue does not exceed the waiting duration, executing the query request.
- 2. The method of claim 1, wherein the second preset condition comprises: The number of query requests in the current request queue is greater than a preset request threshold and the current database system pressure value is less than the preset pressure threshold.
- 3. The method of claim 1, wherein the at least one adjustment to the predicted pressure value of the database query request is performed for any database query request in the request queue, further comprising: And aiming at any database query request in the request queue, if the number of the query requests in the current request queue is smaller than a preset waiting threshold value and/or the current database system pressure value is equal to a preset pressure threshold value, ending adjusting the estimated pressure value of the database query request.
- 4. A method according to any one of claims 1-3, wherein the estimated pressure value of the database query request is determined by: And determining the estimated pressure value of the database query request based on the request condition of the database query request, the ratio of the data volume of the target table in the database query request to the total data volume of the database and the query type pressure value of the database query request.
- 5. A method according to any one of claims 1-3, wherein the database system pressure value is determined by: And determining the pressure value of the database system based on the system load and the utilization rate of the database CPU.
- 6. A control device for a database query request, the device comprising: the system comprises a database query request, a predicted pressure value adjustment module for query requests, a first preset condition and a second preset condition, wherein the predicted pressure value adjustment module is used for adjusting the predicted pressure value of the database query request at least once for any database query request in a request queue, wherein the request queue comprises a non-executed database query request, the database query request is added after a first judgment value determined by the predicted pressure value corresponding to the database query request and the currently acquired database system pressure value meets the first preset condition, and the adjustment mode of each time for adjusting the predicted pressure value of the database query request is as follows, if the number of the current query requests in the request queue and the current database system pressure value meet the second preset condition, the predicted pressure value of the database query request is reduced based on the first coefficient, and if the number of the query requests in the current request queue and the current database system pressure value do not meet the second preset condition, the predicted pressure value of the database query request is increased based on the second coefficient; And the query request execution module is used for executing the query request if the second judgment value determined based on the adjusted estimated pressure value and the current database system pressure value meets the first preset condition and the duration of the database query request in the request queue does not exceed the waiting duration.
- 7. An electronic device comprising at least one processor, and a memory communicatively coupled to the at least one processor, wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
- 8. A computer storage medium, characterized in that the computer storage medium stores a computer program for causing a computer to perform the method according to any one of claims 1-5.
Description
Control method and device for database query request and electronic equipment Technical Field The present invention relates to the field of data management technologies, and in particular, to a method and an apparatus for controlling a database query request, and an electronic device. Background In the database query or access flow control mechanism of the present stage, in the use scenario of high concurrent user query access, the sudden increase of system pressure may only occur within 5 seconds, at which time the peak of the flow of query access is just reached, while in the next period of time, the system pressure may not be so great, and in fact, most of the time processing capacity of the system is allowance. And according to the system operation index in the 5s, judging that the database inquiry access request exceeds the threshold value, and further rejecting the subsequent inquiry access request, the situation that the subsequent system pressure is not large, but inquiry access is rejected is shown, and the root cause is that the hysteresis of system pressure acquisition is not matched with the pressure brought by the real-time inquiry access request, so that the accuracy of the determined system pressure value is lower in the current database inquiry or access flow control mechanism, and the control mechanism is greatly influenced. Disclosure of Invention The application aims to provide a control method and device for a database query request and electronic equipment. The method and the device are used for solving the problems that in the existing database query or access flow control mechanism, the accuracy of the determined system pressure value is low, and the control mechanism is greatly affected. In a first aspect, an embodiment of the present application provides a temperature prediction model training method, where the method includes: The method comprises the steps of carrying out at least one adjustment on the estimated pressure value of a database query request aiming at any database query request in a request queue, wherein the request queue comprises unexecuted database query requests, the database query requests included in the request queue are added after a first judgment value determined by the estimated pressure value corresponding to the database query request and the currently acquired database system pressure value meet a first preset condition, and each time the estimated pressure value of the database query request is adjusted, the estimated pressure value of the database query request is adjusted based on the current query request quantity in the request queue and the current database system pressure value; and if the second judgment value determined based on the adjusted estimated pressure value and the current database system pressure value meets the first preset condition and the duration of the database query request in the request queue does not exceed the waiting duration, executing the query request. In some possible embodiments, the first preset condition includes: and the sum of the estimated pressure value corresponding to the database query request and the currently acquired pressure value of the database system is larger than a preset threshold value. In some possible embodiments, adjusting the estimated pressure value of the database query request based on the current number of query requests in the request queue and the current database system pressure value includes: If the number of the query requests in the current request queue and the current database system pressure value meet a second preset condition, reducing the estimated pressure value of the database query request based on a first coefficient; and if the number of the query requests in the current request queue and the current database system pressure value do not meet the second preset condition, increasing the estimated pressure value of the database query request based on a second coefficient. In some possible embodiments, the second preset condition includes: The number of query requests in the current request queue is greater than a preset request threshold and the current database system pressure value is less than the preset pressure threshold. In some possible embodiments, for any one database query request in the request queue, adjusting the estimated pressure value of the database query request at least once further includes: And aiming at any database query request in the request queue, if the number of the query requests in the current request queue is smaller than a preset waiting threshold value and/or the current database system pressure value is equal to a preset pressure threshold value, ending adjusting the estimated pressure value of the database query request. In some possible embodiments, the estimated pressure value of the database query request is determined by: And determining the estimated pressure value of the database query request based on the request condition of the dat