Method, apparatus and device for controlling quality of service, and storage medium
Patent Information
- Application Number
- CN202311382565.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-24
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2043-10-24
AI Technical Summary
[0005]本发明提供一种服务质量的控制方法、装置、设备及存储介质,用以解决现有技术中设置在对象存储网关上的QoS服务无法准确的对用户的请求进行限制这一问题
[0047]本发明提供的一种服务质量的控制方法、装置、设备及存储介质,通过接收用户发送的请求信息,所述请求信息中包括用户标识;根据所述请求信息和服务质量配置信息确定目标限制数值;所述服务质量配置信息表示不同用户所对应的单位时间内的限制访问次数;根据所述请求信息确定目标服务节点,将所述请求信息和所述目标限制数值发送给所述目标服务节点,以使所述目标服务节点根据所述目标限制数值确定针对所述请求信息的响应结果;当两次请求信息相同时,则所述目标服务节点相同;接收所述目标服务节点返回的所述响应结果,并执行所述响应结果,通过对象存储网关接收请求信息并确定目标服务节点,使得目标服务节点确定是否对用户的请求信息进行限制,可以将同一用户对应的不同请求信息均分配给相同的服务节点,从而实现准确的对用户的请求进行限制。
Smart Images

Figure CN117459481B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of object storage technology, and in particular to a method, apparatus, device, and storage medium for controlling quality of service. Background Technology
[0002] Object storage, also known as object-based storage, is a type of computer data storage that manages data as objects.
[0003] Object storage clusters have limited resources, including network, disk I / O (Input / Output), and CPU (Central Processing Unit). Without rate limiting, when one user performs a heavy read / write operation, other users may experience slow upload speeds and timeouts because they cannot preempt resources. In this case, QoS policies need to be configured to limit each user's IOPS (Input / Output Operations Per Second) and read / write bandwidth when accessing object storage, achieving reasonable resource allocation. QoS (Quality of Service) refers to a network's ability to provide better service for specified network communications using various underlying technologies. It is a network security mechanism and a technology used to solve network latency and congestion problems.
[0004] Most cloud vendors' object storage services currently include QoS restrictions. Object storage systems contain multiple object storage gateways, and QoS restrictions are usually implemented on the object storage gateways. The same user's request may be sent to different object storage gateways at the same time. The gateways cannot be aware of the request status of other object storage gateways, which makes it impossible for the QoS service set on the object storage gateway to accurately restrict the user's request. Summary of the Invention
[0005] This invention provides a method, apparatus, device, and storage medium for controlling quality of service, in order to solve the problem that QoS services set on object storage gateways in the prior art cannot accurately restrict user requests.
[0006] In a first aspect, the present invention provides a service quality control method, the method being applied to an object storage gateway, wherein there are multiple object storage gateways, and each object storage gateway is connected to multiple service nodes; the method includes:
[0007] Receive request information sent by the user, the request information including the user identifier;
[0008] The target limit value is determined based on the request information and service quality configuration information; the service quality configuration information represents the limit number of accesses per unit time for different users;
[0009] The target service node is determined based on the request information, and the request information and the target limit value are sent to the target service node so that the target service node determines the response result to the request information based on the target limit value; when the two request information are the same, the target service node is the same.
[0010] Receive the response result returned by the target service node and execute the response result.
[0011] Optionally, the request information may also include the operation type and interface name; determining the target limit value based on the request information and service quality configuration information includes:
[0012] Determine whether there is a first restriction value in the service quality configuration information that corresponds to the user identifier, the operation type, and the interface name. If there is, determine the first restriction value as the target restriction value.
[0013] If it does not exist, then determine whether there is a second restriction value in the service quality configuration information corresponding to the user identifier and the operation type. If it exists, then determine the second restriction value as the target restriction value.
[0014] If it does not exist, the default limit value will be set as the target limit value.
[0015] Optionally, determining the target service node based on the request information includes:
[0016] The hash value is determined based on the user identifier, the operation type, and the interface name;
[0017] The target service node is determined based on the hash value.
[0018] Optionally, determining the target service node based on the hash value includes:
[0019] Determine the number of existing service nodes, divide the hash value by the number of service nodes, and obtain the remainder in the division result;
[0020] The target service node is determined based on the remainder.
[0021] Optionally, the method further includes:
[0022] The service quality configuration information is retrieved from the database periodically; the database is used to store the service quality configuration information updated by the user.
[0023] Optionally, the object storage gateway is also connected to multiple data storage nodes; the response result is the waiting time; receiving the response result returned by the target service node and executing the response result includes:
[0024] When the waiting time is determined to be a value greater than 0, the request information is forwarded to the corresponding data storage node after the waiting time has elapsed.
[0025] Secondly, the present invention provides a service quality control method, the method being applied to a service node, the method comprising:
[0026] The system receives request information and a target limit value from an object storage gateway. The request information includes a user identifier. The target limit value is determined by the object storage gateway based on the request information and service quality configuration information after receiving the user's request information. The service quality configuration information represents the limited number of accesses per unit time for different users. The service node is determined by the object storage gateway based on the request information. When two request messages are the same, the service node is the same.
[0027] Determine the number of requests received within a preset time period that correspond to the request information;
[0028] Based on the request count information and the target limit value, a response result is determined for the request information, and the response result is sent to the object storage gateway so that the object storage gateway executes the response result.
[0029] Optionally, the request information may also include the operation type and interface name, and the request count information may include the target request count in the previous unit of time and the target request count in the current unit of time; the target request count is the number of requests corresponding to the user identifier, the operation type and the interface name.
[0030] Optionally, the response result is the waiting time; determining the response result for the request information based on the request count information and the target limit value includes:
[0031] Obtain the window sampling time; the window sampling time is the time difference between the moment the request information is received and the end of the previous unit of time.
[0032] The number of target requests within the sampling period is determined based on the number of target requests in the previous unit time, the number of target requests in the current unit time, and the window sampling time; the sampling period is a unit time with the moment when the request information is received as the end time.
[0033] The waiting time is determined based on the number of target requests within the sampling period and the target limit value.
[0034] Thirdly, the present invention provides a service quality control device, the device being applied to an object storage gateway, wherein there are multiple object storage gateways, and each object storage gateway is connected to multiple service nodes; the device includes:
[0035] The first receiving module is used to receive request information sent by the user, the request information including a user identifier;
[0036] The first determining module is used to determine the target limit value based on the request information and service quality configuration information; the service quality configuration information represents the limit number of accesses per unit time for different users;
[0037] The second determining module is used to determine the target service node based on the request information, and send the request information and the target limit value to the target service node so that the target service node determines the response result for the request information based on the target limit value; when the two request information are the same, the target service node is the same.
[0038] The first processing module is used to receive the response result returned by the target service node and execute the response result.
[0039] Fourthly, the present invention provides a service quality control device, the device being applied to a service node, the device comprising:
[0040] The second receiving module is used to receive request information and target limit values sent by the object storage gateway; the request information includes a user identifier; the target limit value is determined by the object storage gateway based on the request information and service quality configuration information after receiving the request information sent by the user; the service quality configuration information represents the limited number of accesses per unit time for different users; the service node is determined by the object storage gateway based on the request information; when two request information are the same, the service node is the same.
[0041] The third determining module is used to determine the number of requests received within a preset time period that correspond to the request information;
[0042] The second processing module is used to determine the response result for the request information based on the request count information and the target limit value, and send the response result to the object storage gateway so that the object storage gateway executes the response result.
[0043] Fifthly, the present invention provides an electronic device, comprising: at least one processor and a memory;
[0044] The memory stores computer-executed instructions;
[0045] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in any of the first aspects.
[0046] In a sixth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method of any one of the first aspects.
[0047] This invention provides a service quality control method, apparatus, device, and storage medium. The method involves receiving a request from a user, the request including a user identifier; determining a target limit value based on the request and service quality configuration information (representing the limited number of accesses per unit time for different users); determining a target service node based on the request; sending the request and the target limit value to the target service node, enabling the target service node to determine a response to the request based on the target limit value; identifying the same target service node when two request messages are identical; receiving and executing the response returned by the target service node; and using an object storage gateway to receive the request and determine the target service node, allowing the target service node to determine whether to restrict the user's request. This allows different request messages from the same user to be assigned to the same service node, thereby achieving accurate restriction of user requests. Attached Figure Description
[0048] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0049] Figure 1 This is an application scenario diagram of a service quality control method provided in an embodiment of the present invention;
[0050] Figure 2 A flowchart illustrating a service quality control method provided in an embodiment of the present invention;
[0051] Figure 3 A flowchart illustrating another service quality control method provided in an embodiment of the present invention;
[0052] Figure 4 A flowchart illustrating another service quality control method provided in an embodiment of the present invention;
[0053] Figure 5A schematic diagram of a sampling period provided for an embodiment of the present invention;
[0054] Figure 6 This is a schematic diagram of a service quality control device provided in an embodiment of the present invention;
[0055] Figure 7 A schematic diagram of the structure of another service quality control device provided in an embodiment of the present invention;
[0056] Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention.
[0057] The accompanying drawings have illustrated specific embodiments of the invention, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the invention in any way, but rather to illustrate the concept of the invention to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0058] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention.
[0059] Most large cloud providers currently include QoS restrictions in their object storage services, but these restrictions are usually implemented at the object storage gateway. An object storage system typically contains multiple object storage gateways, and the same user's request information may be sent to different object storage gateways.
[0060] For example, if the same object sends two request messages, which might be sent to object storage gateway 1 and object storage gateway 2 respectively, and the QoS limit for that object is 100 requests per unit time, then object storage gateways 1 and 2 cannot obtain requests received by other object storage gateways; they can only determine whether the number of requests they have received from that user exceeds 100. If it does not exceed 100, they allow the user to access the data. This will greatly increase the number of requests subject to QoS restrictions for that user. In other words, this method cannot accurately limit the number of user requests.
[0061] Figure 1 This is an application scenario diagram of a service quality control method provided in an embodiment of the present invention, such as... Figure 1As shown, there can be multiple object storage gateways. Users can send request information to any object storage gateway through a client. The object storage gateway can determine the target service node and send the request information to the target service node for processing. The target service node can determine whether the user can access the storage node's response result and send the response result back to the object storage gateway, which then executes the response result. Specifically, when the object storage gateway determines the target service node, request information from the same user will be sent to the same target service node. For example, two request messages from the same user will both be sent to the target service node, rather than one request message being sent to service node 1 and another to service node 2. This allows the target service node to accurately restrict user requests.
[0062] Figure 2 This is a flowchart illustrating a service quality control method according to an embodiment of the present invention. The method is applied to multiple object storage gateways, which are connected to multiple service nodes. The method includes steps S201 to S203:
[0063] Step S201: Receive request information sent by the user, wherein the request information includes a user identifier.
[0064] There can be multiple object storage gateways. Each object storage gateway can receive request information sent by clients. The request information can include user identification information, so that the object storage gateway can determine which user the request information comes from.
[0065] An object storage gateway can connect to multiple service nodes, which provide quality of service (QS) methods. The gateway also connects to data storage nodes, which store data. User requests access data in these nodes. The service nodes process these requests to determine if the user is authorized to access the data.
[0066] Step S202: Determine the target limit value based on the request information and service quality configuration information; the service quality configuration information represents the limit number of accesses per unit time for different users.
[0067] When the object storage gateway receives request information, it can determine the target limit value corresponding to that request. For example, the limit value can be preset to 100 for user 1 and 200 for user 2. These preset limit values can be set in the quality of service (QoS) configuration information, where the limit value can be understood as the limited number of accesses per unit of time. Therefore, after receiving the request information, the QoS configuration information can be queried based on the user identifier to determine the target limit value corresponding to that request.
[0068] Optionally, the method further includes:
[0069] The service quality configuration information is retrieved from the database periodically; the database is used to store the service quality configuration information updated by the user.
[0070] Service quality configuration information can be configured by staff and uploaded to the database. The object storage gateway can periodically retrieve service quality configuration information for all users from the database cache.
[0071] By periodically collecting service quality configuration information from the database, the updated service quality configuration information can be automatically cached in various object storage gateways.
[0072] Step S203: Determine the target service node based on the request information, and send the request information and the target limit value to the target service node so that the target service node determines the response result for the request information based on the target limit value; when the two request information are the same, the target service node is the same.
[0073] After obtaining the user's identification information, the target service node can be determined, enabling the target service node to process the user's request information.
[0074] In existing technologies, QoS restrictions are implemented at the object storage gateway. The request information that a user sends to the object storage gateway each time is random. For example, the request information is sent to object storage gateway 1 the first time and to object storage gateway 2 the second time, which makes it impossible for the object storage gateway to accurately restrict the user's request information.
[0075] To address this issue, this application decouples the object storage gateway from the service node. For any object storage gateway, upon receiving a request, the service node can be determined based on the same rules. This ensures that all requests from the same user can be identified as the same target service node, and the request information and target limit value are sent to the target service node so that the target service node can determine the response result for the request.
[0076] For object storage gateways, when object storage gateway 1 and object storage gateway 2 receive request information from user 1 at different times, object storage gateway 1 can determine that the service node corresponding to user 1 is service node 1, and object storage gateway 2 can also determine that the service node corresponding to user 1 is service node 1. Then, both object storage gateway 1 and object storage gateway 2 will send the received request information to service node 1. In other words, all request information from user 1 will be processed by service node 1, so that the request information of user 1 can be accurately restricted.
[0077] Step S204: Receive the response result returned by the target service node and execute the response result.
[0078] After receiving the request information, the target service node can process it and obtain a response. It can also send the response to the object storage gateway, allowing the gateway to execute the response. The object storage gateway can also return the waiting time to the client. In this case, the object storage gateway sending the request can be the one that originally sent the request to the target service node.
[0079] This invention provides a service quality control method, which involves receiving a request from a user, the request including a user identifier; determining a target limit value based on the request and service quality configuration information, where the service quality configuration information represents the limited number of accesses per unit time for different users; determining a target service node based on the user identifier; sending the user identifier and the target limit value to the target service node, so that the target service node determines a response to the request based on the target limit value; when the user identifier is the same in two request messages, the target service node is the same; receiving and executing the response returned by the target service node; and receiving the request and determining the target service node through an object storage gateway, so that the target service node determines whether to restrict the user's request. This method allows different request messages corresponding to the same user to be assigned to the same service node, thereby achieving accurate restriction of user requests.
[0080] Optionally, the request information may also include the operation type and interface name; determining the target limit value based on the request information and service quality configuration information includes:
[0081] Determine whether there is a first restriction value in the service quality configuration information that corresponds to the user identifier, the operation type, and the interface name. If there is, determine the first restriction value as the target restriction value.
[0082] If it does not exist, then determine whether there is a second restriction value in the service quality configuration information corresponding to the user identifier and the operation type. If it exists, then determine the second restriction value as the target restriction value.
[0083] If it does not exist, the default limit value will be set as the target limit value.
[0084] Current QoS policies typically restrict access based on the user or the type of user action. However, in practice, requests for the same action type may involve several or even dozens of API calls. For example, the operation of adding data to a data storage node can be implemented by calling different APIs, allowing different types of data to be added. Since different APIs utilize resources differently, it's necessary to consider implementing finer-grained QoS restrictions.
[0085] To achieve finer-grained restrictions, different operation limits can be configured in the Quality of Service (QoS) configuration information. This QoS configuration information includes several fields: User ID, Operation Type, Interface Name, and Limit Value. The User ID can be a user ID; the Operation Type can be PUT, GET, DELETE, etc.; the Interface Name is the specific interface name (e.g., for a PUT operation, Interface Name can be set to Interface 1, Interface 2, and Interface 3); and the Limit Value is the specific numerical value. Using these fields, limit values can be set for different users calling different interfaces to perform different operations. In this case, the QoS configuration information represents the limited number of accesses per unit time for different users calling different interface names to perform different operation types. Specifically, the QoS configuration information can be stored in a data table, with the fields shown in the table below.
[0086]
[0087] Optionally, leaving the interface name blank indicates that only the operation type is considered, not the specific interface name. For example, for the PUT operation type, if the limit value is set to 1 without setting the interface name, it means that all PUT operations for that user will have a limit value of 1. Furthermore, a default limit value is set in the service quality configuration information. If no limit value is set for that user and operation type, the default limit value can be set as the target limit value.
[0088] Correspondingly, the request information sent by the user can also include the operation type and interface name. When the object storage gateway determines the target limit value, it can first check the cached quality of service configuration information to see if a first limit value corresponding to the user identifier, operation type, and interface name exists. If it exists, the first limit value is determined as the target limit value. If it does not exist, it can check the cached quality of service configuration information to see if a second limit value corresponding to the user identifier and operation type exists. If it exists, the second limit value is determined as the target limit value; if it does not exist, the default limit value is determined as the target limit value.
[0089] For example, when the request information is information about the operation type PUT for user 1 and the calling interface is interface 1, it can first be determined whether there is a limit value corresponding to user 1, operation type PUT, and interface 1. If not, it can be determined whether there is a limit value corresponding to user 1 and operation type PUT. If not, the default limit value is determined as the target limit value.
[0090] By using the above method to determine the target limit value, we can obtain the target limit value corresponding to the user's request information as much as possible, based on the premise that the target limit value can be obtained.
[0091] Optionally, determining the target service node based on the request information includes:
[0092] The hash value is determined based on the user identifier, the operation type, and the interface name; the target service node is determined based on the hash value.
[0093] When determining the target service node based on the request information, the hash value can be determined based on the user identifier, operation type, and interface name in the request information. For two request information, if the user identifier, operation type, and interface name are the same, then the target service node is the same.
[0094] The service nodes are idempotent. To ensure that the target service node is the same when the user ID, operation type, and interface name are the same, a hash value can be calculated based on the user ID, operation type, and interface name, and the target service node can be determined based on the calculated hash value.
[0095] For example, the user identifier, operation type, and interface name can all be strings. Each string is combined into a single string according to a preset rule, and the generated string is then input into a hash function to obtain a hash value output by the hash function.
[0096] If the hash values calculated twice are the same, then the target service node determined in both calculations is also the same. For example, the mapping between hash values and target service nodes can be pre-set, thereby determining the target service node based on the hash value.
[0097] By determining the hash value based on the user identifier, operation type, and interface name, and then determining the target service node based on the hash value, the target service node can be quickly determined based on the hash value, without needing to determine the target service node based on the user identifier, operation type, and interface name, thus improving the efficiency of determining the target service node.
[0098] Optionally, determining the target service node based on the hash value includes:
[0099] Determine the number of existing service nodes, divide the hash value by the number of service nodes and obtain the remainder in the division result; determine the target service node based on the remainder.
[0100] After determining the hash value, it can be divided by the number of existing service nodes, and the remainder can be used to determine the target service node. For example, when the hash value is 108 and the number of service nodes is 10, dividing the hash value by the number of service nodes will result in a quotient of 10 and a remainder of 8. The target service node can then be determined based on the remainder. Specifically, the 10 service nodes can be numbered as 0th, 1st, ... 9th service node. When the remainder is 8, these 8 service nodes are identified as the target service nodes.
[0101] By calculating the remainder of the hash value with respect to the number of service nodes, different requests can be distributed to different service nodes without pre-setting the correspondence between hash values and service nodes. When the number of service nodes changes, the target number of service nodes can also be determined.
[0102] Optionally, the object storage gateway is also connected to multiple data storage nodes; the response result is the waiting time; receiving the response result returned by the target service node and executing the response result includes:
[0103] When the waiting time is determined to be a value greater than 0, the request information is forwarded to the corresponding data storage node after the waiting time has elapsed.
[0104] For object storage gateways, it is also possible to receive and execute the response results returned by the target service node. This response result can be a waiting time. After receiving this waiting time, the object storage gateway can determine whether the waiting time is greater than 0. If it is greater than 0, it means that the waiting time needs to be elapsed before sending the request information to the responding data storage node, so that the user can read, write, or delete data from the data storage node.
[0105] When the waiting time is greater than 0, it means that the number of requests corresponding to this type of request (when the user ID, operation type and interface name are the same, it is considered the same request) exceeds the target limit value within the sampling period.
[0106] Furthermore, when the waiting time is equal to 0, it means that the user can currently read, write, or delete data from the data storage node.
[0107] By analyzing the received response information, the user's request information can be accurately restricted.
[0108] In addition, the QoS function can be enabled or disabled in the object storage gateway. When enabled, it can restrict user request information. When disabled, it directly sends the user's access request to the data storage node, allowing the user to access the data.
[0109] Figure 3 A flowchart illustrating another service quality control method provided in an embodiment of the present invention is shown below. Figure 3 As shown, the method includes:
[0110] Step S301: The object storage gateway periodically refreshes the service quality configuration information of the specified user to the local cache;
[0111] Step S302: Upon receiving the request information, retrieve the limit value from the local cache based on the user identifier, operation type, and interface name;
[0112] Step S303: Determine whether there is a limit value in the local cache that corresponds to the user ID, operation type and interface name. If yes, proceed to step S304; otherwise, proceed to step S305.
[0113] Step S304: Determine the existing limit values as the target limit values;
[0114] Step S305: Determine whether there is a limit value in the local cache that corresponds to the user identifier and operation type. If yes, proceed to step S304; otherwise, proceed to step S306.
[0115] Step S306: Determine the obtained default limit value as the target limit value;
[0116] Step S307: Select a service node based on the hash value determined by the user identifier, operation type, and interface name;
[0117] Step S308: Send the user identifier, operation type, interface name, and target limit value to the selected service node;
[0118] Step S309: Determine whether the returned waiting time is greater than 0. If it is greater than 0, proceed to step S310; otherwise, proceed to step S311.
[0119] Step S310: Wait for the corresponding duration, and after waiting for the corresponding duration, execute step S311.
[0120] Step S311: Control user access to data storage nodes.
[0121] Figure 4 This is a flowchart illustrating another service quality control method provided in an embodiment of the present invention. The method is applied to service nodes, such as... Figure 4 As shown, the method includes:
[0122] Step S401: Receive request information and target limit value sent by the object storage gateway; the request information includes a user identifier; the target limit value is determined by the object storage gateway based on the request information and service quality configuration information after receiving the request information sent by the user; the service quality configuration information represents the limited number of accesses per unit time for different users; the service node is determined by the object storage gateway based on the request information; when two request information are the same, the service node is the same.
[0123] For a service node, it can receive request information and target limit values sent by the object storage gateway. The request information may include a user identifier. The target limit value is determined by the object storage gateway based on service configuration information. The service node receiving the request information and target limit value is also determined by the object storage gateway based on the request information.
[0124] When the request information is the same, the object storage gateway determines that it is the same service node. For example, when object storage gateway 1 and object storage gateway 2 receive the same type of request information at different times, they can both send the request information to the same service node. The same type of request information means that the user identifier contained in the request information is the same.
[0125] Step S402: Determine the number of requests received within a preset time period that correspond to the request information.
[0126] When a service node receives a request, it can obtain the number of requests received within a preset time period corresponding to the request, and determine the response result based on the number of requests.
[0127] The request count information corresponding to the request information refers to the request count information corresponding to the user identifier in the request information. For example, when the obtained request information is about user 1, the request count information corresponding to user 1 stored in the service node within a preset time period can be obtained, and based on the obtained request count information, it can be determined whether user 1 can access the data storage node this time.
[0128] Step S403: Determine the response result for the request information based on the request count information and the target limit value, and send the response result to the object storage gateway so that the object storage gateway executes the response result.
[0129] After obtaining the request count information and the target limit value, the response result can be determined, that is, whether the obtained request count information exceeds the target limit value. After determining the response result, the response result can be sent to the object storage gateway, so that the object storage gateway can limit the user's request information.
[0130] This invention provides a service quality control method that receives request information and a target limit value from an object storage gateway. The request information includes a user identifier. The target limit value is determined by the object storage gateway after receiving the user's request information, based on the request information and service quality configuration information. The service quality configuration information represents the limited number of accesses per unit time for different users. The service node is determined by the object storage gateway based on the request information. When two request information messages are identical, the service node is the same. The method determines the number of requests received within a preset time period corresponding to the request information. Based on the number of requests and the target limit value, the method determines a response result for the request information and sends the response result to the object storage gateway, enabling the object storage gateway to execute the response result. By receiving the request information and determining the service node through the object storage gateway, the service node can determine whether to restrict the user's request information. Different request information corresponding to the same user can be assigned to the same service node, thereby achieving accurate restriction of user requests.
[0131] Optionally, the request information may also include the operation type and interface name, and the request count information may include the target request count in the previous unit of time and the target request count in the current unit of time; the target request count is the number of requests corresponding to the user identifier, the operation type and the interface name.
[0132] To enable finer-grained restrictions on request information, user-sent request information can include user identifier, operation type, and interface name. Service quality configuration information can then be used to set limit values for user identifier, operation type, and interface name. Request count information stored in service nodes is also stored according to user identifier, operation type, and interface name. Upon retrieving request information, the stored request count can be determined based on the user identifier, operation type, and interface name within the request information.
[0133] Specifically, when obtaining the number of requests corresponding to the request information within a preset time period, the target request count in the previous unit time and the target request count in the current unit time can be obtained, thereby determining the target request count information within the sampling period.
[0134] By setting the operation type and interface name in the request information, and by specifying the number of requests to be made based on the user identifier, the operation type, and the interface name when obtaining the target number of requests, it is possible to impose more granular restrictions on user requests, rather than limiting them solely to the user level.
[0135] Optionally, the response result is the waiting time; determining the response result for the request information based on the request count information and the target limit value includes:
[0136] Obtain the window sampling time; the window sampling time is the time difference between the moment the request information is received and the end of the previous unit of time.
[0137] The number of target requests within the sampling period is determined based on the number of target requests in the previous unit time, the number of target requests in the current unit time, and the window sampling time; the sampling period is a unit time with the moment when the request information is received as the end time.
[0138] The waiting time is determined based on the number of target requests within the sampling period and the target limit value.
[0139] Figure 5 A schematic diagram of a sampling period provided for an embodiment of the present invention, as shown below. Figure 5As shown, upon receiving a request, the window sampling time can be determined. Optionally, the window sampling time can be x. For example, the unit time here can be 1 second. Then, the target request count in the previous second is m, and the target request count in the current second is n. Based on m, n, and x, the target request count within the sampling period can be determined. When x is a nanosecond, the formula for calculating the target request count within the sampling period is as follows: r = m * (1e9 - x) / 1e9 + n. After determining the target request count within the sampling period, the waiting time can be calculated. When the target request count within the sampling period is greater than the target limit value limit, the waiting time is greater than 0; otherwise, the waiting time is equal to 0.
[0140] Optionally, the formula for calculating the waiting time is: 1e9*(r-limit) / limit.
[0141] Once the waiting time is calculated, it can be sent to the object storage gateway, which can then return the waiting time to the client.
[0142] The service node uses a sliding window algorithm to calculate the waiting time, which can accurately determine the waiting time for the request information.
[0143] Figure 6 This is a schematic diagram of a service quality control device provided in an embodiment of the present invention. The device is applied to an object storage gateway, and there are multiple object storage gateways connected to multiple service nodes. The device 60 includes:
[0144] The first receiving module 601 is used to receive request information sent by a user, wherein the request information includes a user identifier;
[0145] The first determining module 602 is used to determine the target limit value based on the request information and service quality configuration information; the service quality configuration information represents the limit number of accesses per unit time for different users;
[0146] The second determining module 603 is used to determine the target service node based on the request information, and send the request information and the target limit value to the target service node so that the target service node determines the response result to the request information based on the target limit value; when the two request information are the same, the target service node is the same.
[0147] The first processing module 604 is used to receive the response result returned by the target service node and execute the response result.
[0148] Optionally, the request information may also include the operation type and interface name; the first determining module 602 is specifically used for:
[0149] Determine whether there is a first restriction value in the service quality configuration information that corresponds to the user identifier, the operation type, and the interface name. If there is, determine the first restriction value as the target restriction value.
[0150] If it does not exist, then determine whether there is a second restriction value in the service quality configuration information corresponding to the user identifier and the operation type. If it exists, then determine the second restriction value as the target restriction value.
[0151] If it does not exist, the default limit value will be set as the target limit value.
[0152] Optionally, when determining the target service node based on the request information, the second determining module 603 is specifically used for:
[0153] The hash value is determined based on the user identifier, the operation type, and the interface name;
[0154] The target service node is determined based on the hash value.
[0155] Optionally, when determining the target service node based on the hash value, the second determining module 603 is specifically used for:
[0156] Determine the number of existing service nodes, divide the hash value by the number of service nodes, and obtain the remainder in the division result;
[0157] The target service node is determined based on the remainder.
[0158] Optionally, the device further includes: an acquisition module, specifically used for:
[0159] The service quality configuration information is retrieved from the database periodically; the database is used to store the service quality configuration information updated by the user.
[0160] Optionally, the object storage gateway is also connected to multiple data storage nodes; the response result is the waiting time; the first processing module 604 is specifically used for:
[0161] When the waiting time is determined to be a value greater than 0, the request information is forwarded to the corresponding data storage node after the waiting time has elapsed.
[0162] The service quality control device provided in this embodiment of the invention can achieve the above-mentioned... Figure 2 or Figure 3 The service quality control method shown in the embodiment has a similar implementation principle and technical effect, and will not be described again here.
[0163] Figure 7 This is a schematic diagram of another quality of service control device provided in an embodiment of the present invention. The device is applied to a service node and includes:
[0164] The second receiving module 701 is used to receive request information and a target limit value sent by the object storage gateway; the request information includes a user identifier; the target limit value is determined by the object storage gateway based on the request information and service quality configuration information after receiving the request information sent by the user; the service quality configuration information represents the limited number of accesses per unit time for different users; the service node is determined by the object storage gateway based on the request information; when two request information are the same, the service node is the same.
[0165] The third determining module 702 is used to determine the number of requests received within a preset time period that correspond to the request information;
[0166] The second processing module 703 is used to determine the response result for the request information based on the request count information and the target limit value, and send the response result to the object storage gateway so that the object storage gateway executes the response result.
[0167] Optionally, the request information may also include the operation type and interface name, and the request count information may include the target request count in the previous unit of time and the target request count in the current unit of time; the target request count is the number of requests corresponding to the user identifier, the operation type and the interface name.
[0168] Optionally, the response result is the waiting time; when the second processing module 703 determines the response result for the request information based on the request count information and the target limit value, it is specifically used for:
[0169] Obtain the window sampling time; the window sampling time is the time difference between the moment the request information is received and the end of the previous unit of time.
[0170] The number of target requests within the sampling period is determined based on the number of target requests in the previous unit time, the number of target requests in the current unit time, and the window sampling time; the sampling period is a unit time with the moment when the request information is received as the end time.
[0171] The waiting time is determined based on the number of target requests within the sampling period and the target limit value.
[0172] The service quality control device provided in this embodiment of the invention can achieve the above-mentioned... Figure 4The service quality control method shown in the embodiment has a similar implementation principle and technical effect, and will not be described again here.
[0173] Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Figure 8 As shown, the electronic device provided in this embodiment includes at least one processor 801 and a memory 802. The processor 801 and the memory 802 are connected via a bus 803.
[0174] In a specific implementation, at least one processor 801 executes computer execution instructions stored in memory 802, causing at least one processor 801 to execute the method in the above method embodiment.
[0175] The specific implementation process of processor 801 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0176] In the above Figure 8 In the illustrated embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0177] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.
[0178] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0179] This invention also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the method described in the above-described method embodiments.
[0180] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method described in the above method embodiments.
[0181] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0182] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0183] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0184] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0185] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0186] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for controlling service quality, characterized in that, The method is applied to multiple object storage gateways, which are connected to multiple service nodes; the method includes: Receive request information sent by the user, the request information including the user identifier; The target limit value is determined based on the request information and service quality configuration information; the service quality configuration information represents the limit number of accesses per unit time for different users; The target service node is determined based on the request information, and the request information and the target limit value are sent to the target service node so that the target service node determines the response result to the request information based on the target limit value; when the two request information are the same, the target service node is the same. Receive the response result returned by the target service node and execute the response result; the request information also includes the operation type and interface name; determine the target limit value based on the request information and service quality configuration information, including: Determine whether there is a first restriction value in the service quality configuration information that corresponds to the user identifier, the operation type, and the interface name. If there is, determine the first restriction value as the target restriction value. If it does not exist, then determine whether there is a second restriction value in the service quality configuration information corresponding to the user identifier and the operation type. If it exists, then determine the second restriction value as the target restriction value. If it does not exist, the default limit value will be set as the target limit value.
2. The method according to claim 1, characterized in that, Determining the target service node based on the requested information includes: The hash value is determined based on the user identifier, the operation type, and the interface name; The target service node is determined based on the hash value.
3. The method according to claim 2, characterized in that, Determining the target service node based on the hash value includes: Determine the number of existing service nodes, divide the hash value by the number of service nodes, and obtain the remainder in the division result; The target service node is determined based on the remainder.
4. The method according to claim 1, characterized in that, The method further includes: The service quality configuration information is retrieved from the database periodically; the database is used to store the service quality configuration information updated by the user.
5. The method according to any one of claims 1-4, characterized in that, The object storage gateway is also connected to multiple data storage nodes; the response result is the waiting time. Receive the response result returned by the target service node and execute the response result, including: When the waiting time is determined to be a value greater than 0, the request information is forwarded to the corresponding data storage node after the waiting time has elapsed.
6. A method for controlling service quality, characterized in that, The method is applied to a service node, and the method includes: The system receives request information and a target limit value from an object storage gateway. The request information includes a user identifier. The target limit value is determined by the object storage gateway based on the request information and service quality configuration information after receiving the user's request information. The service quality configuration information represents the limited number of accesses per unit time for different users. The service node is determined by the object storage gateway based on the request information. When two request messages are the same, the service node is the same. Determine the number of requests received within a preset time period that correspond to the request information; Based on the request count information and the target limit value, a response result is determined for the request information, and the response result is sent to the object storage gateway so that the object storage gateway executes the response result; The request information also includes the operation type and interface name. The target limit value is determined by the object storage gateway after judging whether there is a first limit value corresponding to the user identifier, the operation type, and the interface name in the service quality configuration information. If there is, the first limit value is determined as the target limit value; if there is, it is judged whether there is a second limit value corresponding to the user identifier and the operation type in the service quality configuration information. If there is, the second limit value is determined as the target limit value; if there is, the default limit value is determined as the target limit value.
7. The method according to claim 6, characterized in that, The request count information includes the target request count in the previous unit of time and the target request count in the current unit of time; the target request count is the number of requests corresponding to the user identifier, the operation type, and the interface name.
8. The method according to claim 7, characterized in that, The response result is the waiting time; Determine the response result for the request information based on the request count information and the target limit value, including: Obtain the window sampling time; the window sampling time is the time difference between the moment the request information is received and the end of the previous unit of time. The number of target requests within the sampling period is determined based on the number of target requests in the previous unit time, the number of target requests in the current unit time, and the window sampling time; the sampling period is a unit time with the moment when the request information is received as the end time. The waiting time is determined based on the number of target requests within the sampling period and the target limit value.
9. A service quality control device, characterized in that, The device is applied to multiple object storage gateways, which are connected to multiple service nodes; the device includes: The first receiving module is used to receive request information sent by the user, the request information including a user identifier; The first determining module is used to determine the target limit value based on the request information and service quality configuration information; the service quality configuration information represents the limit number of accesses per unit time for different users; The second determining module is used to determine the target service node based on the request information, and send the request information and the target limit value to the target service node so that the target service node determines the response result for the request information based on the target limit value; when the two request information are the same, the target service node is the same. The first processing module is used to receive the response result returned by the target service node and execute the response result; The request information also includes an operation type and an interface name; the first determining module is specifically used to determine whether there is a first restriction value in the service quality configuration information corresponding to the user identifier, the operation type, and the interface name. If it exists, the first restriction value is determined as the target restriction value; if it does not exist, the module determines whether there is a second restriction value in the service quality configuration information corresponding to the user identifier and the operation type. If it exists, the second restriction value is determined as the target restriction value; if it does not exist, the default restriction value is determined as the target restriction value.
10. A service quality control device, characterized in that, The device is applied to a service node, and the device includes: The second receiving module is used to receive request information and target limit values sent by the object storage gateway; the request information includes a user identifier; the target limit value is determined by the object storage gateway based on the request information and service quality configuration information after receiving the request information sent by the user; the service quality configuration information represents the limited number of accesses per unit time for different users; the service node is determined by the object storage gateway based on the request information; when two request information are the same, the service node is the same. The third determining module is used to determine the number of requests received within a preset time period that correspond to the request information; The second processing module is used to determine the response result for the request information based on the request count information and the target limit value, and send the response result to the object storage gateway so that the object storage gateway executes the response result; The request information also includes the operation type and interface name. The target limit value is determined by the object storage gateway after judging whether there is a first limit value corresponding to the user identifier, the operation type, and the interface name in the service quality configuration information. If there is, the first limit value is determined as the target limit value; if there is, it is judged whether there is a second limit value corresponding to the user identifier and the operation type in the service quality configuration information. If there is, the second limit value is determined as the target limit value; if there is, the default limit value is determined as the target limit value.
11. An electronic device, characterized in that, include: At least one processor and memory; The memory stores computer-executed instructions; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the method as described in any one of claims 1 to 8.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Network bandwidth limiting method and system, electronic equipment and readable storage medium
CN114500381A
Flow control method, device and system, electronic equipment and storage medium
CN116489090A