Business request processing method, controller, electronic device, and storage medium

CN117768398BActive Publication Date: 2026-11-03CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311608254.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-28
Publication Date
2026-11-03
Estimated Expiration
2043-11-28

AI Technical Summary

Technical Problem

In a private cloud physical deployment environment, database performance degrades when business requests are concentrated, leading to reduced stability of core business operations and impacting user experience. Existing technologies cannot effectively solve the database performance bottleneck and the need for immediate processing of business requests.

Method used

The design includes an interface module, a scoring calculation module, a flow control execution module, and a sidecar data collection module. By scoring business requests, the execution priority is determined, and database traffic is adjusted in rate-limiting mode to achieve business traffic distribution and stability management.

Benefits of technology

It improved the stability of the database and the efficiency of business processing, ensuring that important business can be processed in a timely manner, reducing database response timeouts and connection limit issues, and enhancing the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117768398B_ABST
    Figure CN117768398B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a kind of service request processing method, controller, electronic equipment and storage medium, it is related to cloud computing technical field, the method comprises: receiving the service request sent by user terminal, and obtain the service parameter corresponding to the service request;The state parameter of the database is collected by the edge car collection module, and whether the flow management mode is switched to the flow limiting mode is judged according to the state parameter;In response to the flow management mode being switched to the flow limiting mode, the service request is scored according to the service parameter, and the execution priority score of the service request is obtained;According to the execution priority score, the service request is sent to the database in order of high and low, so that the database executes the service operation corresponding to the service request, realizes service shunting, is conducive to guaranteeing the stability of database operation, so that the database can stably accept service, improve the efficiency of service acceptance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of cloud computing technology, and in particular to a method for processing business requests, a business controller, an electronic device, and a computer-readable storage medium. Background Technology

[0002] As a core system of telecom operators, the service center encompasses dozens of business scenarios, including package inquiries, new number installations, product modifications, service suspension / reactivation, contracts, optional packages, product cancellations, disconnections, and account transfers. With increasingly complex business scenarios, database operations are also increasing. During peak periods of business processing at the mid-month and end-of-month, database performance easily reaches its bottleneck, leading to overall service lag and crashes. However, critical business scenarios such as new installations, contracts, and account transfers often require immediate processing to avoid impacting user experience. In a private cloud physical deployment environment, the database itself lacks the capacity for horizontal and vertical scaling. This results in degraded database performance or even unavailability for existing network services, reduced stability of core services, and a rapid increase in database traffic pressure during peak service requests. Exceeding connection limits and causing database timeouts further hinders core service processing, prolongs processing times, and leads to a poor user experience. Summary of the Invention

[0003] The present invention provides a method for processing business requests, a controller, an electronic device, and a computer-readable storage medium to solve or partially solve the problem of low efficiency in business processing.

[0004] This invention discloses a method for processing business requests, applied to a business controller. The business controller includes at least an interface module, a scoring calculation module connected to the interface module, a flow control execution module connected to the scoring calculation module, and a sidecar data collection module connected to the flow control execution module. The business controller connects to a database through the sidecar data collection module. The method includes:

[0005] The interface module receives a service request sent by the user terminal and obtains the service parameters corresponding to the service request.

[0006] The flow control execution module obtains the status parameters of the database collected by the side vehicle acquisition module, and determines whether to switch the flow management mode to the flow limiting mode based on the status parameters.

[0007] In response to the traffic management mode switching to the rate limiting mode, the scoring calculation module scores the service request according to the service parameters to obtain the execution priority score of the service request.

[0008] The flow control execution module sends the business request to the database according to the execution priority score, so that the database executes the business operation corresponding to the business request.

[0009] In some feasible implementations, the business parameters include at least hardware parameters and business processing parameters. The step of determining whether to switch the traffic management mode to rate limiting mode based on the status parameters includes:

[0010] The hardware parameters are used to perform a hardware score on the database to obtain a hardware score, which is used to evaluate the hardware load of the database.

[0011] The database is scored using the business processing parameters to obtain a status score, which is used to assess the business processing load of the database.

[0012] The database is scored using the hardware score and the status score to obtain a resource score, which is used to evaluate the overall resource optimism of the database.

[0013] If the resource score is greater than or equal to the preset load threshold, the traffic management mode will be switched to the rate limiting mode.

[0014] If the resource score is less than the preset load threshold, the normal polling mode is maintained.

[0015] In some feasible implementations, the hardware parameters include at least CPU resource usage, memory resource usage, and storage resource usage. The step of using these hardware parameters to perform a hardware score on the database and obtain a hardware score includes:

[0016] The CPU resource score is obtained by calculating the CPU resource usage and available CPU resources.

[0017] The memory resource score is obtained by calculating the memory usage and available memory resources.

[0018] The storage resource score is obtained by calculating the storage resources occupied and the storage resources available.

[0019] The database is scored using the CPU resource score, the memory resource score, and the storage resource score to obtain a hardware score.

[0020] In some feasible implementations, the business request is an SQL statement, and the step of scoring the business request based on the business parameters to obtain the execution priority score of the business request includes:

[0021] Obtain the statement content of the SQL statement;

[0022] Calculate the statement complexity of the SQL statement using the content of the statement;

[0023] The business parameters are used to score the business request to obtain the business priority score corresponding to the business request.

[0024] The execution priority score of the business request is obtained by calculating the statement complexity and the business priority score.

[0025] In some feasible implementations, the statement content includes at least the number of tables, statement length, number of keywords, number of join operations, and number of subqueries. Calculating the statement complexity of the SQL statement using the statement content includes:

[0026] The statement complexity of the SQL statement is calculated according to a preset scoring rule, using one of the following: the number of tables, the statement length, the number of keywords, the number of join operations, and the number of subqueries.

[0027] In some feasible implementations, the preset scoring rules include at least:

[0028] Regarding the number of tables: Each SQL statement is assigned a fixed score. For SQL statements with more than one table, the complexity score increases by 0.2 points for each additional table, up to a maximum of 3 points.

[0029] Regarding statement length: If the number of characters in the SQL statement is less than 500, the complexity score is 0.4. For every additional 300 characters, the complexity score increases by 0.2, with a maximum of 3.

[0030] Regarding the number of keywords: If the number of keywords in the SQL statement is less than 30, the complexity score is 0.2 points. For every additional 30 keywords, the complexity score increases by 0.1 points, with a maximum of 1 point.

[0031] Regarding the number of connection operations: one connection operation corresponds to 0.2 points, with a maximum of 2 points;

[0032] Regarding the number of subqueries: one subquery corresponds to 0.2 points, with a maximum of 2 points.

[0033] In some feasible implementations, the business parameters include at least a business importance score, a business periodicity score, and a business strategy. The business importance score characterizes the importance of the business corresponding to the business request, the business periodicity score characterizes the importance of the business at the current time, and the business strategy characterizes whether the business has the highest execution priority at the current time. The step of using the business parameters to score the business request and obtain the business priority score corresponding to the business request includes:

[0034] If the business strategy indicates that the business corresponding to the business request is not currently the highest execution priority, then the business request is scored using the real-time business importance score and the real-time business periodicity score to obtain the business priority score corresponding to the business request.

[0035] If the business strategy indicates that the business corresponding to the business request currently has the highest execution priority, then the real-time business importance score is adjusted to the specified business importance score, and the real-time business periodicity score is adjusted to the specified business periodicity score. The business request is then scored using the specified business importance score and the specified business periodicity score to obtain the business priority score corresponding to the business request.

[0036] This invention also discloses a service controller, which includes at least an interface module, a scoring calculation module connected to the interface module, a flow control execution module connected to the scoring calculation module, and a sidecar data acquisition module connected to the flow control execution module; wherein, the service controller connects to a database through the sidecar data acquisition module; and wherein,

[0037] The interface module is used to receive service requests sent by user terminals and obtain the service parameters corresponding to the service requests.

[0038] The flow control execution module is used to obtain the status parameters of the database collected by the side vehicle acquisition module, and determine whether to switch the flow management mode to the flow limiting mode based on the status parameters.

[0039] The scoring calculation module is used to score the service request according to the service parameters in response to the traffic management mode switching to the rate limiting mode, and obtain the execution priority score of the service request.

[0040] The flow control execution module is used to send the business request to the database according to the execution priority score, so that the database can execute the business operation corresponding to the business request.

[0041] In some feasible implementations, the business parameters include at least hardware parameters and business processing parameters, and the flow control execution module is specifically used for:

[0042] The hardware parameters are used to perform a hardware score on the database to obtain a hardware score, which is used to evaluate the hardware load of the database.

[0043] The database is scored using the business processing parameters to obtain a status score, which is used to assess the business processing load of the database.

[0044] The database is scored using the hardware score and the status score to obtain a resource score, which is used to evaluate the overall resource optimism of the database.

[0045] If the resource score is greater than or equal to the preset load threshold, the traffic management mode will be switched to the rate limiting mode.

[0046] If the resource score is less than the preset load threshold, the normal polling mode is maintained.

[0047] In some feasible implementations, the hardware parameters include at least CPU resource usage, memory resource usage, and storage resource usage, and the flow control execution module is specifically used for:

[0048] The CPU resource score is obtained by calculating the CPU resource usage and available CPU resources.

[0049] The memory resource score is obtained by calculating the memory usage and available memory resources.

[0050] The storage resource score is obtained by calculating the storage resources occupied and the storage resources available.

[0051] The database is scored using the CPU resource score, the memory resource score, and the storage resource score to obtain a hardware score.

[0052] In some feasible implementations, the business request is an SQL statement, and the scoring calculation module is specifically used for:

[0053] Obtain the statement content of the SQL statement;

[0054] Calculate the statement complexity of the SQL statement using the content of the statement;

[0055] The business parameters are used to score the business request to obtain the business priority score corresponding to the business request.

[0056] The execution priority score of the business request is obtained by calculating the statement complexity and the business priority score.

[0057] In some feasible implementations, the statement content includes at least the number of tables, statement length, number of keywords, number of join operations, and number of subqueries. The scoring calculation module is specifically used for:

[0058] The statement complexity of the SQL statement is calculated according to a preset scoring rule, using one of the following: the number of tables, the statement length, the number of keywords, the number of join operations, and the number of subqueries.

[0059] In some feasible implementations, the preset scoring rules include at least:

[0060] Regarding the number of tables: Each SQL statement is assigned a fixed score. For SQL statements with more than one table, the complexity score increases by 0.2 points for each additional table, up to a maximum of 3 points.

[0061] Regarding statement length: If the number of characters in the SQL statement is less than 500, the complexity score is 0.4. For every additional 300 characters, the complexity score increases by 0.2, with a maximum of 3.

[0062] Regarding the number of keywords: If the number of keywords in the SQL statement is less than 30, the complexity score is 0.2 points. For every additional 30 keywords, the complexity score increases by 0.1 points, with a maximum of 1 point.

[0063] Regarding the number of connection operations: one connection operation corresponds to 0.2 points, with a maximum of 2 points;

[0064] Regarding the number of subqueries: one subquery corresponds to 0.2 points, with a maximum of 2 points.

[0065] In some feasible implementations, the business parameters include at least a business importance score, a business periodicity score, and a business strategy. The business importance score characterizes the importance of the business corresponding to the business request, the business periodicity score characterizes the importance of the business at the current time, and the business strategy characterizes whether the business has the highest execution priority at the current time. The scoring calculation module is specifically used for:

[0066] If the business strategy indicates that the business corresponding to the business request is not currently the highest execution priority, then the business request is scored using the real-time business importance score and the real-time business periodicity score to obtain the business priority score corresponding to the business request.

[0067] If the business strategy indicates that the business corresponding to the business request currently has the highest execution priority, then the real-time business importance score is adjusted to the specified business importance score, and the real-time business periodicity score is adjusted to the specified business periodicity score. The business request is then scored using the specified business importance score and the specified business periodicity score to obtain the business priority score corresponding to the business request.

[0068] This invention also discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0069] The memory is used to store computer programs;

[0070] When the processor executes a program stored in the memory, it implements the method described in the embodiments of the present invention.

[0071] This invention also discloses a computer-readable storage medium storing instructions that, when executed by one or more processors, cause the processors to perform the methods described in this invention.

[0072] The embodiments of the present invention have the following advantages:

[0073] In this embodiment of the invention, a service controller is designed, comprising at least an interface module, a scoring calculation module, a flow control execution module, and a sidecar data collection module. When a user terminal initiates a corresponding service request, the interface module receives the service request sent by the user terminal and obtains the service parameters corresponding to the service request. Then, the flow control execution module obtains the database status parameters collected by the sidecar data collection module and determines whether to switch the traffic management mode to a rate-limiting mode based on the status parameters. Managing the traffic management mode through the database status parameters ensures the stability of the database, enabling the database to effectively respond to service requests. Correspondingly, the scoring calculation module... In response to the switch from traffic management mode to rate limiting mode, the block responds by scoring business requests based on business parameters to obtain an execution priority score. Then, the flow control execution module sends the business requests to the database in descending order of execution priority scores, so that the database can execute the business operations corresponding to the business requests. Thus, after switching traffic management mode, the business requests are further scored based on business parameters to determine the execution priority. This allows the database to process business requests sequentially based on execution priority, achieving business flow distribution. This further helps to ensure the stability of database operation, enabling the database to reliably handle business and improve the efficiency of business processing. Attached Figure Description

[0074] Figure 1 This is a flowchart of the steps of a service request processing method provided in an embodiment of the present invention;

[0075] Figure 2 This is a schematic diagram of the communication architecture of the service controller provided in this embodiment of the invention;

[0076] Figure 3 This is a schematic diagram of the business processing provided in the embodiments of the present invention;

[0077] Figure 4 This is a schematic diagram of the structure of a service controller provided in an embodiment of the present invention;

[0078] Figure 5 This is a block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0079] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0080] As an example, the service center, as a core system of a telecom operator, can provide users with dozens of business scenarios, including package inquiries, new number installations, product modifications, service suspension and resumption, contracts, optional packages, product cancellations, disconnections, and account transfers. Furthermore, as these business scenarios become increasingly complex, database operations also increase. During peak periods of business processing at the mid-month and end-of-month, database performance easily reaches its bottleneck, leading to overall service lag and crashes. However, key business scenarios such as new installations, contracts, and account transfers often require immediate processing to avoid impacting user experience. In a private cloud physical deployment environment, the database itself lacks the capacity for horizontal and vertical scaling. This results in degraded database performance or even unavailability for existing network services, reduced stability of core services, and a rapid increase in database traffic pressure during peak service requests. Exceeding connection limits and causing database timeouts further hinders core service processing, prolongs processing times, and leads to a poor user experience.

[0081] In response, this invention designs a business controller that includes at least an interface module, a scoring calculation module, a flow control execution module, and a sidecar acquisition module. By scoring business requests, with higher scores indicating higher execution priority, the system adjusts database traffic based on a scoring strategy, increasing application flexibility, improving database stability, and reducing labor costs. Specifically, when a user terminal initiates a corresponding business request, the interface module receives the request and obtains the corresponding business parameters. Then, the flow control execution module obtains the database status parameters collected by the sidecar acquisition module and determines whether to switch the traffic management mode to rate limiting mode based on these parameters. Managing the traffic management mode through the database status parameters ensures database stability and enables the database to effectively respond to business requests. Correspondingly, in response to the traffic management mode switching to rate limiting mode, the scoring module scores the business requests based on the business parameters to obtain their execution priority scores. The flow control execution module then sends the business requests to the database in descending order of execution priority scores, allowing the database to execute the corresponding business operations. Thus, after switching the traffic management mode, further scoring of business requests based on business parameters determines their execution priority, enabling the database to process requests sequentially based on execution priority. This achieves business flow distribution, further ensuring database stability and improving the efficiency of business processing.

[0082] Reference Figure 1 This diagram illustrates a flowchart of a business request processing method provided in an embodiment of the present invention. The method is applied to a business controller, which includes at least an interface module, a scoring calculation module connected to the interface module, a flow control execution module connected to the scoring calculation module, and a sidecar data acquisition module connected to the flow control execution module. The business controller connects to a database through the sidecar data acquisition module, and the specific steps may include the following:

[0083] Step 101: The interface module receives a service request sent by the user terminal and obtains the service parameters corresponding to the service request.

[0084] In this embodiment of the invention, when a user wants to conduct a certain service, they can initiate a service request through an application deployed on the user's terminal. The user terminal can then send the service request to the service center, where the service center will process the request accordingly. The service center may include a service controller and a database, etc. The service controller is responsible for processing the service request, and the database is responsible for providing the corresponding data in response to the service request. Optionally, the service center may be a server deployed in the cloud, etc.

[0085] In its implementation, the business controller includes at least an interface module, a scoring calculation module connected to the interface module, a flow control execution module connected to the scoring calculation module, and a sidecar data acquisition module connected to the flow control execution module. The interface module receives business requests sent to the service center and records the corresponding business parameters (e.g., business type, importance level, periodic characteristics, special safeguards, etc.) to score the business requests based on these parameters. The scoring unit scores the business requests based on the business parameters, enabling database traffic scheduling based on the scoring strategy. The sidecar data acquisition module collects database status parameters and sends them to the flow control execution module, which manages database traffic based on these parameters to adjust database traffic in real time and ensure stable database operation.

[0086] Specifically, when a user terminal sends a service request to the service center, the interface module of the service controller can receive the service request and obtain the corresponding service parameters. This allows the service controller to respond to the service request and score it based on the service parameters, thereby achieving traffic control over the database. The interface module can be an interface configured according to a corresponding communication protocol; for example, it can be designed according to the standard TDI (Telecom Database Interface) protocol. This invention does not impose any limitations on this.

[0087] In one example, refer to Figure 2 The diagram illustrates the communication architecture of the business controller provided in this embodiment of the invention. The business controller (also known as the controller) may include a scoring calculation module and a flow control execution module. The scoring calculation module is responsible for calculating SQL complexity records and is connected to multiple northbound interfaces (TDI) (i.e., connected to the interface module). Correspondingly, the flow control execution module can connect to the sidecar monitor to obtain the status parameters collected by the sidecar monitor from the database. Furthermore, the flow control execution module can send corresponding SQL execution requests to the database so that the database can respond to the business requests.

[0088] Step 102: The flow control execution module obtains the status parameters of the database collected by the side vehicle acquisition module, and determines whether to switch the flow management mode to the flow limiting mode based on the status parameters.

[0089] In this embodiment of the invention, the sidecar acquisition module can collect database status parameters in real time and send these parameters to the flow control execution module. This allows the flow control execution module to monitor the database's resource usage based on the status parameters in real time, and determine whether to manage the traffic flow based on the monitoring results. The traffic flow management mode can include a rate-limiting mode and a regular polling mode. In the regular polling mode, the database in the processing center responds to each business request according to its initiation time. In the rate-limiting mode, the database responds to business requests based on their execution priority, prioritizing higher-priority requests under resource constraints to ensure the normal response of important services.

[0090] In some feasible implementations, the business parameters include at least hardware parameters and business processing parameters. The flow control execution module can use the hardware parameters to perform a hardware score on the database, obtaining a hardware score, which is used to assess the hardware load of the database. It can also use the business processing parameters to perform a status score on the database, obtaining a status score, which is used to assess the business processing load of the database. Then, it can use the hardware score and status score to perform a resource score on the database, obtaining a resource score, which is used to assess the overall resource optimism of the database. If the resource score is greater than or equal to a preset load threshold, the traffic management mode is switched to the rate limiting mode; if the resource score is less than the preset load threshold, the normal polling mode is maintained.

[0091] In a specific implementation, the hardware parameters include at least CPU resource usage, memory resource usage, and storage resource usage. The flow control execution module can use the CPU resource usage and available CPU resources to calculate a CPU resource score, use the memory resource usage and available memory resources to calculate a memory resource score, and use the storage resource usage and available storage resources to calculate a storage resource score. Then, the CPU resource score, the memory resource score, and the storage resource score are used to perform a hardware score on the database to obtain a hardware score.

[0092] In addition, business processing parameters can include at least the number of transactions per second (DPS), queries per second (MSD), and connections per second of the database. The number of DPS represents the number of business requests processed by the database per second; the number of MSD represents the number of query requests received by the database per second; and the number of connections can be the number of connections between the database and the flow control execution module, where one connection corresponds to processing one business request. Specifically, if the number of DPS, MSD, and connections are all less than or equal to a preset threshold, the corresponding status score is obtained; if at least one of these values ​​is greater than the preset threshold, a fixed score is obtained, and the corresponding status parameter is calculated using the fixed score and the number of business processing parameters whose values ​​are greater than the preset threshold.

[0093] In one example, assuming traffic management mode is being implemented, switching to rate limiting mode is triggered when loadbalance_score (resource score) ≥ 3. Specifically, analysis can be performed based on several dimensions, including the database's host hardware parameters and database metrics such as TPS (Transactions Per Second), QPS (Queries Per Second), and connection count. The scoring formula is as follows:

[0094] host_score=10-cpu((capacity-sum(requested))*10 / capacity)+memory((capacity-sum(requested))*10 / capacity)+storage((capacity-sum(requested))*10 / capacity) / 3

[0095] db_score=((tps / max_tps>0.8,1:0)or(qps / max_qps>0.8,1:0)or(connected / max_connect>0.8,1:0))*10

[0096] loadbalance_score=host_scroe*0.3+db_score*0.7

[0097] The calculation of the hardware score, host_score, includes the following steps: Calculating the CPU score: Calculate CPU utilization, which is (capacity - sum(requested)) * 10 / capacity. This represents the percentage of remaining CPU capacity out of the total capacity (dividing by the capacity and multiplying by 10 maps the percentage to a range of 0-10). Then, subtract this percentage from 10 to obtain the CPU score. Calculating the memory score: Similarly, calculate memory utilization, representing the percentage of remaining memory capacity out of the total capacity, and then multiply this percentage by 10 to obtain the memory score. Calculating the storage score: Similarly, calculate storage utilization, representing the percentage of remaining storage capacity out of the total capacity, and then multiply this percentage by 10 to obtain the storage score. Finally, add the CPU, memory, and storage scores together and divide by 3 to obtain the final host score, host_score.

[0098] The state score db_score is calculated by dividing TPS by the maximum TPS value; if the result is greater than 0.8, the score is 1, otherwise it is 0. Similarly, QPS is divided by the maximum QPS value; if the result is greater than 0.8, the score is 1, otherwise it is 0. The number of connections is divided by the maximum number of connections; if the result is greater than 0.8, the score is 1, otherwise it is 0. The sum of any one of these three conditions is then used to obtain a total score (a sum of 0s and 1s). Finally, the total score is multiplied by 10 to obtain the final score value.

[0099] For example: If the physical machine hosting the database has 100 available CPU resources and 15 already requested, then the CPU score is 8.5. If it has 100 available memory resources and 20 already requested, then the memory score is 8. If it has 100 available storage resources and 20 already requested, then the storage score is 8. Therefore, `host_score` = 1.83. Furthermore, since the database's TPS, QPS, and connection count are all below 80%, `db_score` = 0. Therefore, `loadbalance_score` = 1.83 * 0.3 + 0 = 0.549, and no failover is required. If at least one of TPS, QPS, or connection count exceeds 80%, then db_score = 1 * 10 = 10 points, and loadbalance_score = 1.83 * 0.3 + 10 * 0.7 = 7.549 points. It is necessary to switch the traffic management mode to rate limiting mode, so as to manage the traffic management mode through the database status parameters, ensure the stability of the database, and enable the database to respond effectively to business requests.

[0100] Step 103: In response to the traffic management mode switching to the rate limiting mode, the scoring calculation module scores the service request according to the service parameters to obtain the execution priority score of the service request.

[0101] In this embodiment of the invention, when the flow control execution module switches the traffic management mode to the rate limiting mode, the scoring calculation module responds to the switch by scoring the business requests according to the business parameters to obtain the execution priority score of the business requests. The execution priority score of each business request is then sent to the flow control execution module, which sends the business requests to the database in priority order to achieve traffic distribution.

[0102] In the specific implementation, the business request can be an SQL statement. The scoring calculation module can obtain the statement content of the SQL statement, then calculate the statement complexity of the SQL statement using the statement content, and then use business parameters to score the business request to obtain the corresponding business priority score. Finally, the execution priority score of the business request is calculated by combining the statement complexity and the business priority score. The statement content includes at least the number of tables, statement length, number of keywords, number of join operations, and number of subqueries. The scoring calculation module can then calculate the statement complexity of the SQL statement according to a preset scoring rule, using one of these factors: number of tables, statement length, number of keywords, number of join operations, or number of subqueries.

[0103] The preset scoring rules include at least the following:

[0104] Regarding the number of tables: Each SQL statement is assigned a fixed score. For SQL statements with more than one table, the complexity score increases by 0.2 points for each additional table, up to a maximum of 3 points.

[0105] Regarding statement length: If the number of characters in the SQL statement is less than 500, the complexity score is 0.4. For every additional 300 characters, the complexity score increases by 0.2, with a maximum of 3.

[0106] Regarding the number of keywords: If the number of keywords in the SQL statement is less than 30, the complexity score is 0.2 points. For every additional 30 keywords, the complexity score increases by 0.1 points, with a maximum of 1 point.

[0107] Regarding the number of connection operations: one connection operation corresponds to 0.2 points, with a maximum of 2 points;

[0108] Regarding the number of subqueries: one subquery corresponds to 0.2 points, with a maximum of 2 points.

[0109] In addition, the business parameters include at least a business importance score, a business periodicity score, and a business strategy. The business importance score represents the importance of the business corresponding to the business request, the business periodicity score represents the importance of the business at the current time, and the business strategy represents whether the business has the highest execution priority at the current time. The scoring calculation module can identify the business corresponding to the business request through the business strategy. If the business strategy indicates that the business corresponding to the business request is not currently the highest execution priority, the real-time business importance score and the real-time business periodicity score are used to score the business request to obtain the business priority score corresponding to the business request. If the business strategy indicates that the business corresponding to the business request is currently the highest execution priority, the real-time business importance score is adjusted to the specified business importance score, the real-time business periodicity score is adjusted to the specified business periodicity score, and the specified business importance score and the specified business periodicity score are used to score the business request to obtain the business priority score corresponding to the business request.

[0110] In one example, the complexity of a statement can be calculated as follows:

[0111] SELECT t1.column1, t2.column2

[0112] FROM table1 t1 JOIN table2 t2 ON t1.id=t2.id WHERE t1.category='A'AND t2.status='Active'AND t1.date>'2022-01-01'ORDER BY t1.date DESC LIMIT100;

[0113] The total score is: 10 - (1 (table quantity score) + 0.4 (statement length score) + 0.2 (keyword quantity score) + 0.2 (join operation score) + 0 (subquery score)) = 8.2 points.

[0114] Accordingly, the calculation method for business priority scores can be as follows:

[0115] business_score=business importance*business periodic

[0116] The business importance score is multiplied by the daily business cycle score to obtain a comprehensive score. This strategy reflects the trade-off between business importance and the time-based impact on business. For example, when database overload occurs at the end of the month, the time cycle characteristic of billing business is stronger than other important businesses. Each of these two metrics has a maximum score of 5 points, obtained from the TDI interface, while the business_score has a maximum of 25 points.

[0117] For example, if a business importance score is 3, and the impact of the day on the business score is 5, then the overall score is 15 (3*5).

[0118] The above process yields the corresponding statement complexity and business priority score. These two scores are then summed to obtain the execution priority score. The execution priority score for each business request is then sent to the flow control execution module so that the flow control execution module can process the business requests according to the execution priority score.

[0119] Step 104: The flow control execution module sends the business request to the database according to the execution priority score, so that the database executes the business operation corresponding to the business request.

[0120] In its implementation, the flow control execution module sends business requests to the database in descending order of execution priority scores, enabling the database to execute the business operations corresponding to the requests. After switching the traffic management mode, the module further scores the business requests based on business parameters to determine their execution priorities. This allows the database to process business requests sequentially based on their execution priorities, achieving business diversion. This further helps ensure the stability of the database operation, enabling the database to reliably handle business and improve the efficiency of business processing.

[0121] In this embodiment of the invention, a service controller is designed, comprising at least an interface module, a scoring calculation module, a flow control execution module, and a sidecar data collection module. When a user terminal initiates a corresponding service request, the interface module receives the service request sent by the user terminal and obtains the service parameters corresponding to the service request. Then, the flow control execution module obtains the database status parameters collected by the sidecar data collection module and determines whether to switch the traffic management mode to a rate-limiting mode based on the status parameters. Managing the traffic management mode through the database status parameters ensures the stability of the database, enabling the database to effectively respond to service requests. Correspondingly, the scoring calculation module... In response to the switch from traffic management mode to rate limiting mode, the block responds by scoring business requests based on business parameters to obtain an execution priority score. Then, the flow control execution module sends the business requests to the database in descending order of execution priority scores, so that the database can execute the business operations corresponding to the business requests. Thus, after switching traffic management mode, the business requests are further scored based on business parameters to determine the execution priority. This allows the database to process business requests sequentially based on execution priority, achieving business flow distribution. This further helps to ensure the stability of database operation, enabling the database to reliably handle business and improve the efficiency of business processing.

[0122] To enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, an example is provided below for illustration:

[0123] Reference Figure 3 The diagram illustrates a business processing flow provided in an embodiment of the present invention, including:

[0124] The TDI interface retrieves business SQL, business type, importance level, business cycle characteristics, and special business guarantee information. The flow control execution module then scores these requests based on database resource availability to determine if switching to the high-pressure core business guarantee mode (rate limiting mode) is necessary. If not, requests are executed sequentially by the executor. If a switch is required, it determines if the business request is for special business guarantees. If not, the SQL complexity priority score (SalComplextyPriority) is directly calculated. If it is for special business guarantees, the business importance and business time characteristics parameters are set to 6 (business importance = 6, business periodic = 6). The total priority score (SqlComplexityPriority + BusinessPeriority) is then calculated. SQL requests are placed into an in-memory execution queue based on their scores, and the executor executes them sequentially. This process, after switching the flow management mode, further scores business requests based on business parameters to determine execution priority. This allows the database to process requests sequentially based on execution priority, achieving business flow distribution and further ensuring database stability. This improves the efficiency of business processing.

[0125] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0126] Reference Figure 4 This diagram illustrates a structural schematic of a business controller provided in an embodiment of the present invention. The business controller includes at least an interface module, a scoring calculation module connected to the interface module, a flow control execution module connected to the scoring calculation module, and a sidecar data acquisition module connected to the flow control execution module. The business controller connects to a database through the sidecar data acquisition module.

[0127] The interface module is used to receive service requests sent by user terminals and obtain the service parameters corresponding to the service requests.

[0128] The flow control execution module is used to obtain the status parameters of the database collected by the side vehicle acquisition module, and determine whether to switch the flow management mode to the flow limiting mode based on the status parameters.

[0129] The scoring calculation module is used to score the service request according to the service parameters in response to the traffic management mode switching to the rate limiting mode, and obtain the execution priority score of the service request.

[0130] The flow control execution module is used to send the business request to the database according to the execution priority score, so that the database can execute the business operation corresponding to the business request.

[0131] In some feasible implementations, the business parameters include at least hardware parameters and business processing parameters, and the flow control execution module is specifically used for:

[0132] The hardware parameters are used to perform a hardware score on the database to obtain a hardware score, which is used to evaluate the hardware load of the database.

[0133] The database is scored using the business processing parameters to obtain a status score, which is used to assess the business processing load of the database.

[0134] The database is scored using the hardware score and the status score to obtain a resource score, which is used to evaluate the overall resource optimism of the database.

[0135] If the resource score is greater than or equal to the preset load threshold, the traffic management mode will be switched to the rate limiting mode.

[0136] If the resource score is less than the preset load threshold, the normal polling mode is maintained.

[0137] In some feasible implementations, the hardware parameters include at least CPU resource usage, memory resource usage, and storage resource usage, and the flow control execution module is specifically used for:

[0138] The CPU resource score is obtained by calculating the CPU resource usage and available CPU resources.

[0139] The memory resource score is obtained by calculating the memory usage and available memory resources.

[0140] The storage resource score is obtained by calculating the storage resources occupied and the storage resources available.

[0141] The database is scored using the CPU resource score, the memory resource score, and the storage resource score to obtain a hardware score.

[0142] In some feasible implementations, the business request is an SQL statement, and the scoring calculation module is specifically used for:

[0143] Obtain the statement content of the SQL statement;

[0144] Calculate the statement complexity of the SQL statement using the content of the statement;

[0145] The business parameters are used to score the business request to obtain the business priority score corresponding to the business request.

[0146] The execution priority score of the business request is obtained by calculating the statement complexity and the business priority score.

[0147] In some feasible implementations, the statement content includes at least the number of tables, statement length, number of keywords, number of join operations, and number of subqueries. The scoring calculation module is specifically used for:

[0148] The statement complexity of the SQL statement is calculated according to a preset scoring rule, using one of the following: the number of tables, the statement length, the number of keywords, the number of join operations, and the number of subqueries.

[0149] In some feasible implementations, the preset scoring rules include at least:

[0150] Regarding the number of tables: Each SQL statement is assigned a fixed score. For SQL statements with more than one table, the complexity score increases by 0.2 points for each additional table, up to a maximum of 3 points.

[0151] Regarding statement length: If the number of characters in the SQL statement is less than 500, the complexity score is 0.4. For every additional 300 characters, the complexity score increases by 0.2, with a maximum of 3.

[0152] Regarding the number of keywords: If the number of keywords in the SQL statement is less than 30, the complexity score is 0.2 points. For every additional 30 keywords, the complexity score increases by 0.1 points, with a maximum of 1 point.

[0153] Regarding the number of connection operations: one connection operation corresponds to 0.2 points, with a maximum of 2 points;

[0154] Regarding the number of subqueries: one subquery corresponds to 0.2 points, with a maximum of 2 points.

[0155] In some feasible implementations, the business parameters include at least a business importance score, a business periodicity score, and a business strategy. The business importance score characterizes the importance of the business corresponding to the business request, the business periodicity score characterizes the importance of the business at the current time, and the business strategy characterizes whether the business has the highest execution priority at the current time. The scoring calculation module is specifically used for:

[0156] If the business strategy indicates that the business corresponding to the business request is not currently the highest execution priority, then the business request is scored using the real-time business importance score and the real-time business periodicity score to obtain the business priority score corresponding to the business request.

[0157] If the business strategy indicates that the business corresponding to the business request currently has the highest execution priority, then the real-time business importance score is adjusted to the specified business importance score, and the real-time business periodicity score is adjusted to the specified business periodicity score. The business request is then scored using the specified business importance score and the specified business periodicity score to obtain the business priority score corresponding to the business request.

[0158] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0159] In addition, this invention also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described service request processing method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0160] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described method embodiment for processing business requests and achieves the same technical effect. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0161] Figure 5 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.

[0162] The electronic device 500 includes, but is not limited to, components such as: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface module 508, a memory 509, a processor 510, and a power supply 511. Those skilled in the art will understand that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device. An electronic device may include more or fewer components than illustrated, or combine certain components, or have different component arrangements. In the embodiments of the present invention, the electronic device includes, but is not limited to, mobile phones, tablet computers, laptop computers, PDAs, in-vehicle terminals, wearable devices, and pedometers.

[0163] It should be understood that, in this embodiment of the invention, the radio frequency unit 501 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink data from the base station and processes it with the processor 510; additionally, it transmits uplink data to the base station. Typically, the radio frequency unit 501 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier, a duplexer, etc. Furthermore, the radio frequency unit 501 can also communicate with networks and other devices through a wireless communication system.

[0164] The electronic device provides users with wireless broadband internet access through the network module 502, such as helping users send and receive emails, browse web pages, and access streaming media.

[0165] The audio output unit 503 can convert audio data received by the radio frequency unit 501 or the network module 502 or stored in the memory 509 into audio signals and output them as sound. Furthermore, the audio output unit 503 can also provide audio output related to specific functions performed by the electronic device 500 (e.g., call signal reception sound, message reception sound, etc.). The audio output unit 503 includes a speaker, a buzzer, and a receiver, etc.

[0166] Input unit 504 is used to receive audio or video signals. Input unit 504 may include a graphics processing unit (GPU) 5041 and a microphone 5042. The GPU 5041 processes image data of still images or videos acquired by an image capture device (such as a camera) in video capture mode or image capture mode. The processed image frames can be displayed on display unit 506. The image frames processed by GPU 5041 can be stored in memory 509 (or other storage medium) or transmitted via radio frequency unit 501 or network module 502. Microphone 5042 can receive sound and process such sound into audio data. The processed audio data can be converted into a format that can be transmitted to a mobile communication base station via radio frequency unit 501 in telephone call mode.

[0167] The electronic device 500 also includes at least one sensor 505, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 5061 according to the ambient light level, and the proximity sensor can turn off the display panel 5061 and / or backlight when the electronic device 500 is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used to identify the posture of the electronic device (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. The sensor 505 may also include a fingerprint sensor, pressure sensor, iris sensor, molecular sensor, gyroscope, barometer, hygrometer, thermometer, infrared sensor, etc., which will not be described in detail here.

[0168] The display unit 506 is used to display information input by the user or information provided to the user. The display unit 506 may include a display panel 5061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.

[0169] User input unit 507 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of electronic devices. Specifically, user input unit 507 includes a touch panel 5071 and other input devices 5072. Touch panel 5071, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near touch panel 5071). Touch panel 5071 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 510, which receives and executes commands from the processor 510. In addition, touch panel 5071 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. Besides touch panel 5071, user input unit 507 may also include other input devices 5072. Specifically, other input devices 5072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.

[0170] Furthermore, the touch panel 5071 can cover the display panel 5061. When the touch panel 5071 detects a touch operation on or near it, it transmits the information to the processor 510 to determine the type of touch event. Subsequently, the processor 510 provides corresponding visual output on the display panel 5061 according to the type of touch event. It is understood that in one embodiment, the touch panel 5071 and the display panel 5061 are implemented as two independent components to realize the input and output functions of the electronic device. However, in some embodiments, the touch panel 5071 and the display panel 5061 can be integrated to realize the input and output functions of the electronic device. The specific implementation is not limited here.

[0171] Interface module 508 serves as an interface for connecting external devices to electronic device 500. For example, external devices may include a wired or wireless headphone port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, and so on. Interface module 508 can be used to receive input from external devices (e.g., data, power, etc.) and transmit the received input to one or more components within electronic device 500, or it can be used to transfer data between electronic device 500 and external devices.

[0172] The memory 509 can be used to store software programs and various data. The memory 509 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback, image playback, etc.), etc.; the data storage area may store data created based on the use of the mobile phone (such as audio data, phonebook, etc.). Furthermore, the memory 509 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.

[0173] The processor 510 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines. By running or executing software programs and / or modules stored in the memory 509, and by calling data stored in the memory 509, it performs various functions and processes data, thereby providing overall monitoring of the electronic device. The processor 510 may include one or more processing units; preferably, the processor 510 may integrate an application processor and a modem processor. The application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 510.

[0174] The electronic device 500 may also include a power supply 511 (such as a battery) for supplying power to various components. Preferably, the power supply 511 can be logically connected to the processor 510 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system.

[0175] In addition, the electronic device 500 includes some functional modules not shown, which will not be described in detail here.

[0176] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0177] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0178] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other modifications under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these modifications are within the protection scope of the present invention.

[0179] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0180] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0181] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0182] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0183] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0184] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0185] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for processing business requests, characterized in that, The method is applied to a business controller, which includes at least an interface module, a scoring calculation module connected to the interface module, a flow control execution module connected to the scoring calculation module, and a sidecar data acquisition module connected to the flow control execution module; wherein the business controller connects to a database through the sidecar data acquisition module, and the method includes: The interface module receives a service request sent by the user terminal and obtains the service parameters corresponding to the service request. The flow control execution module obtains the status parameters of the database collected by the side vehicle acquisition module, and determines whether to switch the flow management mode to the flow limiting mode based on the status parameters. In response to the traffic management mode switching to the rate limiting mode, the scoring calculation module scores the service request according to the service parameters to obtain the execution priority score of the service request. The flow control execution module sends the business request to the database according to the execution priority score, so that the database executes the business operation corresponding to the business request. Wherein, the business request is an SQL statement, and the step of scoring the business request based on the business parameters to obtain the execution priority score of the business request includes: Obtain the statement content of the SQL statement; Calculate the statement complexity of the SQL statement using the content of the statement; The business parameters are used to score the business request to obtain the business priority score corresponding to the business request. The execution priority score of the business request is obtained by calculating the statement complexity and the business priority score.

2. The method according to claim 1, characterized in that, The service parameters include at least hardware parameters and service processing parameters. The step of determining whether to switch the traffic management mode to rate limiting mode based on the status parameters includes: The hardware parameters are used to perform a hardware score on the database to obtain a hardware score, which is used to evaluate the hardware load of the database. The database is scored using the business processing parameters to obtain a status score, which is used to assess the business processing load of the database. The database is scored using the hardware score and the status score to obtain a resource score, which is used to evaluate the overall resource optimism of the database. If the resource score is greater than or equal to the preset load threshold, the traffic management mode will be switched to the rate limiting mode. If the resource score is less than the preset load threshold, the normal polling mode is maintained.

3. The method according to claim 2, characterized in that, The hardware parameters include at least CPU resource usage, memory resource usage, and storage resource usage. The step of using these hardware parameters to perform a hardware score on the database and obtaining a hardware score includes: The CPU resource score is obtained by calculating the CPU resource usage and available CPU resources. The memory resource score is obtained by calculating the memory usage and available memory resources. The storage resource score is obtained by calculating the storage resources occupied and the storage resources available. The database is scored using the CPU resource score, the memory resource score, and the storage resource score to obtain a hardware score.

4. The method according to claim 1, characterized in that, The statement content includes at least the number of tables, statement length, number of keywords, number of join operations, and number of subqueries. Calculating the statement complexity of the SQL statement using the statement content includes: The statement complexity of the SQL statement is calculated according to a preset scoring rule, using one of the following: the number of tables, the statement length, the number of keywords, the number of join operations, and the number of subqueries.

5. The method according to claim 4, characterized in that, The preset scoring rules include at least the following: Regarding the number of tables: Each SQL statement is assigned a fixed score. For SQL statements with more than one table, the complexity score increases by 0.2 points for each additional table, up to a maximum of 3 points. Regarding statement length: If the number of characters in the SQL statement is less than 500, the complexity score is 0.

4. For every additional 300 characters, the complexity score increases by 0.2, with a maximum of 3. Regarding the number of keywords: If the number of keywords in the SQL statement is less than 30, the complexity score is 0.2 points. For every additional 30 keywords, the complexity score increases by 0.1 points, with a maximum of 1 point. Regarding the number of connection operations: one connection operation corresponds to 0.2 points, with a maximum of 2 points; Regarding the number of subqueries: one subquery corresponds to 0.2 points, with a maximum of 2 points.

6. The method according to claim 1, characterized in that, The business parameters include at least a business importance score, a business periodicity score, and a business strategy. The business importance score characterizes the importance of the business corresponding to the business request, the business periodicity score characterizes the importance of the business at the current time, and the business strategy characterizes whether the business has the highest execution priority at the current time. The step of using the business parameters to score the business request and obtain the business priority score corresponding to the business request includes: If the business strategy indicates that the business corresponding to the business request is not currently the highest execution priority, then the business request is scored using the real-time business importance score and the real-time business periodicity score to obtain the business priority score corresponding to the business request. If the business strategy indicates that the business corresponding to the business request currently has the highest execution priority, then the real-time business importance score is adjusted to the specified business importance score, and the real-time business periodicity score is adjusted to the specified business periodicity score. The business request is then scored using the specified business importance score and the specified business periodicity score to obtain the business priority score corresponding to the business request.

7. A service controller, characterized in that, The service controller includes at least an interface module, a scoring calculation module connected to the interface module, a flow control execution module connected to the scoring calculation module, and a sidecar data acquisition module connected to the flow control execution module; wherein, the service controller connects to a database through the sidecar data acquisition module; wherein, The interface module is used to receive service requests sent by user terminals and obtain the service parameters corresponding to the service requests. The flow control execution module is used to obtain the status parameters of the database collected by the side vehicle acquisition module, and determine whether to switch the flow management mode to the flow limiting mode based on the status parameters. The scoring calculation module is used to score the service request according to the service parameters in response to the traffic management mode switching to the rate limiting mode, and obtain the execution priority score of the service request. The flow control execution module is used to send the business request to the database according to the execution priority score, so that the database executes the business operation corresponding to the business request. Wherein, the business request is an SQL statement, and the step of scoring the business request based on the business parameters to obtain the execution priority score of the business request includes: Obtain the statement content of the SQL statement; Calculate the statement complexity of the SQL statement using the content of the statement; The business parameters are used to score the business request to obtain the business priority score corresponding to the business request. The execution priority score of the business request is obtained by calculating the statement complexity and the business priority score.

8. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; The memory is used to store computer programs; When the processor executes a program stored in the memory, it implements the method as described in any one of claims 1-6.

9. A computer-readable storage medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Flow limiting method and device for high-concurrency system, storage medium and equipment

    CN111488135A

  • Database management method and device, equipment and storage medium

    CN116126821A