CN116112442A - Request response method, request response device, computer device, storage medium, and program product - Google Patents

Request response method, request response device, computer device, storage medium, and program product Download PDF

Info

Publication number
CN116112442A
CN116112442A CN202211732988.1A CN202211732988A CN116112442A CN 116112442 A CN116112442 A CN 116112442A CN 202211732988 A CN202211732988 A CN 202211732988A CN 116112442 A CN116112442 A CN 116112442A
Authority
CN
China
Prior art keywords
target
access request
tokens
token bucket
token
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211732988.1A
Other languages
Chinese (zh)
Inventor
张�林
安培
张小勇
杨志欣
王有富
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dawning Information Industry Co Ltd
Original Assignee
Dawning Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Dawning Information Industry Co Ltd filed Critical Dawning Information Industry Co Ltd
Priority to CN202211732988.1A priority Critical patent/CN116112442A/en
Publication of CN116112442A publication Critical patent/CN116112442A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/215Flow control; Congestion control using token-bucket
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/24Traffic characterised by specific attributes, e.g. priority or QoS
    • H04L47/2441Traffic characterised by specific attributes, e.g. priority or QoS relying on flow classification, e.g. using integrated services [IntServ]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/56Queue scheduling implementing delay-aware scheduling

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application relates to a request response method, apparatus, computer device, storage medium and computer program product. The method comprises the following steps: after receiving a target access request for a data storage system, determining a target token bucket from a plurality of token buckets according to target attribute information of the target access request; extracting tokens from the target token bucket according to the target access request; responding to the target access request according to the number of tokens remained in the target token bucket after the token extraction. The service quality of the HDFS can be improved by adopting the method.

Description

Request response method, request response device, computer device, storage medium, and program product
Technical Field
The present disclosure relates to the field of cloud storage systems, and in particular, to a request response method, apparatus, computer device, storage medium, and computer program product.
Background
In recent years, with the development of the big data industry in China, an HDFS (Hadoop Distributed File System, distributed file system) serving as big data base equipment is rapidly developed, the HDFS can provide high-throughput data access, and is very suitable for being applied to a large-scale data set, and in order to cope with the challenge of increasing the data access capacity of big data development, the HDFS develops QoS characteristics to balance the resource requirements of different users, namely resource allocation, through a current limiting method.
In the conventional technology, a QoS flow limiting method based on weights is generally used for resource allocation, and different users are marked with different weights by the method, and the resource allocation is performed based on the marked weights.
However, since this method is a relative current limitation, and lacks quantitative control, accurate resource allocation cannot be performed, resulting in poor quality of service of the HDFS.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a request response method, apparatus, computer device, computer readable storage medium, and computer program product that can improve the quality of HDFS service.
In a first aspect, the present application provides a request response method. The method comprises the following steps:
after receiving a target access request for a data storage system, determining a target token bucket from a plurality of token buckets according to target attribute information of the target access request; extracting tokens from the target token bucket according to the target access request; responding to the target access request according to the number of tokens remained in the target token bucket after the token extraction.
In one embodiment, the plurality of token buckets respectively correspond to attribute information of different dimensions, and the determining a target token bucket from the plurality of token buckets according to the target attribute information of the access request includes: and determining the target token bucket corresponding to the target attribute information of each dimension from the plurality of token buckets according to the target attribute information of each different dimension of the target access request.
In one embodiment, extracting tokens from the target token bucket according to the target access request includes: determining a request type of the target access request; determining a target number of extracted tokens from the target token bucket according to the request type; tokens are extracted from the target token bucket according to the target number.
In one embodiment, responding to the target access request according to the number of tokens remaining in the target token bucket after token extraction includes: if the number of the target token buckets is a plurality of, determining a candidate token bucket with the least number of the remaining tokens after the token extraction from the plurality of the target token buckets; responding to the target access request according to the number of tokens remaining in the candidate token bucket.
In one embodiment, responding to the target access request according to the number of tokens remaining in the target token bucket after token extraction includes: if the number of the remaining tokens of the target token bucket after the token extraction is greater than or equal to 0, immediately responding to the target access request; and if the number of the remaining tokens of the target token bucket after the token extraction is smaller than 0, carrying out delay response on the target access request.
In one embodiment, the method further comprises: detecting a replenishing time period required for replenishing the number of tokens in the target token bucket to 0 or more under the condition that the number of tokens in the target token bucket is smaller than 0; detecting whether the supplementing time length is larger than the maximum time length allowed by the delay response; if not, executing the operation of extracting the token from the target token bucket according to the target access request; if yes, returning a revisit instruction to the client side which sends the target access request.
In one embodiment, the time-delay response to the target access request includes: determining delay time according to the number of the remaining tokens of the target token bucket after the token extraction; and carrying out delay processing on the target access request according to the delay time.
In one embodiment, the delaying the target access request according to the delay time length includes: determining a target node from the annular array of the time wheel delay queue according to the delay time length; and storing the target access request into a timing task queue corresponding to the target node to wait for scheduling.
In one embodiment, the method further comprises: after the target access request is responded, acquiring the time-consuming time length for processing the target access request; determining the number of tokens actually consumed by the target access request according to the time-consuming time length for processing the target access request; and if the number of the actually consumed tokens is inconsistent with the number of the tokens extracted from the target token bucket, correcting the number of the tokens in the target token bucket.
In a second aspect, the present application further provides a request response device. The device comprises:
the determining module is used for determining a target token bucket from a plurality of token buckets according to target attribute information of a target access request after receiving the target access request for the data storage system;
The extraction module is used for extracting tokens from the target token bucket according to the target access request;
and the response module is used for responding to the target access 5 request according to the number of the tokens remained in the target token bucket after the token is extracted.
In one embodiment, the determining module is specifically configured to: and determining the target token bucket corresponding to the target attribute information of each dimension from the plurality of token buckets according to the target attribute information of each different dimension of the target access request.
In one embodiment, the extraction module is specifically configured to: determining a request type 0 of the target access request; determining a target number of extracted tokens from the target token bucket according to the request type; tokens are extracted from the target token bucket according to the target number.
In one embodiment, the response module is specifically configured to: if the number of the target token buckets is a plurality of, determining a candidate token bucket with the least number of the remaining tokens after the token extraction from the plurality of the target token buckets; responding to the target access request according to the number of tokens remaining in the candidate token bucket.
5 in one embodiment, the response module is further specifically configured to: if the number of the remaining tokens of the target token bucket after the token extraction is greater than or equal to 0, immediately responding to the target access request; and if the number of the remaining tokens of the target token bucket after the token extraction is smaller than 0, carrying out delay response on the target access request.
In one embodiment, the extraction module is further specifically configured to: number of tokens in the target token bucket
Detecting a 0-replenishment time period required for replenishing the number of tokens in the target token bucket to 0 or more under the condition of being less than 0; detecting whether the supplementing time length is larger than the maximum time length allowed by the delay response; if not, then execute
Extracting tokens from the target token bucket according to the target access request; if yes, returning a revisit instruction to the client side which sends the target access request.
In one embodiment, the response module is specifically configured to: determining delay time according to the number of the remaining tokens of the target token bucket after the token extraction; and carrying out delay processing on the target access request according to the delay time. 5 in one embodiment, the response module is further specifically configured to: determining a target node from the annular array of the time wheel delay queue according to the delay time length; and storing the target access request into a timing task queue corresponding to the target node to wait for scheduling.
In one embodiment, the request response device further comprises a correction module for: after the target access request is responded, acquiring the time-consuming time length for processing the target access request; determining the number of tokens actually consumed by the target access request according to the time-consuming time length for processing the target access request; and if the number of the actually consumed tokens is inconsistent with the number of the tokens extracted from the target token bucket, correcting the number of the tokens in the target token bucket.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the steps of any of the above first aspects when the computer program is executed.
In a fourth aspect, the present application also provides a computer-readable storage medium. A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of any of the first aspects described above.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprising a computer program which, when executed by a processor, implements the steps of any of the first aspects described above.
The request response method, the request response device, the computer equipment, the storage medium and the computer program product are characterized in that after receiving a target access request for a data storage system, a target token bucket is determined from a plurality of token buckets according to target attribute information of the target access request, tokens are extracted from the target token bucket according to the target access request, and the response is carried out on the target access request according to the number of the remaining tokens of the target token bucket after the token extraction. The request response method provided by the application is used for responding to the target access request according to the number of the residual tokens in the target token bucket, and the token bucket can be used for limiting the speed and controlling the flow, so that the process of responding to the target access request by the data storage system can be controlled by setting the maximum number of the tokens which can be accommodated by the token bucket and the speed of injecting new tokens, global current limiting for a user is realized, the resource demand of the user is effectively and quantitatively controlled, more accurate resource allocation is realized, and the service quality of the HDFS is further improved.
Drawings
FIG. 1 is an application environment diagram of a request response method in one embodiment;
FIG. 2 is a flow diagram of a request response method in one embodiment;
FIG. 3 is a schematic diagram of a distributed file system in one embodiment;
FIG. 4 is a schematic diagram of the operation of a token bucket in one embodiment;
FIG. 5 is a flow chart of a request response method according to another embodiment;
FIG. 6 is a flow chart of a request response method according to another embodiment;
FIG. 7 is a flow chart of a request response method according to another embodiment;
FIG. 8 is a flow chart of a request response method according to another embodiment;
FIG. 9 is a flow chart of a request response method according to another embodiment;
FIG. 10 is a flow chart of a request response method according to another embodiment;
FIG. 11 is a schematic diagram of a time wheel delay queue in one embodiment;
FIG. 12 is a flow chart of a request response method according to another embodiment;
FIG. 13 is a flow chart of a request response method according to another embodiment;
FIG. 14 is a block diagram of a request response device in one embodiment;
FIG. 15 is a block diagram of a request response device in another embodiment;
fig. 16 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Cloud storage is a new concept extending from the concept of cloud computing, and refers to a technology for integrating and cooperating massive heterogeneous storage devices through application software and a high-speed network to provide large-scale data storage and access functions together by applying a cluster technology, a virtual finding technology, a distributed file system technology and the like. In short, all basic service contents are stored on a plurality of computers, and a unified mass storage space is formed by utilizing the limited storage space on the multi-aggregate computer to provide services to the outside. Among them, cloud storage systems, i.e., distributed file systems (Hadoop Distributed File System, HDFS) in general, are the most critical technologies for cloud storage, and are the most important components thereof.
QoS (Quality of Service ) refers to a series of service requirements that a network needs to meet when transmitting a data stream, is a quality convention for information transmission and sharing between the network and users and between users communicating with each other on the network, and is used as a security mechanism, where QoS is mainly used to solve the problems of network delay and blocking, and can be specifically quantized into performance indexes such as a bandwidth bid delay, a delay jitter, a loss rate, and a throughput.
In recent years, with the development of the large data industry in China, the HDFS serving as a large data base device is rapidly developed, and the HDFS can provide high-throughput data access and is very suitable for being applied to a large-scale data set.
In the conventional technology, a QoS flow limiting method based on weights is generally used for resource allocation, and different users are marked with different weights by the method, and the resource allocation is performed based on the marked weights.
However, since this method is a relative current limitation, and lacks quantitative control, accurate resource allocation cannot be performed, resulting in poor quality of service of the HDFS.
In view of this, the present application provides a request response method for improved HDFS service quality.
The request response method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. The terminal 102 communicates with the server 104 through a network, and the server 104 is a node of a data storage system, which may be an HDFS system, for example. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a request response method is provided, which includes the following steps:
step 201, after receiving a target access request for a data storage system, determining a target token bucket from a plurality of token buckets according to target attribute information of the target access request.
The data storage system may be a distributed file system, where a physical storage resource managed by the file system is not necessarily directly connected to a local node, but is connected to a node (which may be simply understood as a computer) through a computer network, or a complete hierarchical file system formed by combining several different logical disk partitions or volume labels.
The distributed file system mainly comprises two parts, as shown in fig. 3, one part is a global single node naminode, which is mainly used for storing metadata information of files, such as file directory structures, file owners, directory file rights and the like, and the other part is a laterally expandable Datanode, which is mainly used for storing file contents.
In one possible implementation, as shown in fig. 3, a Client (Client) may access the entire distributed file system on behalf of a user through interaction of naminode and datinode, and specifically, when the Client (Client) performs a file operation on behalf of the user, the Client may be divided into two steps, one step is Metadata operation (Metadata ops), such as adding or deleting a directory or a file, and the other step is data (blocks ops) operation, for example, the distributed file system may divide the content of the file into multiple blocks (default 128M size) and then form logically redundant copies through multiple copies (replicas) or mechanisms of EC erasure codes, which are respectively stored in different datinode nodes, so that the problem of data loss when a single node is not available can be avoided.
The target access request may be a request sent by a visitor to access the data storage system.
In one possible implementation, the target access request may be obtained by a request.
The target attribute information of the target access request may include an access form of a visitor transmitting the target access request, an object to be specifically accessed by the target access request, and a service level of the visitor.
The token bucket, i.e., token bucket algorithm, may be used for network traffic shaping and may also be used to limit the rate.
In one possible implementation, as shown in fig. 4, it may be understood that the token bucket is a bucket storing tokens with a fixed capacity, each token represents a certain resource, a fixed number of tokens may be put into the token bucket according to a fixed period, the shorter the fixed period, the more accurate and smoother the rate control of the token bucket, the higher the performance consumption will be correspondingly increased, when the tokens in the bucket reach the fixed upper capacity limit, the newly added tokens will be discarded or refused, so as to ensure that the tokens in the bucket cannot exceed the upper limit, when a service needs to be processed, a certain number of tokens are generally taken out from the bucket as a credential for acquiring the resource according to the actual situation, and if the tokens are insufficient, the service will be limited, i.e. the new tokens are directly discarded, refused or waiting until the tokens in the bucket are enough.
Optionally, there are a corresponding different plurality of target token buckets according to the target attribute information of the different target access requests.
The target token bucket refers to a token bucket corresponding to an access form of a visitor sending the target access request in the target attribute information in a plurality of token buckets or a token bucket corresponding to an object specifically to be accessed by the target access request.
Step 202, extracting tokens from the target token bucket according to the target access request.
In one possible implementation, after determining the target token bucket according to the target attribute information of the target access request, the token required by the target access request may be fetched in the target token bucket.
And 203, responding to the target access request according to the number of tokens remained in the target token bucket after the token extraction.
In one possible implementation, the token bucket delivery rate may represent a rate at which the data storage system processes access requests, so that it may be determined, according to the number of tokens remaining in the target token bucket after token extraction, whether the data storage system may process the target access request in time, and, correspondingly, if the target access request may be processed in time, the response may be to place the target access request in a scheduling queue, and if the target access request cannot be processed in time, the response may be to place the target access request in a delay queue.
The request response method, the request response device, the computer equipment, the storage medium and the computer program product, after receiving a target access request for a data storage system, determining a target token bucket from a plurality of token buckets according to target attribute information of the target access request; extracting tokens from the target token bucket according to the target access request; responding to the target access request according to the number of tokens remained in the target token bucket after the token extraction. The request response method provided by the application is used for responding to the target access request according to the number of the residual tokens in the target token bucket, and the token bucket can be used for limiting the speed and controlling the flow, so that the process of responding to the target access request by the data storage system can be controlled by setting the maximum number of the tokens which can be accommodated by the token bucket and the speed of injecting new tokens, global current limiting for a user is realized, the resource demand of the user is effectively and quantitatively controlled, more accurate resource allocation is realized, and the service quality of the HDFS is further improved.
In one embodiment, a plurality of token buckets respectively correspond to attribute information of different dimensions, and determining a target token bucket from the plurality of token buckets according to target attribute information of the access request includes: and determining the target token bucket corresponding to the target attribute information of each dimension from the plurality of token buckets according to the target attribute information of each different dimension of the target access request.
As described above, the target attribute information of the target access request may include an access form of a visitor sending the target access request, an object specifically to be accessed by the visitor, and a service level of the visitor, where the access form of the visitor may include a user and an IP, which may be understood that the visitor accesses the data storage system in the form of the user, and the visitor may also access the data storage system in the form of the IP.
The specific object to be accessed by the visitor can be understood as which part of the data storage system the visitor specifically accesses, and if 3 directories, namely an A directory, a B directory and a C directory exist in the data storage system, the specific object to be accessed by the target access request can be any one or more of the A directory, the B directory and the C directory.
The visitor's service level may be used to determine the importance of the user, assuming that the service level has two levels, one being a high service level, i.e., VIP user, and the second being a low service level, i.e., non-VIP user.
Optionally, according to a plurality of different token buckets corresponding to different existence of the target attribute information in the target access request, the token buckets corresponding to the target attribute information in the target access request are all target token buckets.
In one possible implementation, assuming that an existing visitor accesses the data storage system in the form of a user, the object to be accessed by the visitor is an a directory and a B directory in the data storage system, and the service level of the visitor is one level, the target token bucket is a VIP user token bucket, an a directory VIP token bucket and a B directory VIP token bucket, respectively.
In another possible implementation manner, assuming that an existing visitor accesses the data storage system in the form of a user, an object to be accessed by the visitor is an a directory in the data storage system, and a service level of the visitor is two levels, the target token bucket is a non-VIP user token bucket and an a directory non-VIP token bucket respectively.
According to the method, the corresponding token buckets are set according to the target attribute information of the target access request in different dimensions, and the target token buckets corresponding to the target attribute information of the target access request in different dimensions are determined from the token buckets according to the target attribute information of the target access request in different dimensions, so that the current limit of the access request for the dimensions is realized.
In one embodiment, as shown in fig. 5, extracting tokens from the target token bucket according to the target access request includes the steps of:
Step 501, determining the request type of the target access request.
Alternatively, the request type of the target access request may be read file, write file, and delete file.
In one possible implementation, the request type of the target access request may be determined by performing an algorithm on the target access request and then determining the request type of the target access request according to a result of the algorithm.
Step 502, determining a target number of extracted tokens from the target token bucket according to the request type.
The target number can be set in advance by a technician, and optionally, the target number can be determined according to the statistical time-consuming time length corresponding to each different type of access request by performing statistical processing on the time-consuming time length of the metadata node processing the historical access request in the data storage system.
In one possible implementation, if the request type is a read file, the target number may be set to 3 tokens.
In another possible implementation, if the request type is a write file, the target number may be set to 4 tokens.
In another possible implementation, if the request type is a pruned file, the target number may be set to 5 tokens.
Step 603, extracting tokens from the target token bucket according to the target number.
In one possible implementation, if the type of the target request is a read file, the corresponding target number of the target request is 3 tokens, and 3 tokens are extracted from the target token bucket corresponding to the target request.
In another possible implementation manner, if the type of the target request is a write file, the corresponding target number of the target request is 4 tokens, and 4 tokens are extracted from the target token bucket corresponding to the target request.
In another possible implementation manner, if the type of the target request is a deleted file, the corresponding target number of the target request is 5 tokens, and then 5 tokens are extracted from the target token bucket corresponding to the target request.
The method for extracting the target number of tokens from the target token bucket according to the request type of the target access request can effectively monitor the processing request rate of the data storage system.
In one embodiment, as shown in fig. 6, responding to the target access request according to the number of tokens remaining in the target token bucket after token extraction, includes the following steps:
And 601, if the number of the target token buckets is a plurality of, determining a candidate token bucket with the least number of tokens left after the extraction of the tokens from the target token buckets.
The candidate token bucket is a target token bucket with the least number of tokens remaining after token extraction among a plurality of target token buckets.
In one possible implementation manner, if the target access request corresponds to a plurality of target token buckets, for example, a directory a token bucket, a directory B token bucket, and a user token bucket, and the type of the target access request is a write file, 3 tokens need to be extracted from all three token buckets, after extracting the tokens, the number of remaining tokens in the directory a token bucket is 10, the number of remaining tokens in the directory B token bucket is 8, and the number of remaining tokens in the user token bucket is 1, and then the user token bucket is determined to be a candidate token bucket.
Step 602, responding to the target access request according to the number of tokens remained in the candidate token bucket.
In one possible implementation manner, since the candidate token bucket is the target token bucket with the least number of tokens remaining in the target token buckets after the extraction of the tokens, the response to the target access request is performed according to the number of tokens remaining in the candidate token bucket, so that the problem that the data storage system is paralyzed can be avoided to the greatest extent, the stability of the data storage system is improved, and the service quality of the HDFS is further improved.
In one embodiment, as shown in fig. 7, the response to the target access request according to the number of tokens remaining in the target token bucket after the token extraction includes the following steps:
and 701, if the number of the remaining tokens in the target token bucket after the token extraction is greater than or equal to 0, immediately responding to the target access request.
The even response may be to place the target access request in a dispatch queue to facilitate processing of the target access request by the data storage system.
And 702, if the number of the remaining tokens in the target token bucket after the token extraction is smaller than 0, performing delay response on the target access request.
The delayed response may be to delay the target access request, or to return a revisit indication to the client that sent the target access request.
According to the method for responding to the target access request according to the number of the remaining tokens of the target token bucket after the token extraction, whether the data storage system can timely process the access request can be determined according to the number of the remaining tokens, and real-time monitoring of the data storage system is achieved.
In one embodiment, as shown in fig. 8, in the case that the number of tokens in the target token bucket is less than 0, the method includes the following steps:
Step 801, detecting a replenishment time period required for replenishing the number of tokens in the target token bucket to 0 or more when the number of tokens in the target token bucket is smaller than 0.
In one possible implementation manner, if the target access request needs to take 5 tokens in the target token bucket, but only 3 tokens are in the target token bucket at this time, after the target access request takes the required tokens from the target token bucket, the remaining number of the tokens in the target token bucket is-2, and if the target token delivery rate is 10 tokens per second, the number of the tokens in the target token bucket is supplemented to be greater than or equal to 0, and the supplementing duration required by the target token bucket is 0.2 seconds.
Step 802, detecting whether the complementary time period is greater than a maximum time period allowed by the delayed response.
The maximum allowable duration of the delay response may be set in advance by a technician, mainly according to a delay queue set as described below, and the specific principle will be described in detail below, which will not be repeated here.
Step 803, if not, executing the operation of extracting the token from the target token bucket according to the target access request.
In one possible implementation, assuming that the maximum allowable duration of the delayed response is 1 minute and the complementary duration is 20 seconds, the complementary duration is less than the maximum allowable duration of the delayed response, and the token may be fetched from the token bucket according to the type of the target access request.
And 904, if so, returning a revisit instruction to the client side which sends the target access request.
The re-access indication is used to alert the client to re-access the data storage system.
In one possible implementation, assuming that the maximum allowable duration of the delayed response is 1 minute and the complementary duration is 80 seconds, the complementary duration is greater than the maximum allowable duration of the delayed response, and a revisit instruction is returned to the client that sends the target access request to remind the client to revisit the data storage system.
Under the condition that the number of tokens in the target token bucket is smaller than 0, detecting whether the supplementing time required for supplementing the number of tokens in the target token bucket to be greater than or equal to 0 is greater than the maximum time allowed by the delayed response, judging whether to execute the operation of extracting the tokens from the target token bucket according to the target access request or return a re-access instruction to the client side sending the target access request according to the detection result, and avoiding the visitor from waiting for a long time when the data storage system cannot timely process the access request due to the overlarge access amount, thereby effectively improving the service quality of the HDFS system.
In one embodiment, as shown in fig. 9, after performing the operation of extracting tokens from the target token bucket according to the target access request, the method includes the steps of:
step 901, determining delay time according to the number of tokens remained in the target token bucket after the extraction of the tokens.
In one possible implementation manner, if the target token bucket can accommodate 20 tokens in total, and the delivery rate of the target token bucket is 10 tokens per second, after the target access request extracts the tokens, and there are 4 remaining tokens in the target token bucket, the delay time is the sum of a first replenishment time and a second replenishment time, where the first replenishment time is a time required for replenishing the number of tokens in the target token bucket to 0 or more, and the second replenishment time is a time required for replenishing the number of tokens in the target token bucket from 0 to the maximum token capacity of the target token bucket, and the delay time is 2.4 seconds.
And 902, carrying out delay processing on the target access request according to the delay time length.
The deferred processing refers to placing the target access request in a deferred queue.
In one possible implementation, the delay queue may be a time-round delay queue.
In one embodiment, as shown in fig. 10, the delay processing is performed on the target access request according to the delay time length, and the method includes the following steps:
step 1001, determining a target node from the ring array of the time round delay queue according to the delay time length.
The structure of the time wheel delay queue may be shown in fig. 11, the implementation principle is similar to that of a clock commonly seen in our daily life, the minimum scheduling time of the time wheel delay queue (generally called a tick, that is, a pointer in a clock is jumped once) and the total time length of a scheduling cycle (delay scheduling exceeding the total time length cannot be performed) may be set in advance by a technician, the maximum time length allowed by the delay response may be understood as the total time length of the time wheel delay queue for one scheduling cycle, the time wheel delay queue may also generate a ring array structure as shown in fig. 11 according to the tick time and the cycle total time, the array length is the cycle total time length divided by the tick time, the array object is a timing task queue, that is, all nodes in the ring array are scheduled once, so as to complete one overall scheduling cycle, a time pointer is further provided in the time wheel delay queue, the node pointed by the time pointer may be pointed to any node, and the node may be marked as the current scheduling node, that may be put into the scheduling queue.
In one possible implementation, assuming that the total duration of one scheduling cycle of the time round delay queue is 160 seconds and each tick time is 10 seconds, a ring array as shown in fig. 11 is generated, if the delay duration of the target request is 20 seconds, the delay duration may be divided by the tick time, if the location pointed by the time pointer is 1 at this time, the target node may be determined to be (2+1), and if the location pointed by the time pointer is 4 at this time, the target node may be determined to be (2+4).
Step 1002, storing the target access request in a timing task queue corresponding to the target node, so as to wait for scheduling.
This timed task queue may be as shown in fig. 11, since the time per tick may be long, the target node where there will be multiple access requests is the same, and thus a timed task queue is provided in each node.
In one possible implementation, if the target node determined according to the target access request is 3, the target access request is stored in a timed task queue of the target node.
In one embodiment, as shown in fig. 12, after the target access request is responded, the method includes the following steps:
Step 1201, after the target access request finishes responding, obtaining the time-consuming duration of processing the target access request.
In one possible implementation, the time-consuming duration of processing the target access request may be obtained at a metadata node in the data storage system.
Step 1202, determining the number of tokens actually consumed by the target access request according to the time-consuming time duration of processing the target access request.
As described above, the target number of tokens is extracted from the target token bucket according to the type of the target access request, and then the tokens are extracted from the target token bucket according to the target number, where the extracted token number can be understood as the time required by the data storage system to process the type of request.
Step 1203, if the number of tokens actually consumed is not consistent with the number of tokens extracted from the target token bucket, performing correction processing on the number of tokens in the target token bucket.
The correction process may be understood as a multiple-offset process, that is, if the number of tokens actually consumed by the data storage system to actually process the target access request is less than the target number, the token that is unnecessarily fetched is put back into the token bucket, and if the number of tokens actually consumed by the data storage system to actually process the target access request is greater than the target number, the corresponding token is fetched from the target token bucket.
In one possible implementation manner, assuming that the type of the target access request is a read file, the target number is 3 tokens, after the data storage system processes the target access request, the time-consuming duration of processing the target access request is obtained, and the number of tokens actually consumed by the target access request is determined to be 5 tokens, then correction processing is required to be performed on the number of tokens in a target token bucket, that is, 2 tokens are taken from the target token bucket.
In another possible implementation manner, assuming that the type of the target access request is a read file, the target number is 3 tokens, after the data storage system processes the target access request, the time-consuming duration of processing the target access request is obtained, and the number of tokens actually consumed by the target access request is determined to be 2 tokens, then correction processing is required to the number of tokens in a target token bucket, that is, 1 token is put into the target token bucket again.
After the target access request is responded, the number of tokens actually consumed by the target access request is determined according to the time-consuming time length for processing the target access request, and if the number of tokens actually consumed is inconsistent with the number of tokens extracted from the target token bucket, the method for correcting the number of tokens in the target token bucket can effectively improve the accuracy of resource allocation, so that the service quality of an HDFS system is improved.
As shown in fig. 13, an embodiment of the present application provides a request response method, which includes:
step 1301, performing statistics processing on time-consuming time periods of the historical access requests processed by metadata nodes in the data storage system to obtain statistical time-consuming time periods corresponding to attribute information of different dimensions, wherein the metadata nodes are nodes for storing file metadata in the data storage system.
Step 1302, determining attribute parameters of a token bucket corresponding to attribute information of each different dimension according to the statistical time-consuming time duration corresponding to the attribute information of each different dimension, where the attribute parameters include a rate of inputting tokens into the token bucket.
Step 1303, a target access request is received for the data storage system.
Step 1304, determining the target token bucket corresponding to the target attribute information of each dimension from the plurality of token buckets according to the target attribute information of each different dimension of the target access request.
Step 1305, determining the request type of the target access request.
Step 1306, determining a target number of extracted tokens from the target token bucket according to the request type.
Step 1307, extracting tokens from the target token bucket according to the target number.
If the number of the target token buckets is plural, determining a candidate token bucket with the least number of tokens remaining after the token extraction from the plural target token buckets, step 1308.
Step 1309, responding to the target access request according to the number of tokens remaining in the candidate token bucket, if the number of tokens remaining in the target token bucket after the token extraction is greater than or equal to 0, immediately responding to the target access request, and if the number of tokens remaining in the target token bucket after the token extraction is less than 0, delaying to respond to the target access request.
Step 1310, detecting a replenishment time period required for replenishing the number of tokens in the target token bucket to 0 or more, in the case that the number of tokens in the target token bucket is smaller than 0.
Step 1311, detecting whether the complementary time length is greater than the maximum time length allowed by the delayed response, if yes, returning a revisit instruction to the client side sending the target access request, and if not, executing the operation of extracting the token from the target token bucket according to the target access request.
And 1312, determining the delay time according to the number of the remaining tokens of the target token bucket after the token extraction.
Step 1313, determining a target node from the ring array of the time wheel delay queue according to the delay time length.
Step 1314, storing the target access request in a timing task queue corresponding to the target node, so as to wait for scheduling.
Step 1315, after the target access request is responded, obtaining a time-consuming duration for processing the target access request.
Step 1316, determining the number of tokens actually consumed by the target access request according to the time-consuming duration of processing the target access request.
Step 1317, if the number of tokens actually consumed is not consistent with the number of tokens extracted from the target token bucket, performing correction processing on the number of tokens in the target token bucket.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a request response device for realizing the request response method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the request response device provided below may refer to the limitation of the request response method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 14, the present application also provides a request response device 1400. Comprising the following steps: a determining module 1401, an extracting module 1402, a responding module 1403, wherein:
a determining module 1401, configured to determine, after receiving a target access request for a data storage system, a target token bucket from a plurality of token buckets according to target attribute information of the target access request;
an extracting module 1402, configured to extract tokens from the target token bucket according to the target access request;
a response module 1403 is configured to respond to the target 5 access request according to the number of tokens remaining in the target token bucket after token extraction.
In one embodiment, the determining module 1401 is specifically configured to: and determining the target token bucket corresponding to the target attribute information of each dimension from the plurality of token buckets according to the target attribute information of each different dimension of the target access request.
In one embodiment, the extraction module 1402 is specifically configured to: determining a request 0 type of the target access request; determining a target number of extracted tokens from the target token bucket according to the request type; according to the following
The target number extracts tokens from the target token bucket.
In one embodiment, the response module 1403 is specifically configured to: if the number of the target token buckets is a plurality of, determining a candidate token bucket with the least number of the remaining tokens after the token extraction from the plurality of the target token buckets; responding to the target access request according to the number of tokens remaining in the candidate token bucket.
5 in one embodiment, the response module 1403 is further specifically configured to: if the number of the remaining tokens of the target token bucket after the token extraction is greater than or equal to 0, immediately responding to the target access request; and if the number of the remaining tokens of the target token bucket after the token extraction is smaller than 0, carrying out delay response on the target access request.
In one embodiment, the extraction module 1402 is further specifically configured to: detecting a replenishment time period required for replenishing the number of tokens in the target token bucket to 0 or more under the condition that the number of tokens in the target token bucket is less than 0; detecting whether the supplementing time length is larger than the maximum time length allowed by the delay response; if not, the method comprises the steps of,
Then performing an operation of extracting tokens from the target token bucket according to the target access request; if yes, returning a revisit instruction to the client side which sends the target access request.
In one embodiment, the response module 1403 is further specifically configured to: determining delay time according to the number of the remaining tokens of the target token bucket after the token extraction; and carrying out delay 5 time processing on the target access request according to the delay time.
In one embodiment, the response module 1403 is further specifically configured to: determining a target node from the annular array of the time wheel delay queue according to the delay time length; and storing the target access request into a timing task queue corresponding to the target node to wait for scheduling.
In one embodiment, as shown in FIG. 15, another request response device 1500 is provided, the request response device 1500 including a correction module 1404 in addition to the modules included in the request response device 1400.
In one embodiment, the correction module 1404 is configured to: after the target access request is responded, acquiring the time-consuming time length for processing the target access request; determining the number of tokens actually consumed by the target access request according to the time-consuming time length for processing the target access request; and if the number of the actually consumed tokens is inconsistent with the number of the tokens extracted from the target token bucket, correcting the number of the tokens in the target token bucket.
The various modules in the request response device described above may be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 16. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured 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, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a request response method.
It will be appreciated by those skilled in the art that the structure shown in fig. 16 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the computer device to which the present application is applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of any of the embodiments described above when executing the computer program.
In one embodiment, a computer readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, implements the steps of any of the embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of any of the embodiments described above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to comply with the related laws and regulations and standards of the related countries and regions.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (13)

1. A method of request response, the method comprising:
after receiving a target access request for a data storage system, determining a target token bucket from a plurality of token buckets according to target attribute information of the target access request;
extracting tokens from the target token bucket according to the target access request;
and responding to the target access request according to the number of the remaining tokens of the target token bucket after the token extraction.
2. The method of claim 1, wherein the plurality of token buckets respectively correspond to attribute information of different dimensions, and wherein the determining the target token bucket from the plurality of token buckets according to the target attribute information of the access request comprises:
and determining the target token buckets corresponding to the target attribute information of each dimension from the plurality of token buckets according to the target attribute information of each different dimension of the target access request.
3. The method according to claim 1 or 2, wherein said extracting tokens from said target token bucket according to said target access request comprises:
determining a request type of the target access request;
determining a target number of extracted tokens from the target token bucket according to the request type;
and extracting tokens from the target token bucket according to the target quantity.
4. The method according to claim 1 or 2, wherein said responding to said target access request according to the number of tokens remaining in said target token bucket after token extraction comprises:
if the number of the target token buckets is a plurality of, determining a candidate token bucket with the least number of the remaining tokens after the token extraction from the plurality of the target token buckets;
Responding to the target access request according to the number of tokens remained in the candidate token bucket.
5. The method according to claim 1 or 2, wherein said responding to said target access request according to the number of tokens remaining in said target token bucket after token extraction comprises:
if the number of the remaining tokens of the target token bucket after the token extraction is greater than or equal to 0, immediately responding to the target access request;
and if the number of the residual tokens of the target token bucket after the token extraction is smaller than 0, carrying out delay response on the target access request.
6. The method of claim 5, wherein the method further comprises:
detecting a replenishing time period required for replenishing the number of tokens in the target token bucket to 0 or more under the condition that the number of tokens in the target token bucket is smaller than 0;
detecting whether the supplementing time length is larger than the maximum time length allowed by the delay response;
if not, executing the operation of extracting the token from the target token bucket according to the target access request;
if yes, returning a revisit instruction to the client side which sends the target access request.
7. The method of claim 6, wherein the performing the operation of extracting tokens from the target token bucket according to the target access request comprises:
Determining delay time length according to the number of the remaining tokens of the target token bucket after the token extraction;
and carrying out delay processing on the target access request according to the delay time length.
8. The method of claim 7, wherein the delaying the target access request according to the delay time length comprises:
determining a target node from the annular array of the time wheel delay queue according to the delay time length;
and storing the target access request into a timing task queue corresponding to the target node to wait for scheduling.
9. The method according to claim 1 or 2, characterized in that the method further comprises:
after the target access request is responded, acquiring the time-consuming time length for processing the target access request;
determining the number of tokens actually consumed by the target access request according to the time-consuming time length for processing the target access request;
and if the number of the actually consumed tokens is inconsistent with the number of the tokens extracted from the target token bucket, correcting the number of the tokens in the target token bucket.
10. A request response device, the device comprising:
the determining module is used for determining a target token bucket from a plurality of token buckets according to target attribute information of a target access request after receiving the target access request for the data storage system;
The extraction module is used for extracting tokens from the target token bucket according to the target access request;
and the response module is used for responding to the target access request according to the number of the tokens remained in the target token bucket after the token is extracted.
11. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 9 when the computer program is executed.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 9.
13. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 9.
CN202211732988.1A 2022-12-30 2022-12-30 Request response method, request response device, computer device, storage medium, and program product Pending CN116112442A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211732988.1A CN116112442A (en) 2022-12-30 2022-12-30 Request response method, request response device, computer device, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211732988.1A CN116112442A (en) 2022-12-30 2022-12-30 Request response method, request response device, computer device, storage medium, and program product

Publications (1)

Publication Number Publication Date
CN116112442A true CN116112442A (en) 2023-05-12

Family

ID=86259180

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211732988.1A Pending CN116112442A (en) 2022-12-30 2022-12-30 Request response method, request response device, computer device, storage medium, and program product

Country Status (1)

Country Link
CN (1) CN116112442A (en)

Similar Documents

Publication Publication Date Title
US11836533B2 (en) Automated reconfiguration of real time data stream processing
US10447772B2 (en) Managed function execution for processing data streams in real time
US11711420B2 (en) Automated management of resource attributes across network-based services
US10831562B2 (en) Method and system for operating a data center by reducing an amount of data to be processed
CN107169083B (en) Mass vehicle data storage and retrieval method and device for public security card port and electronic equipment
US10719260B2 (en) Techniques for storing and retrieving data from a computing device
US20170364697A1 (en) Data interworking method and data interworking device
US9563426B1 (en) Partitioned key-value store with atomic memory operations
EP3513317A1 (en) Data serialization in a distributed event processing system
US10318346B1 (en) Prioritized scheduling of data store access requests
US10182104B1 (en) Automatic propagation of resource attributes in a provider network according to propagation criteria
US20170153909A1 (en) Methods and Devices for Acquiring Data Using Virtual Machine and Host Machine
CN111177237B (en) Data processing system, method and device
US11055223B2 (en) Efficient cache warm up based on user requests
US11888938B2 (en) Systems and methods for optimizing distributed computing systems including server architectures and client drivers
US9659041B2 (en) Model for capturing audit trail data with reduced probability of loss of critical data
CN113656370B (en) Data processing method and device for electric power measurement system and computer equipment
CN116009985A (en) Interface calling method, device, computer equipment and storage medium
US11762860B1 (en) Dynamic concurrency level management for database queries
CN116112442A (en) Request response method, request response device, computer device, storage medium, and program product
CN114860460A (en) Database acceleration method and device and computer equipment
CN116628042A (en) Data processing method, device, equipment and medium
CA3065157C (en) Parallel map and reduce on hash chains
CN110705736A (en) Macroscopic economy prediction method and device, computer equipment and storage medium
CN115604667B (en) Message sending method, device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination