Data access request processing method and device, equipment and storage medium
By introducing a concurrent leak bucket mechanism in the data access request processing, the data access request of hotspot files is controlled, the problem of hotspot files occupying resources is solved and the access efficiency of non-hotspot files is improved.
Patent Information
- Application Number
- CN202411684034.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-11-22
AI Technical Summary
In cloud storage and data center environments, when a single or multiple files become ‘hotspots’, data access requests that are not properly managed will occupy a large amount of network bandwidth and server processing power, affecting access to non-hotspot files.
When multiple data access requests are received, a candidate data access request that meets the matching conditions is selected, and the target data access request enters the concurrent leak bucket based on the bucket size of the concurrent leak bucket corresponding to the current period is controlled. The target data access request is responded to in the concurrent leak bucket, and the remaining data access request is blocked.
It effectively limits data access requests to hotspot files, thereby releasing bandwidth resources, improving access efficiency to non-hotspot files, and avoiding excessive use of network bandwidth and server processing capabilities caused by hotspot files.
Smart Images

Figure CN119496745A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for processing a data access request. Background Art
[0002] In modern cloud storage and data center environments, the management of object storage resource pools is one of the core technologies. Object storage systems respond to growing data demands by providing flexible and scalable storage solutions.
[0003] However, when a single or multiple files suddenly become "hot spots", that is, these files are accessed concurrently by a large number of users or systems, these requests, if not properly managed, will occupy a large amount of network bandwidth and server processing power, thereby affecting the access to non-hot files. Summary of the invention
[0004] Based on this, it is necessary to provide a data access request processing method, apparatus, computer equipment, computer-readable storage medium and computer program product that can effectively manage data access in response to the above technical problems.
[0005] A method for processing a data access request, the method comprising:
[0006] When multiple data access requests are received, selecting a candidate data access request that meets a matching condition from the multiple data access requests;
[0007] Based on the bucket size of the concurrent leaky bucket corresponding to the current time period, control the target data access request in the candidate data access request to enter the concurrent leaky bucket; the number of the target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number;
[0008] A response process is performed on each target data access request in the concurrent leaky bucket, and a blocking process is performed on the remaining data access requests in the candidate data access requests.
[0009] In one embodiment, the concurrency limit number is H, the concurrent leaky bucket includes a real-time leaky bucket and an instantaneous leaky bucket, the bucket size of the real-time leaky bucket is M, the bucket size of the instantaneous leaky bucket is N, M and N are integers greater than or equal to 1, and M+N=H; the target data access request includes a first data access request and a second data access request;
[0010] The controlling the target data access request in the candidate data access request to enter the concurrent leaky bucket based on the bucket size of the concurrent leaky bucket corresponding to the current time period includes:
[0011] Based on the bucket size of the real-time leaky bucket corresponding to the current time period, control the first data access request among the candidate data access requests to enter the real-time leaky bucket, and based on the bucket size of the instantaneous leaky bucket corresponding to the current time period, control the second data access request among the candidate data access requests to enter the instantaneous bucket;
[0012] The number of the first data access requests is less than or equal to M, the number of the second data access requests is less than or equal to N, and the response processing priority of the real-time leaky bucket is higher than the processing priority of the instantaneous leaky bucket.
[0013] In one embodiment, the number of the candidate data access requests is h; controlling a first data access request among the candidate data access requests to enter a real-time leaky bucket, and controlling a second data access request among the candidate data access requests to enter a transient bucket, comprises:
[0014] For the i-th candidate data access request, obtain the number m of data access requests that exist in the current real-time leaky bucket, and compare m with M;
[0015] If m<M, determining the i-th candidate data access request as the first data access request, and controlling the first data access request to enter the real-time leaky bucket;
[0016] If m=M, obtain the number n of data access requests existing in the current instantaneous leaky bucket, and compare n with N. If n<N, determine that the i-th candidate data access request is the second data access request, and control the second data access request to enter the instantaneous leaky bucket. If n=N, determine that the i-th candidate data access request is the remaining data access request;
[0017] Assign i=i+1, return the step of obtaining the number m of data access requests existing in the current real-time leaky bucket for the i-th candidate data access request, and compare m with M until i=h.
[0018] In one embodiment, the method further comprises:
[0019] Selecting a regular data access request that does not meet the matching condition from the multiple data access requests;
[0020] The conventional data access request is responded to and processed.
[0021] In one embodiment, the method further comprises:
[0022] After completing the response processing of the current data access request among the multiple data access requests, obtaining the period data flow in the current period; the period data flow is the total data flow corresponding to the data access requests whose response processing is completed in the current period, the current period refers to the time period between the current moment and the last update moment, and the last update moment refers to the historical moment when the concurrent limit quantity is last updated;
[0023] If the duration of the current time period is greater than or equal to the preset duration, determining the bandwidth of the current time period based on the data flow of the time period;
[0024] The concurrent limit quantity is updated based on the bandwidth to obtain an updated concurrent limit quantity;
[0025] The bucket size of the concurrent leaky bucket is updated based on the updated concurrent limit quantity to obtain an updated bucket size; the updated bucket size is used to guide the processing of new data access requests when new data access requests are received in the next time period.
[0026] In one embodiment, the updating of the concurrency limit based on the bandwidth to obtain an updated concurrency limit includes:
[0027] Obtain the lower and upper bandwidth limits of the preset bandwidth range;
[0028] If the bandwidth is less than the bandwidth lower limit, increase the concurrent limit number to obtain an updated concurrent limit number;
[0029] If the bandwidth is less than the bandwidth lower limit, the concurrent limit number is reduced to obtain an updated concurrent limit number;
[0030] If the bandwidth is within the preset bandwidth range, the concurrent limit quantity is determined as the updated concurrent limit quantity.
[0031] A device for processing a data access request, the device comprising:
[0032] A data access request selection module, configured to select a candidate data access request that meets a matching condition from among the multiple data access requests when multiple data access requests are received;
[0033] A leaky bucket control module, used to control the target data access request in the candidate data access request to enter the concurrent leaky bucket based on the bucket size of the concurrent leaky bucket corresponding to the current time period; the number of the target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number;
[0034] The request response module is used to respond to each target data access request in the concurrent leaky bucket and block the remaining data access requests in the candidate data access requests.
[0035] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0036] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0037] A computer program product comprises a computer program, wherein the computer program implements the steps of the above method when executed by a processor.
[0038] The above-mentioned data access request processing method, device, computer equipment, computer-readable storage medium and computer program product, when receiving multiple data access requests, selects candidate data access requests that meet the matching conditions from the multiple data access requests, such as selecting candidate data access requests for hot files, and based on the bucket size of the concurrent leaky bucket corresponding to the current time period, controls the target data access requests in the candidate data access requests to enter the concurrent leaky bucket, wherein the number of target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number, responds to each target data access request in the concurrent leaky bucket, and blocks the remaining data access requests in the candidate data access requests, thereby limiting data access requests for hot files to reserve corresponding bandwidth resources for processing access to non-hot files. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0040] FIG1 is an application environment diagram of a method for processing a data access request in one embodiment;
[0041] FIG2 is a flow chart of a method for processing a data access request in one embodiment;
[0042] FIG3 is a schematic flow diagram of a leaky bucket entry step in one embodiment;
[0043] FIG4 is a flow chart of a step of adjusting the concurrent limit quantity in one embodiment;
[0044] FIG5 is a schematic flow chart of a bandwidth determination step in one embodiment;
[0045] FIG6 is a flow chart of a method for processing a data access request in another embodiment;
[0046] FIG7 is a structural block diagram of a device for processing data access requests in one embodiment;
[0047] FIG. 8 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0049] The method for processing data access requests provided in the embodiment of the present application can be applied in the application environment shown in FIG. 1. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The above-mentioned method for processing data access requests can be executed separately by the server. Taking the execution on the server 104 as an example, multiple terminals 102 can send data access requests to the server 104 respectively. When the server 104 receives multiple data access requests, it selects candidate data access requests that meet the matching conditions from the multiple data access requests; based on the bucket size of the concurrent leaky bucket corresponding to the current time period, the target data access request in the candidate data access request is controlled to enter the concurrent leaky bucket; the number of target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number; each target data access request in the concurrent leaky bucket is responded to and processed, and the remaining data access requests in the candidate data access request are blocked.
[0050] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. Head-mounted devices may be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. The server 104 may be an independent physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services.
[0051] In an exemplary embodiment, as shown in FIG2 , a method for processing a data access request is provided, which is described by taking the method applied to the server 104 in FIG1 as an example, and includes the following steps S202 to S206 . Among them:
[0052] S202: When multiple data access requests are received, select candidate data access requests that meet a matching condition from the multiple data access requests.
[0053] Among them, a data access request usually refers to an operation of requesting to obtain, modify, delete or store data from a system or service.
[0054] The matching condition is a condition used to filter data access requests, which can be a regular expression.
[0055] Specifically, different clients can send data access requests to the server through corresponding terminals. When the server receives multiple data access requests, it can determine the files or resources to be accessed by each data access request, and determine the target files or target resources among these files or resources that are hot resources, and determine the data access requests corresponding to the target files or target resources as candidate data access requests, and determine the data access requests corresponding to the files or resources among these files or target resources that are non-hot resources as regular data access requests.
[0056] In one embodiment, the process of selecting candidate data access requests that meet the matching conditions from multiple data access requests specifically includes the following steps: respectively obtaining data access paths corresponding to each of the multiple data access requests; determining the regular expression corresponding to each data access path; and selecting candidate data access requests whose regular expressions meet the matching conditions from the multiple data access requests.
[0057] The matching condition may specifically be a regular expression of a hotspot resource.
[0058] The data access path is the specific storage location of the file or resource that the data access request wants to access.
[0059] Specifically, the server extracts the corresponding data access path from each data access request, determines the regular expression corresponding to each data access path, and compares the regular expression of each data access request with the regular expression of the hot resource. For any data access request, if the regular expression of the data access request matches the regular expression of the hot resource, the data access request is determined to be a candidate data access request; if the regular expression of the data access request does not match the regular expression of the hot resource, the data access request is determined to be a regular data access request.
[0060] S204, based on the bucket size of the concurrent leaky bucket corresponding to the current time period, control the target data access requests in the candidate data access requests to enter the concurrent leaky bucket; the number of target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number.
[0061] Among them, the bucket of the concurrent leaky bucket is an abstract concept used to describe the mechanism of the algorithm to control the data flow. The main function of the concurrent leaky bucket is to receive and store incoming data, and release or "leak" the data at a certain fixed rate. The bucket size of the concurrent leaky bucket refers to the maximum number of data access requests that the bucket can store at any given time. In the embodiment of the present application, the bucket size is equal to the concurrent limit number. The concurrent limit data volume refers to the maximum number of candidate data access requests allowed to be processed concurrently, that is, the maximum number of concurrently processed data access requests for hot resources.
[0062] It should be noted that the bucket size of the concurrent leaky bucket in the embodiment of the present application changes dynamically. Specifically, the concurrent limit number of the current time period can be determined based on the bandwidth occupied by the data access requests responded to and processed in the most recent time period, and the bucket size of the concurrent leaky bucket of the current time period can be determined based on the concurrent limit number of the current time period.
[0063] Specifically, after determining the candidate data access requests, the server can obtain the bucket size corresponding to the concurrent leaky bucket in the current time period, and the number of data access requests stored in the concurrent leaky bucket at the current moment, that is, the occupied number of the concurrent leaky bucket, and determine the target number based on the occupied number and the bucket size. When the number of candidate data access requests is less than or equal to the target number, each candidate data access request is directly determined as a target data access request, and the target data access request is controlled to enter the concurrent leaky bucket; when the number of candidate data access requests is greater than the target number, the target number of target data access requests is selected from the candidate data access requests, and the selected target data access requests are controlled to enter the concurrent leaky bucket.
[0064] Among them, selecting a target number of target data access requests from the candidate data access requests can be done randomly or by sorting. The sorting selection means first sorting the candidate data access requests according to the corresponding sorting rules, and then selecting the sorted candidate data access requests in sequence until the target number of target data access requests are obtained. The sorting rules can be any one of sorting by priority, sorting by arrival time, and sorting by resource requirements.
[0065] S206, responding to each target data access request in the concurrent leaky bucket, and blocking the remaining data access requests in the candidate data access requests.
[0066] The response processing may specifically include executing the data processing operation corresponding to the data access request to obtain the data processing result, generating a response according to the data processing result, and returning the generated response to the sender of the data access request.
[0067] Blocking processing refers to directly refusing to process the remaining data access requests that fail to enter the concurrent leaky bucket among the candidate data access requests. Specifically, an error response may be sent to the senders of these remaining data access requests.
[0068] Specifically, for the target data access requests in the concurrent leaky bucket, the required data processing operations are taken out one by one according to the system's processing capacity and executed to obtain the data processing results, and response data is generated according to the data processing results, and the response data is sent back to the sender corresponding to the target data access request; for the remaining data access requests among the candidate data access requests that failed to enter the concurrent leaky bucket, an error response is sent to the sender of the remaining data access requests.
[0069] The above-mentioned method for processing data access requests is that when the server receives multiple data access requests, it selects candidate data access requests that meet the matching conditions from the multiple data access requests, such as selecting candidate data access requests for hot files, and based on the bucket size of the concurrent leaky bucket corresponding to the current time period, controls the target data access requests in the candidate data access requests to enter the concurrent leaky bucket, wherein the number of target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number, responds to each target data access request in the concurrent leaky bucket, and blocks the remaining data access requests in the candidate data access requests, thereby limiting data access requests for hot files to reserve corresponding bandwidth resources for processing access to non-hot files.
[0070] In one embodiment, the concurrency limit number is H, the concurrent leaky bucket includes a real-time leaky bucket and an instantaneous leaky bucket, the bucket size of the real-time leaky bucket is M, the bucket size of the instantaneous leaky bucket is N, M and N are integers greater than or equal to 1, respectively, and M+N=H; the target data access request includes a first data access request and a second data access request; the process in which the server controls the target data access request in the candidate data access request to enter the concurrent leaky bucket based on the bucket size of the concurrent leaky bucket corresponding to the current time period includes the following steps: based on the bucket size of the real-time leaky bucket corresponding to the current time period, controlling the first data access request in the candidate data access request to enter the real-time leaky bucket, and based on the bucket size of the instantaneous leaky bucket corresponding to the current time period, controlling the second data access request in the candidate data access request to enter the instantaneous bucket; wherein, the number of first data access requests is less than or equal to M, the number of second data access requests is less than or equal to N, and the response processing priority of the real-time leaky bucket is higher than the processing priority of the instantaneous leaky bucket.
[0071] Among them, the real-time leaky bucket is used to process high-priority data access requests, which usually involve operations with strict response time requirements; the transient leaky bucket is used to process data access requests with lower priority that can tolerate a certain delay. Such requests do not need to be processed immediately and can be processed later according to the system resource status.
[0072] Specifically, after determining the candidate data access requests, the server can obtain the bucket sizes corresponding to the real-time leaky bucket and the instantaneous leaky bucket in the current time period, obtain the bucket size M of the real-time leaky bucket and the instantaneous leaky bucket size N, and obtain the number of data access requests stored in the real-time leaky bucket, and obtain the number of data access requests stored in the instantaneous bucket, determine the first target number based on the number of data access requests stored in the real-time leaky bucket and the bucket size M, and determine the second target number based on the number of data access requests stored in the instantaneous leaky bucket and the bucket size N. When the number of candidate data access requests is less than or equal to the first target number, directly determine each candidate data access request as the first data access request, and control the first data access request to enter the real-time leaky bucket. When the number of candidate data access requests is greater than the first target number, determine the difference between the number of candidate data access requests and the first target number. When the difference is less than or equal to the second target number, select each candidate data access request from the real-time leaky bucket. A first target number of candidate data access requests are selected from each candidate data access request as the first data access request, and the remaining candidate data access requests of each candidate data access request are determined as the second data access request, and the first data access request is controlled to enter the real-time leaky bucket, and the second data access request is controlled to enter the instantaneous leaky bucket; when the difference is greater than the second target number, the first target number of candidate data access requests are selected from each candidate data access request as the first data access request, and the second target number of candidate data access requests are selected as the second data access request, and the first data access request is controlled to enter the real-time leaky bucket, and the second data access request is controlled to enter the instantaneous leaky bucket. For the real-time leaky bucket and the instantaneous leaky bucket, the system can first respond to and process each first data access request in the real-time leaky bucket, and after completing the processing of each data access request in the real-time leaky bucket, respond to and process each second data access request in the instantaneous leaky bucket.
[0073] In the above embodiment, the server distributes requests to two different leaky buckets and dynamically manages them according to their priorities and the resource status of the system. This strategy ensures that high-priority requests are not delayed by low-priority requests and also ensures full utilization of system resources.
[0074] In one embodiment, the number of candidate data access requests is h; the process in which the server controls the first data access request in the candidate data access requests to enter the real-time leaky bucket, and controls the second data access request in the candidate data access requests to enter the transient bucket includes the following steps: for the i-th candidate data access request, obtain the number m of data access requests already existing in the current real-time leaky bucket, and compare m with M; if m<M, determine that the i-th candidate data access request is the first data access request, and control the first data access request to enter the real-time leaky bucket; if m=M, obtain the number n of data access requests already existing in the current transient leaky bucket, and compare n with N, if n<N, determine that the i-th candidate data access request is the second data access request, and control the second data access request to enter the transient leaky bucket, if n=N, determine that the i-th candidate data access request is the remaining data access request; assign i=i+1, return to the step of obtaining the number m of data access requests already existing in the current real-time leaky bucket for the i-th candidate data access request, and comparing m with M, until i=h.
[0075] Referring to Figure 3, for example, for the first candidate data access request, obtain the number m of data access requests already existing in the current real-time leaky bucket, and compare m with M; if m<M, determine that the first candidate data access request is the first data access request, and control the first data access request to enter the real-time leaky bucket; if m=M, obtain the number n of data access requests already existing in the current instantaneous leaky bucket, and compare n with N; if n<N, determine that the first candidate data access request is the second data access request, and control the second data access request to enter the instantaneous leaky bucket; if n=N, determine that the first candidate data access request is the remaining data access request; for the second candidate data access request, obtain the number m of data access requests already existing in the current real-time leaky bucket, and compare m Compare with M; if m<M, determine that the second candidate data access request is the first data access request, and control the first data access request to enter the real-time leaky bucket; if m=M, obtain the number n of data access requests already existing in the current instantaneous leaky bucket, and compare n with N. If n<N, determine that the second candidate data access request is the second data access request, and control the second data access request to enter the instantaneous leaky bucket. If n=N, determine that the second candidate data access request is the remaining data access request. For the third candidate data access request, return to execute to obtain the number m of data access requests already existing in the current real-time leaky bucket, and compare m with M, until the h candidate data access requests are processed, and the entry control of all candidate data access requests is realized.
[0076] In the above embodiment, the server finely manages and controls the process of candidate data access requests entering the real-time leaky bucket and the transient leaky bucket, and preferentially allocates the requests to the real-time leaky bucket. The system ensures that the most urgent and critical data access requests can obtain a quick response. By dynamically checking the capacity of the real-time leaky bucket and the transient leaky bucket and allocating requests accordingly, the system can more effectively utilize its processing power and resources.
[0077] In one embodiment, the method for processing the data access request further includes the following steps: selecting a regular data access request that does not meet the matching condition from the multiple data access requests; and performing response processing on the regular data access request.
[0078] The matching condition may specifically be a regular expression of a hotspot resource, and a regular data access request is a data access request for accessing a non-hotspot resource.
[0079] Specifically, the server extracts the corresponding data access path from each data access request, determines the regular expression corresponding to each data access path, and compares the regular expression of each data access request with the regular expression of the hot resource. For any data access request, if the regular expression of the data access request does not match the regular expression of the hot resource, the data access request is determined to be a regular data access request, and the regular data access request is directly responded to and processed.
[0080] In the above embodiment, the server selects regular data access requests that do not meet the matching condition from multiple data access requests, and responds to the regular data access requests, thereby ensuring that corresponding bandwidth resources are reserved to process access to non-hotspot files.
[0081] In one embodiment, the above-mentioned data access request processing method also includes the following steps: after completing the response processing of the current data access request among multiple data access requests, obtaining the time period data traffic in the current time period; if the duration of the current time period is greater than or equal to the preset duration, determining the bandwidth of the current time period based on the time period data traffic; updating the concurrency limit number based on the bandwidth to obtain an updated concurrency limit number; updating the bucket size of the concurrent leaky bucket based on the updated concurrency limit number to obtain an updated bucket size; the updated bucket size is used to guide the processing of new data access requests when new data access requests are received in the next time period.
[0082] The period data flow is the total data flow corresponding to the data access requests that have been processed in the current period. The current period refers to the time period between the current time and the last update time. The last update time refers to the historical time when the concurrent limit was last updated. Data flow usually refers to the total amount of data transmitted through the network, including uploaded and downloaded data. The data flow corresponding to the current data access request is the data flow corresponding to the data storage path accessed by the current data access request.
[0083] The current data access request is a data access request that has been responded to and processed at the current moment, and specifically may be a regular data access request or a data access request taken out from a concurrent leaky bucket.
[0084] Specifically, referring to Figures 4 and 5, after completing the response processing of the current data access request, the server can obtain the data flow corresponding to the current data access request, and update the most recently saved time period data flow based on the data flow to obtain the latest time period data flow of the current time period, and compare the duration of the current time period with the preset duration. If the duration of the current time period is greater than or equal to the preset duration, the ratio of the latest time period data flow of the current time period to the current time period is determined as the bandwidth corresponding to the current time period, and the bandwidth corresponding to the current time period is compared with the preset bandwidth range. Based on the comparison result, the concurrent limit number is updated to obtain the updated concurrent limit number; based on the updated concurrent limit number, the bucket sizes of the real-time leaky bucket and the instantaneous leaky bucket are respectively updated to obtain the updated bucket size of the real-time leaky bucket and the updated bucket size of the instantaneous leaky bucket.
[0085] It can be understood that the concurrency limit number is equal to the bucket size of the concurrency leaky bucket, so when the concurrency limit number increases or decreases, the bucket size of the concurrency leaky bucket also increases or decreases.
[0086] In the above embodiment, the server monitors the data traffic in real time and periodically adjusts the concurrency limit number based on it, and then periodically adjusts the bucket size of the concurrency leaky bucket. In this way, the system can adjust to process more requests under the premise that the network bandwidth resources are fully utilized without being overloaded, thereby avoiding performance degradation caused by idle or excessive use of resources.
[0087] In one embodiment, the server updates the concurrency limit number based on the bandwidth, and the process of obtaining the updated concurrency limit number includes the following steps: obtaining the bandwidth lower limit value and the bandwidth upper limit value of the preset bandwidth interval; if the bandwidth is less than the bandwidth lower limit value, increasing the concurrency limit number to obtain the updated concurrency limit number; if the bandwidth is less than the bandwidth lower limit value, reducing the concurrency limit number to obtain the updated concurrency limit number; if the bandwidth is within the preset bandwidth interval, determining the concurrency limit number as the updated concurrency limit number.
[0088] The preset bandwidth interval is a reasonable range of bandwidth usage that is pre-selected and set. This interval includes a lower bandwidth limit and an upper bandwidth limit, which are used to define the optimized area for network bandwidth usage, thereby providing the system with a reference for dynamically adjusting concurrency limits.
[0089] Specifically, as shown in FIG4 , after determining the bandwidth corresponding to the current time period, the server obtains the bandwidth lower limit value and the bandwidth upper limit value of the preset bandwidth interval, and compares the bandwidth corresponding to the current time period with the bandwidth lower limit value and the bandwidth upper limit value respectively. If the bandwidth corresponding to the current time period is less than the bandwidth lower limit value, it indicates that the network resources are not fully utilized, so the concurrent limit number can be increased to obtain the updated concurrent limit number. If the bandwidth corresponding to the previous time period is greater than the bandwidth lower limit value, it indicates that the network or system is facing an overload risk, so the concurrent limit number can be reduced to obtain the updated concurrent limit number. If the bandwidth is in the preset bandwidth interval, it indicates that the bandwidth usage is reasonable, and the current concurrent limit number can be kept unchanged, that is, the concurrent limit number is determined as the updated concurrent limit number.
[0090] In the above embodiment, the server increases the processing capacity of concurrent requests when the bandwidth usage is below the lower limit, thereby ensuring that the server will not be idle when resources are sufficient, and reduces the number of concurrent requests when the bandwidth usage is close to the upper limit, thereby avoiding overload and potential service interruption.
[0091] The present application also provides a method for processing a data access request. As shown in FIG6 , a method for processing a data access request is provided. The method is applied to the server 104 in FIG1 as an example for explanation, and includes the following steps:
[0092] S602: When multiple data access requests are received, candidate data access requests that meet a matching condition and regular data access requests that do not meet the matching condition are selected from the multiple data access requests.
[0093] S604: Response processing is performed on the regular data access request.
[0094] S606, based on the bucket size of the real-time leaky bucket corresponding to the current time period, control the first data access request in the candidate data access request to enter the real-time leaky bucket, and based on the bucket size of the instantaneous leaky bucket corresponding to the current time period, control the second data access request in the candidate data access request to enter the instantaneous bucket; the sum of the bucket size of the real-time leaky bucket and the bucket size of the loss leaky bucket is equal to the concurrent limit number.
[0095] Wherein, the number of first data access requests is less than or equal to M, the number of second data access requests is less than or equal to N, and the bucket size is equal to the concurrent limit number;
[0096] S608, after completing the response processing of each data access request in the real-time leaky bucket, respond to each data access request in the instantaneous leaky bucket, and block the remaining data access requests in the candidate data access requests.
[0097] S610, after completing the response processing of the current data access request among multiple data access requests, obtain the time period data traffic within the current time period; the time period data traffic is the total data traffic corresponding to the data access requests whose response processing is completed within the current time period, and the current time period refers to the time period between the current moment and the last update moment, and the last update moment refers to the historical moment when the concurrent limit number was last updated.
[0098] S612: If the duration of the current time period is greater than or equal to the preset duration, determine the bandwidth of the current time period based on the data flow of the time period; update the concurrent limit number based on the bandwidth to obtain the updated concurrent limit number.
[0099] In one embodiment, a bandwidth lower limit value and a bandwidth upper limit value of a preset bandwidth interval are obtained; if the bandwidth is less than the bandwidth lower limit value, the concurrent limit number is increased to obtain an updated concurrent limit number; if the bandwidth is less than the bandwidth lower limit value, the concurrent limit number is reduced to obtain an updated concurrent limit number; if the bandwidth is within the preset bandwidth interval, the concurrent limit number is determined as the updated concurrent limit number.
[0100] S614, updating the bucket size of the concurrent leaky bucket based on the updated concurrent limit number to obtain an updated bucket size; the updated bucket size is used to guide the processing of new data access requests when new data access requests are received in the next period.
[0101] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0102] Based on the same inventive concept, the embodiment of the present application also provides a data access request processing device for implementing the data access request processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiments of one or more data access request processing devices provided below can refer to the limitations of the data access request processing method above, and will not be repeated here.
[0103] In an exemplary embodiment, as shown in FIG. 7 , a data access request processing device is provided, including: a data access request selection module 702 , a leaky bucket control module 704 and a request response module 706 , wherein:
[0104] The data access request selection module 702 is used to select a candidate data access request that meets a matching condition from the multiple data access requests when multiple data access requests are received;
[0105] The leaky bucket control module 704 is used to control the target data access request in the candidate data access request to enter the concurrent leaky bucket based on the bucket size of the concurrent leaky bucket corresponding to the current time period; the number of target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number;
[0106] The request response module 706 is used to respond to each target data access request in the concurrent leaky bucket and block the remaining data access requests in the candidate data access requests.
[0107] In the above embodiment, when multiple data access requests are received, candidate data access requests that meet the matching conditions are selected from the multiple data access requests, such as candidate data access requests for hot files, and based on the bucket size of the concurrent leaky bucket corresponding to the current time period, the target data access requests in the candidate data access requests are controlled to enter the concurrent leaky bucket, wherein the number of target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number, each target data access request in the concurrent leaky bucket is responded to and processed, and the remaining data access requests in the candidate data access requests are blocked, thereby limiting data access requests for hot files to reserve corresponding bandwidth resources for processing access to non-hot files.
[0108] In one embodiment, the concurrency limit number is H, and the concurrent leaky buckets include a real-time leaky bucket and an instantaneous leaky bucket. The bucket size of the real-time leaky bucket is M, and the bucket size of the instantaneous leaky bucket is N, M and N are integers greater than or equal to 1, respectively, and M+N=H; the target data access request includes a first data access request and a second data access request; the leaky bucket control module 704 is also used to: based on the bucket size of the real-time leaky bucket corresponding to the current time period, control the first data access request in the candidate data access request to enter the real-time leaky bucket, and based on the bucket size of the instantaneous leaky bucket corresponding to the current time period, control the second data access request in the candidate data access request to enter the instantaneous bucket; wherein, the number of first data access requests is less than or equal to M, the number of second data access requests is less than or equal to N, and the response processing priority of the real-time leaky bucket is higher than the processing priority of the instantaneous leaky bucket.
[0109] In one embodiment, the number of candidate data access requests is h; the leaky bucket control module 704 is also used to: for the ith candidate data access request, obtain the number m of data access requests already existing in the current real-time leaky bucket, and compare m with M; if m<M, determine that the ith candidate data access request is the first data access request, and control the first data access request to enter the real-time leaky bucket; if m=M, obtain the number n of data access requests already existing in the current instantaneous leaky bucket, and compare n with N, if n<N, determine that the ith candidate data access request is the second data access request, and control the second data access request to enter the instantaneous leaky bucket, if n=N, determine that the ith candidate data access request is the remaining data access request; assign i=i+1, return to the step of obtaining the number m of data access requests already existing in the current real-time leaky bucket for the ith candidate data access request, and comparing m with M, until i=h.
[0110] In one embodiment, the request response module 706 is further used to: select a regular data access request that does not meet the matching condition from the multiple data access requests; and perform response processing on the regular data access request.
[0111] In one embodiment, the device also includes a concurrency limit adjustment module, which is used to: after completing the response processing of the current data access request among multiple data access requests, obtain the time period data flow in the current time period; the time period data flow is the total data flow corresponding to the data access requests that have completed the response processing in the current time period, and the current time period refers to the time period between the current moment and the last update moment, and the last update moment refers to the historical moment when the concurrency limit number was last updated; if the duration of the current time period is greater than or equal to the preset duration, determine the bandwidth of the current time period based on the time period data flow; update the concurrency limit number based on the bandwidth to obtain the updated concurrency limit number; update the bucket size of the concurrent leaky bucket based on the updated concurrency limit number to obtain the updated bucket size; the updated bucket size is used to guide the processing of new data access requests when new data access requests are received in the next time period.
[0112] In one embodiment, the concurrency limit adjustment module is further used to: obtain the bandwidth lower limit value and the bandwidth upper limit value of the preset bandwidth interval; if the bandwidth is less than the bandwidth lower limit value, increase the concurrency limit number to obtain the updated concurrency limit number; if the bandwidth is less than the bandwidth lower limit value, reduce the concurrency limit number to obtain the updated concurrency limit number; if the bandwidth is within the preset bandwidth interval, determine the concurrency limit number as the updated concurrency limit number.
[0113] Each module in the above-mentioned data access request processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0114] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG8. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data to be processed. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for processing a data access request is implemented.
[0115] Those skilled in the art will understand that the structure shown in FIG. 8 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0116] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0117] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0118] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0119] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0120] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0122] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for processing a data access request, characterized in that: The method comprises: When multiple data access requests are received, selecting a candidate data access request that meets a matching condition from the multiple data access requests; Based on the bucket size of the concurrent leaky bucket corresponding to the current time period, control the target data access request in the candidate data access request to enter the concurrent leaky bucket; the number of the target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number; A response process is performed on each target data access request in the concurrent leaky bucket, and a blocking process is performed on the remaining data access requests in the candidate data access requests.
2. The method according to claim 1, characterized in that The concurrency limit number is H, the concurrent leaky bucket includes a real-time leaky bucket and an instantaneous leaky bucket, the bucket size of the real-time leaky bucket is M, the bucket size of the instantaneous leaky bucket is N, M and N are integers greater than or equal to 1, and M+N=H; the target data access request includes a first data access request and a second data access request; The controlling the target data access request in the candidate data access request to enter the concurrent leaky bucket based on the bucket size of the concurrent leaky bucket corresponding to the current time period includes: Based on the bucket size of the real-time leaky bucket corresponding to the current time period, control the first data access request among the candidate data access requests to enter the real-time leaky bucket, and based on the bucket size of the instantaneous leaky bucket corresponding to the current time period, control the second data access request among the candidate data access requests to enter the instantaneous bucket; The number of the first data access requests is less than or equal to M, the number of the second data access requests is less than or equal to N, and the response processing priority of the real-time leaky bucket is higher than the processing priority of the instantaneous leaky bucket.
3. The method according to claim 2, characterized in that The number of candidate data access requests is h; controlling a first data access request among the candidate data access requests to enter a real-time leaky bucket, and controlling a second data access request among the candidate data access requests to enter a transient bucket, comprises: For the i-th candidate data access request, obtain the number m of data access requests that exist in the current real-time leaky bucket, and compare m with M; If m<M, determine the i-th candidate data access request as the first data access request, and control the first data access request to enter the real-time leaky bucket; If m=M, obtain the number n of data access requests existing in the current instantaneous leaky bucket, and compare n with N. If n<N, determine that the i-th candidate data access request is the second data access request, and control the second data access request to enter the instantaneous leaky bucket. If n=N, determine that the i-th candidate data access request is the remaining data access request; Assign i=i+1, return the step of obtaining the number m of data access requests existing in the current real-time leaky bucket for the i-th candidate data access request, and compare m with M until i=h.
4. The method according to claim 1, characterized in that: The method further comprises: Selecting a regular data access request that does not meet the matching condition from the multiple data access requests; The conventional data access request is responded to and processed.
5. The method according to claim 4, characterized in that The method further comprises: After completing the response processing of the current data access request among the multiple data access requests, obtaining the period data flow in the current period; the period data flow is the total data flow corresponding to the data access requests whose response processing is completed in the current period, the current period refers to the time period between the current moment and the last update moment, and the last update moment refers to the historical moment when the concurrent limit quantity is last updated; If the duration of the current time period is greater than or equal to the preset duration, determining the bandwidth of the current time period based on the data flow of the time period; The concurrent limit quantity is updated based on the bandwidth to obtain an updated concurrent limit quantity; The bucket size of the concurrent leaky bucket is updated based on the updated concurrent limit quantity to obtain an updated bucket size; the updated bucket size is used to guide the processing of new data access requests when new data access requests are received in the next time period.
6. The method according to claim 5, characterized in that The updating of the concurrent limit quantity based on the bandwidth to obtain an updated concurrent limit quantity includes: Obtain the lower and upper bandwidth limits of the preset bandwidth range; If the bandwidth is less than the bandwidth lower limit, increase the concurrent limit number to obtain an updated concurrent limit number; If the bandwidth is less than the bandwidth lower limit, the concurrent limit number is reduced to obtain an updated concurrent limit number; If the bandwidth is within the preset bandwidth range, the concurrent limit quantity is determined as the updated concurrent limit quantity.
7. A data access request processing device, characterized in that: The device comprises: A data access request selection module, configured to select a candidate data access request that meets a matching condition from among the multiple data access requests when multiple data access requests are received; A leaky bucket control module, used to control the target data access request in the candidate data access request to enter the concurrent leaky bucket based on the bucket size of the concurrent leaky bucket corresponding to the current time period; the number of the target data access requests is not greater than the bucket size of the concurrent leaky bucket, and the bucket size is equal to the concurrent limit number; The request response module is used to respond to each target data access request in the concurrent leaky bucket and block the remaining data access requests in the candidate data access requests.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Access amount control method and device
CN108512768A
Hotspot data flow limiting control method, device and equipment and storage medium
CN113179222A
Content distribution network hotspot analysis method and system
CN114221988A
Interface request processing method and device, server and server cluster
CN115269643A
Service flow limiting method and device, computer equipment and storage medium
CN115987902A