Interface traffic management method and device, computer equipment and storage medium
By grouping and weight coefficient allocation of interfaces, the request timeout problem caused by frequent call by distributed storage management software on multi-platform interfaces is solved, and system stability and resource utilization are improved.
Patent Information
- Application Number
- CN202411352833.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-26
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2044-09-26
Smart Images

Figure CN119109791A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to an interface traffic management method, device, computer equipment and storage medium. Background Art
[0002] Distributed storage management software systems often need to connect to third-party platforms. They need to provide REST (representational state transfer) interfaces for third-party platforms to call. Illegal operations on third-party platforms or the interfaces may be called frequently, exceeding the concurrency limit of the management software, causing excessive pressure on the software, resulting in request timeouts or even crashes.
[0003] The current solution is to limit the number of interface accesses on the management software side, reduce the frequency of receiving interface requests, and reduce the pressure on the management software, or provide interface call specifications to third-party platforms and agree on the frequency of each interface call; however, solutions based on simple current limiting will form a barrel effect. If only one internal module is under too much pressure, other modules are still able to process messages. If all requests are current limited, the software's resources will be underutilized and the operating efficiency will not be optimal. In addition, when connecting to multiple third-party platforms, the business scenarios of each platform are different, and the pressure on different modules within the software is also different. A large number of calls to the interface of a functional module will cause When the pressure is too great, simple current limiting will result in restricted access to platforms that do not originally use this function module. When connecting to multiple platforms, one platform may have an abnormally high number of requests, resulting in requests from other platforms not being processed. Another solution is to limit the current for each rest interface separately. However, when a rest interface times out, it means that the internal module involved in the interface is under too much pressure to continue processing requests. If each rest interface is limited separately and the rest requests related to the module cannot be identified, they may also time out, ignoring the correlation between rest interfaces. In addition, there are generally many rest interfaces, and the workload for each processing is also large.
[0004] Therefore, there is an urgent need to propose an interface traffic management method, device, computer equipment and storage medium that can effectively allocate resources. Summary of the invention
[0005] Based on this, it is necessary to provide an interface traffic management method, device, computer equipment and storage medium that can effectively allocate resources in response to the above technical problems.
[0006] In a first aspect, a method for managing interface traffic is provided, the method comprising:
[0007] Based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0008] In response to detecting an interface call request, according to a weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and a request queue is generated;
[0009] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request;
[0010] Based on the adjustment results, respond to the interface call request.
[0011] Optionally, multiple interfaces are grouped based on interface attributes to obtain multiple interface groups including:
[0012] Based on the functional attributes of the functional modules, multiple functional modules that process interface call requests in the distributed storage system management software are decoupled;
[0013] Based on the interface attributes, determine the mapping relationship between the target interface and the target functional module;
[0014] Based on the mapping relationship, multiple target interfaces are divided into groups to generate multiple interface groups.
[0015] Optionally, the method for determining the weight coefficient of the target interface group by the interface call request initiator includes:
[0016] Get the interface that the initiator needs to call corresponding to multiple interface call requests;
[0017] Based on the interfaces to be called by the initiating end corresponding to the multiple interface call requests, determine the number of interface call requests issued by each initiating end to the target interface;
[0018] Determining the calling frequency of each initiator for the target interface according to the number of interface calling requests issued by each initiator;
[0019] Based on the calling frequencies of the plurality of target interfaces, determining the calling frequency of the target interface group corresponding to each initiator;
[0020] According to the calling frequency of the target interface group, a weight coefficient of the interface calling request initiator for the target interface group is calculated and determined. The calculation formula of the weight coefficient of the interface calling request initiator for the target interface group includes:
[0021]
[0022] Where P represents the weight coefficient of the interface call request initiator for the target interface group, k represents the number of interface call requests at the current initiator, and x i Indicates the number of interface call requests from the i-th initiator.
[0023] Optionally, according to the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and a request queue is generated, including:
[0024] Based on the target time window, obtain the number of processable interface call requests corresponding to the target interface group;
[0025] Based on the number of processable interface call requests and the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests from different initiators are allocated to the target interface group, and a request queue is generated.
[0026] Optionally, a method for determining the number of interface call requests that can be processed by the target interface group includes:
[0027] In response to detecting that the duration of the interface processing the interface call request is greater than a third preset threshold within the target time window, obtaining the number of interface call request processing in the previous time window;
[0028] The number of interface call requests processed in the previous time window is defined as the number of interface call requests that can be processed by the target interface group.
[0029] Optionally, in response to detecting that the number of requests in the target request queue is greater than a first preset threshold, adjusting the allocation result of the interface call request includes:
[0030] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, obtaining the number of requests in other request queues;
[0031] In response to detecting that the number of requests in other request queues is less than a fourth preset threshold, the interface call requests of the target request queue are allocated to other request queues and / or request waiting queues.
[0032] Optionally, in response to detecting that the number of requests in the target request queue is less than a second preset threshold, adjusting the allocation result of the interface call request includes:
[0033] In response to detecting that the number of requests in the target request queue is less than a second preset threshold, obtaining the number of requests in other request queues;
[0034] In response to detecting that the number of requests in other request queues is greater than a fifth preset threshold, the interface call requests in other request queues are allocated to the target request queue and / or the request waiting queue.
[0035] In a second aspect, an interface traffic management device is provided, the device comprising:
[0036] A grouping module, used for grouping multiple interfaces based on interface attributes to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0037] An allocation module, for allocating a corresponding number of interface call requests to a target interface group according to a weight coefficient of the interface call request initiator for the target interface group when an interface call request is detected, and generating a request queue;
[0038] An adjustment module, configured to adjust the allocation result of the interface call request when it is detected that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold;
[0039] The response module is used to respond to the interface call request based on the adjustment result.
[0040] In a third aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:
[0041] Based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0042] In response to detecting an interface call request, according to a weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and a request queue is generated;
[0043] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request;
[0044] Based on the adjustment results, respond to the interface call request.
[0045] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0046] Based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0047] In response to detecting an interface call request, according to a weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and a request queue is generated;
[0048] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request;
[0049] Based on the adjustment results, respond to the interface call request.
[0050] In a fifth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0051] Based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0052] In response to detecting an interface call request, according to a weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and a request queue is generated;
[0053] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request;
[0054] Based on the adjustment results, respond to the interface call request.
[0055] The above-mentioned interface traffic management method, device, computer equipment and storage medium, the method includes: based on interface attributes, grouping multiple interfaces to obtain multiple interface groups, wherein one interface corresponds to at least one interface group; in response to detecting an interface call request, according to the weight coefficient of the interface call request initiator for the target interface group, allocating a corresponding number of interface call requests to the target interface group, and generating a request queue; in response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request; based on the adjustment result, responding to the interface call request, the present application is aimed at distributed storage management software docking with multiple third-party platforms. There may be a situation where the interface is frequently called and exceeds the concurrency upper limit of the management software, causing excessive pressure on the software, resulting in request timeout or even crash. The access traffic of the interface is managed to prevent the interface from being called too frequently, and the pressure on the internal module of the software is too high, causing the software to crash or the interface to time out frequently. While improving the utilization of software resources, the stability of the system and the efficiency of request processing are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1An application environment diagram of an interface traffic management method in an embodiment;
[0057] Figure 2 A schematic diagram of a flow chart of an interface traffic management method in an embodiment;
[0058] Figure 3 A schematic diagram of a flow chart of obtaining the number of processable interface call requests of an interface traffic management method in one embodiment;
[0059] Figure 4 A schematic diagram of an interface call request allocation process of an interface traffic management method in an embodiment;
[0060] Figure 5 is a structural block diagram of an interface traffic management device in an embodiment;
[0061] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0063] It should be understood that in the description of the present application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification should be interpreted as including rather than being exclusive or exhaustive; that is, as including but not limited to.
[0064] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0065] It should be noted that the terms "S1", "S2", etc. are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only for the convenience of describing the method of the present application, and cannot be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection required by the present application.
[0066] The bottleneck of frequent interface calls leading to software request processing timeout is that the number of requests that one or more internal modules of the software can process has reached the upper limit, not that the overall software operating environment resources are insufficient. Each interface call request is made by a module inside the software. The software's processing ability of the interface is related to the pressure of the independent functional modules inside, such as exceeding the concurrency specifications of the functional modules, the performance limitations of file read and write performance within the modules, etc. Different modules have different processing capabilities. According to the background technology, the current solution has the disadvantage of insufficient software resource utilization and suboptimal operating efficiency; when a functional module's interface is called in large numbers and causes excessive pressure, simple current limiting will cause the access of platforms that originally did not use this functional module to be restricted; when connecting to multiple platforms, the number of requests from one platform may be abnormally frequent, resulting in requests from other platforms not being processed; rest requests may time out, and there are generally a large number of rest interfaces, and the workload of each processing is also large.
[0067] In order to solve the above technical problems, the present application provides an interface traffic management method, device, equipment and storage medium. For distributed storage management software connected to multiple third-party platforms, there may be a situation where the interface is frequently called and exceeds the concurrency limit of the management software, causing excessive pressure on the software, resulting in request timeouts or even crashes. The access traffic of the rest interface is restricted to prevent the rest interface from being called too frequently, preventing the software internal module from being overly stressed and causing software crashes or frequent interface timeouts, thereby improving the stability of the system and making better use of software resources. The efficiency of request processing is improved while ensuring the normal operation of the software, so that the resource allocation of the management software when connecting to multiple platforms is more in line with the business logic of the upper-level platform, thereby improving availability, and allocating resources according to the different calling frequencies of the upper-level platform for each group of rest interfaces under current limiting.
[0068] The interface traffic management method provided in this application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the data processing platform set on the server 104 through the network, wherein the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0069] In one embodiment, Figure 2 As shown, a method for managing interface traffic is provided, and the method is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:
[0070] S1: Based on interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group.
[0071] It should be noted that the interface refers to the REST interface of the distributed storage system management software, which is used to receive and process REST requests (interface call requests); the distributed storage system management software includes multiple functional modules based on the internal logic of the management software, that is, the management software is divided into functional modules for processing REST requests according to the functions supported by the management software during the development phase; the interface attributes refer to the functional attributes used to process different REST requests.
[0072] In some specific implementations, multiple interfaces are grouped based on interface attributes to obtain multiple interface groups including:
[0073] Based on the functional attributes of the functional modules, multiple functional modules that process interface call requests in the distributed storage system management software are decoupled;
[0074] Based on the interface attributes, determine the mapping relationship between the target interface and the target functional module;
[0075] Based on the mapping relationship, multiple target interfaces are divided into groups to generate multiple interface groups.
[0076] Specifically, during the development phase, the functional modules that process REST requests are decoupled according to the functions supported by the management software, so that each functional module does not reference each other during runtime, and when one functional module is under too much pressure, it will not affect the use of other modules. The software's REST interfaces are grouped according to the functional modules involved in the internal logic of the management software when processing interface call requests. Each interface may correspond to multiple functional modules and can be divided into multiple groups.
[0077] In the above implementation, when limiting the flow of the REST interface, the REST interface is grouped according to the internal functional modules of the software involved in processing the REST interface, and restrictions are set separately for each group of REST interfaces. Only a specified number of interface requests from the same group are accepted within a certain time window. When the internal functional module is under too much pressure and causes a timeout, the access to the REST interface of the management software as a whole is not limited. Instead, each internal functional module is limited according to the specifications of the internal functional module, which improves the flexibility of interface traffic management and can maximize the use of software resources, thereby improving the efficiency of request processing while ensuring the normal operation of the software.
[0078] S2: In response to detecting an interface call request, a corresponding number of interface call requests are allocated to the target interface group according to a weight coefficient of the interface call request initiator for the target interface group, and a request queue is generated.
[0079] It should be noted that the interface call request initiator refers to a third-party platform that the management software is connected to, which may include multiple platforms, and the weight coefficient refers to the weight of a platform in the target interface group.
[0080] In some specific implementations, the method for determining the weight coefficient of the target interface group by the interface call request initiator includes:
[0081] Get the interfaces that the initiator needs to call corresponding to multiple interface call requests, that is, multiple third-party platforms apply to call the rest interface;
[0082] Determine the number of interface call requests issued by each initiator to the target interface based on the interfaces to be called by the initiators corresponding to the multiple interface call requests;
[0083] Determine the calling frequency of each initiator for the target interface according to the number of interface calling requests sent by each initiator, wherein the greater the number, the higher the calling frequency, and the two are in direct proportion;
[0084] Based on the calling frequencies of the plurality of target interfaces, determining the calling frequency of the target interface group corresponding to each initiator;
[0085] According to the calling frequency of the target interface group, a weight coefficient of the interface calling request initiator for the target interface group is calculated and determined. The calculation formula of the weight coefficient of the interface calling request initiator for the target interface group includes:
[0086]
[0087] Where P represents the weight coefficient of the interface call request initiator for the target interface group, k represents the number of interface call requests of the current initiator, and x i Indicates the number of interface call requests from the i-th initiator.
[0088] Specifically, the management software requires the upper-level platform to declare the REST interface it needs to use and the frequency of interface use according to its own business logic before docking. The management software sets different weights for different groups of REST interfaces according to the frequency of REST interfaces applied by third-party platforms. The more frequently a platform needs to call an interface in a group, the greater the weight of the corresponding interface group. The sum of the weights of all platforms corresponding to each interface group is always equal to 1. For example, in a REST interface group, the number of interface requests applied by platform A is a, the number of interface requests applied by platform B is b, and the number of interface requests applied by platform C is c. Then the weight of platform A in the group is P. A =a / (a+b+c), the weight assigned by platform B is P B =b / (a+b+c), the weight assigned by platform C is PC =b / (a+b+c).
[0089] In some specific implementations, according to the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and the request queue is generated, including:
[0090] Based on the target time window, the number of processable interface call requests corresponding to the target interface group is obtained. Specifically, when limiting the interface, the upper limit of the number of accesses to the entire software interface is not directly limited, but each group of interfaces is limited separately, and a request queue is established for requests exceeding the limit, waiting to be processed. The method for determining the number of processable interface call requests corresponding to the target interface group includes:
[0091] In response to detecting that the duration of the interface processing the interface call request in the target time window is greater than a third preset threshold, obtaining the number of interface call request processing in the previous time window, wherein the third preset threshold can be set according to actual needs;
[0092] The number of interface call requests processed in the previous time window is defined as the number of interface call requests that can be processed by the target interface group;
[0093] Specifically, within a certain time window, only a specified number of interface call requests are processed, and other interface call requests enter the request waiting queue and wait until the next time window or the waiting time is exceeded and a timeout is returned. Before the upper platform is connected to the storage, it is necessary to register on the management software first, and the management software applies for a unique token for it. Each time a request is issued, it is necessary to carry this token in the header (the string sent by the server before transmitting HTML data to the browser using the HTTP protocol), indicating which platform the interface call request comes from, so as to determine whether the number of interface call requests of the platform is greater than the limit. When the rest interface processes requests normally, the management software will not limit the flow of the interface. The management software will count the rest requests processed within the time window during operation. When an interface processing request times out, the number of interface requests of the group processed in the previous time window will be used as the upper limit of the rest interface to limit the requests of all rest interfaces of the group. When the internal and external operating environment of the software changes, manual intervention can be used to increase the upper limit or close the limit. For example, Figure 3 As shown, record the last time window T i The number of requests of group A processed in the time window is N. When the rest interface processing request of group A times out, the upper limit of the number of requests processed by the interface of group A is set to N. If it does not time out, it will continue to process the next time window T. i+1 Requests;
[0094] Based on the number of processable interface call requests and the weight coefficient of the interface call request initiator for the target interface group, the target interface group is allocated with a corresponding number of interface call requests from different initiators, and a request queue is generated;
[0095] For example, when the number of processable interface call requests is T, the weight of platform A is P A , then the number of interface call requests of platform A allocated to the target interface group is T×P A , and so on, I will not go into details here.
[0096] In the above implementation, for the distributed storage management software connected to multiple third-party platforms, there may be a situation where the interface is called frequently exceeding the concurrency limit of the management software, causing excessive pressure on the software and causing request timeouts or even crashes. By limiting the access traffic of the rest interface, it is prevented from being called too frequently and the internal modules of the software are under excessive pressure, causing software crashes or frequent interface timeouts, thereby improving the stability of the system.
[0097] S3: In response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request.
[0098] It should be noted that the first preset threshold and the second preset threshold can be set according to actual needs, or can be the number of processable interface call requests corresponding to the interface group within a time window defined in the above steps. The first preset threshold can be equal to the second preset threshold, that is, when the management software processes the rest requests in the request queue, it determines the number of rest interface call requests for each platform to be processed according to the proportion of the weights assigned to different platforms. When the number of requests from a certain platform to a certain group is small or large, the quota is adjusted and redistributed according to the weight.
[0099] In some specific implementations, in response to detecting that the number of requests in the target request queue is greater than a first preset threshold, adjusting the allocation result of the interface call request includes:
[0100] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, obtaining the number of requests in other request queues, that is, the number of requests in the target request queue exceeds the number of processable interface call requests corresponding to the interface group in the current time window;
[0101] In response to detecting that the number of requests in other request queues is less than a fourth preset threshold, the interface call requests of the target request queue are allocated to other request queues and / or request waiting queues, wherein the fourth preset threshold refers to the number of corresponding processable interface call requests of the corresponding request queues of other platforms in the interface group, and if the quota of other request queues does not reach the upper limit calculated according to the weight, the requests of the target request queue are allocated to other request queues to process the requests in a timely manner;
[0102] In some specific implementations, in response to detecting that the number of requests in the target request queue is less than a second preset threshold, adjusting the allocation result of the interface call request includes:
[0103] In response to detecting that the number of requests in the target request queue is less than a second preset threshold, obtaining the number of requests in other request queues, that is, the number of requests in the target request queue does not reach the number of processable interface call requests corresponding to the interface group in the current time window;
[0104] In response to detecting that the number of requests in other request queues is greater than a fifth preset threshold, the interface call requests of other request queues are allocated to the target request queue and / or the request waiting queue, wherein the fifth preset threshold refers to the number of processable interface call requests of the corresponding request queues of other platforms in the interface group. If the quota of other request queues is higher than the upper limit calculated according to the weight, the requests of other request queues are allocated to the target request queue to process the requests in a timely manner;
[0105] Among them, Figure 4 As shown, if the requests in any request queue reach the upper limit, the excess requests are added to the request waiting queue, and the requests in the queue are processed in the next time window. For example, when the pressure of the current function module is too high and the interface call exceeds the upper limit, the requests in the rest interface group corresponding to the function module will enter the request queue and wait for the next time window. All requests in the group are selected from the request queue, and the number is R. Then the quotas allocated to the three platforms A, B, and C are R. A =R×P A , R B =R×P B and R C =R×P C , when the interface calls of one or more platforms do not reach the quota, such as the A platform actually has only R in the request queue A1 requests, R A1 <R A , the remaining quota R A -R A1 As R1, exclude platform A and then follow the above steps to increase the quota R of B and C B1 and RC1 , recursively calculate until all quotas R are allocated, and the final request processed by platform A is R A1 , the request quota of platform B is R B +R1..., and so on, no further details will be given.
[0106] In the above implementation, the requests in the request queue are dynamically adjusted according to the weights set for each group of REST interfaces, so that the resources of the software can be utilized to the maximum extent, thereby improving the efficiency of request processing while ensuring the normal operation of the software. At the same time, under the condition of current limiting, resources are allocated according to the different calling frequencies of the upper-level platform for each group of REST interfaces, so that the resource allocation of the management software when docking with multiple platforms is more in line with the business logic of the upper-level platform, thereby improving availability.
[0107] S4: Respond to the interface call request based on the adjustment result.
[0108] In some embodiments, the method further comprises:
[0109] Based on the adjustment result, the adjustment times of the corresponding quotas of the target interface call request initiator in multiple time windows are obtained, wherein the number of time windows can be set according to actual needs, such as the time window is 8;
[0110] In response to detecting that the number of times the quota is adjusted is greater than a preset number threshold, obtaining the quota adjustment quantity, wherein the preset number threshold can be set according to actual needs, such as 5 times, etc., and the quota quantity is determined based on the number of interface call requests;
[0111] Calculate the average value corresponding to multiple quota adjustment quantities, and obtain the difference between the average value and the number of interface call requests that can be processed by the platform in the interface group;
[0112] In response to detecting that the difference is greater than a first preset difference or less than a second preset difference, adjusting the weight coefficient of the platform in this interface group, wherein the first preset difference and the second preset difference can be set according to actual needs, such as the first preset difference is 4, the second preset difference is -4, etc.;
[0113] Among them, the method for adjusting the weight coefficient includes: based on the difference, proportionally adjusting the weights of other platforms in the interface group. For example, if the difference is 5 and the number of other platforms is 5, the difference allocated to each platform is 1, then the adjustment range of the weight value of each platform is: the average value of the excess weight coefficient of the target platform for the interface group when all interface call requests can be responded to. If the difference is greater than the first preset difference, the weight of other platforms is proportionally reduced. When the difference is less than the second preset difference, the weight of other platforms is proportionally increased. If the number of platforms that need to be adjusted in the interface group exceeds half, such as there are 8 platforms and the number of platforms to be adjusted to 5, the platform weight coefficient will not be adjusted.
[0114] In the above implementation, by further adjusting the quota of resource allocation, the efficiency of request processing and the utilization rate of software resources are further improved.
[0115] In the above-mentioned interface traffic management method, the method includes: based on interface attributes, grouping multiple interfaces to obtain multiple interface groups, wherein one interface corresponds to at least one interface group; in response to detecting an interface call request, allocating a corresponding number of interface call requests to the target interface group according to the weight coefficient of the interface call request initiator for the target interface group, and generating a request queue; in response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request; based on the adjustment result, responding to the interface call request, the present application is aimed at distributed storage management software docking with multiple third-party platforms. There may be a situation where the interface is frequently called and exceeds the concurrency upper limit of the management software, causing excessive pressure on the software, resulting in request timeout or even crash. The access traffic of the interface is managed to prevent the interface from being called too frequently, and the pressure on the internal module of the software is too high, causing the software to crash or the interface to time out frequently. While improving the utilization of software resources, the stability of the system and the efficiency of request processing are improved.
[0116] It should be understood that although Figure 2-Figure 4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0117] In one embodiment, Figure 5 As shown, an interface traffic management device is provided, including: a grouping module, a distribution module, an adjustment module and a response module, wherein:
[0118] A grouping module, used for grouping multiple interfaces based on interface attributes to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0119] An allocation module, for allocating a corresponding number of interface call requests to a target interface group according to a weight coefficient of the interface call request initiator for the target interface group when an interface call request is detected, and generating a request queue;
[0120] An adjustment module, configured to adjust the allocation result of the interface call request when it is detected that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold;
[0121] The response module is used to respond to the interface call request based on the adjustment result.
[0122] As a preferred implementation, in the embodiment of the present invention, the grouping module is specifically used for:
[0123] Based on the functional attributes of the functional modules, multiple functional modules that process interface call requests in the distributed storage system management software are decoupled;
[0124] Based on the interface attributes, determine the mapping relationship between the target interface and the target functional module;
[0125] Based on the mapping relationship, multiple target interfaces are divided into groups to generate multiple interface groups.
[0126] As a preferred implementation, in the embodiment of the present invention, the allocation module is specifically used for:
[0127] Get the interface that the initiator needs to call corresponding to multiple interface call requests;
[0128] Determine the number of interface call requests issued by each initiator to the target interface based on the interfaces to be called by the initiators corresponding to the multiple interface call requests;
[0129] Determining the calling frequency of each initiator for the target interface according to the number of interface calling requests issued by each initiator;
[0130] Based on the calling frequencies of the plurality of target interfaces, determining the calling frequency of the target interface group corresponding to each initiator;
[0131] According to the calling frequency of the target interface group, a weight coefficient of the interface calling request initiator for the target interface group is calculated and determined. The calculation formula of the weight coefficient of the interface calling request initiator for the target interface group includes:
[0132]
[0133] Where P represents the weight coefficient of the interface call request initiator for the target interface group, k represents the number of interface call requests at the current initiator, and x i Indicates the number of interface call requests from the i-th initiator.
[0134] As a preferred implementation manner, in the embodiment of the present invention, the allocation module is further used for:
[0135] Based on the target time window, obtain the number of processable interface call requests corresponding to the target interface group;
[0136] Based on the number of processable interface call requests and the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests from different initiators are allocated to the target interface group, and a request queue is generated.
[0137] As a preferred implementation manner, in the embodiment of the present invention, the allocation module is further used for:
[0138] In response to detecting that the duration of the interface processing the interface call request is greater than a third preset threshold within the target time window, obtaining the number of interface call request processing in the previous time window;
[0139] The number of interface call requests processed in the previous time window is defined as the number of interface call requests that can be processed by the target interface group.
[0140] As a preferred implementation, in the embodiment of the present invention, the adjustment module is specifically used for:
[0141] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, obtaining the number of requests in other request queues;
[0142] In response to detecting that the number of requests in other request queues is less than a fourth preset threshold, the interface call requests of the target request queue are allocated to other request queues and / or request waiting queues.
[0143] As a preferred implementation, in the embodiment of the present invention, the adjustment module is further used for:
[0144] In response to detecting that the number of requests in the target request queue is less than a second preset threshold, obtaining the number of requests in other request queues;
[0145] In response to detecting that the number of requests in other request queues is greater than a fifth preset threshold, the interface call requests in other request queues are allocated to the target request queue and / or the request waiting queue.
[0146] For the specific definition of the interface traffic management device, please refer to the definition of the interface traffic management method above, which will not be repeated here. Each module in the above-mentioned interface traffic management device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0147] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an interface traffic management method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0148] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0149] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0150] S1: based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0151] S2: in response to detecting an interface call request, allocating a corresponding number of interface call requests to the target interface group according to a weight coefficient of the interface call request initiator for the target interface group, and generating a request queue;
[0152] S3: in response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request;
[0153] S4: Respond to the interface call request based on the adjustment result.
[0154] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0155] Based on the functional attributes of the functional modules, multiple functional modules that process interface call requests in the distributed storage system management software are decoupled;
[0156] Based on the interface attributes, determine the mapping relationship between the target interface and the target functional module;
[0157] Based on the mapping relationship, multiple target interfaces are divided into groups to generate multiple interface groups.
[0158] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0159] Get the interface that the initiator needs to call corresponding to multiple interface call requests;
[0160] Determine the number of interface call requests issued by each initiator to the target interface based on the interfaces to be called by the initiators corresponding to the multiple interface call requests;
[0161] Determining the calling frequency of each initiator for the target interface according to the number of interface calling requests issued by each initiator;
[0162] Based on the calling frequencies of the plurality of target interfaces, determining the calling frequency of the target interface group corresponding to each initiator;
[0163] According to the calling frequency of the target interface group, a weight coefficient of the interface calling request initiator for the target interface group is calculated and determined. The calculation formula of the weight coefficient of the interface calling request initiator for the target interface group includes:
[0164]
[0165] Where P represents the weight coefficient of the interface call request initiator for the target interface group, k represents the number of interface call requests of the current initiator, and x i Indicates the number of interface call requests from the i-th initiator.
[0166] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0167] Based on the target time window, obtain the number of processable interface call requests corresponding to the target interface group;
[0168] Based on the number of processable interface call requests and the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests from different initiators are allocated to the target interface group, and a request queue is generated.
[0169] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0170] In response to detecting that the duration of the interface processing the interface call request is greater than a third preset threshold within the target time window, obtaining the number of interface call request processing in the previous time window;
[0171] The number of interface call requests processed in the previous time window is defined as the number of interface call requests that can be processed by the target interface group.
[0172] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0173] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, obtaining the number of requests in other request queues;
[0174] In response to detecting that the number of requests in other request queues is less than a fourth preset threshold, the interface call requests of the target request queue are allocated to other request queues and / or request waiting queues.
[0175] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0176] In response to detecting that the number of requests in the target request queue is less than a second preset threshold, obtaining the number of requests in other request queues;
[0177] In response to detecting that the number of requests in other request queues is greater than a fifth preset threshold, the interface call requests in other request queues are allocated to the target request queue and / or the request waiting queue.
[0178] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0179] S1: based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0180] S2: in response to detecting an interface call request, allocating a corresponding number of interface call requests to the target interface group according to a weight coefficient of the interface call request initiator for the target interface group, and generating a request queue;
[0181] S3: in response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request;
[0182] S4: Respond to the interface call request based on the adjustment result.
[0183] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0184] Based on the functional attributes of the functional modules, multiple functional modules that process interface call requests in the distributed storage system management software are decoupled;
[0185] Based on the interface attributes, determine the mapping relationship between the target interface and the target functional module;
[0186] Based on the mapping relationship, multiple target interfaces are divided into groups to generate multiple interface groups.
[0187] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0188] Get the interface that the initiator needs to call corresponding to multiple interface call requests;
[0189] Based on the interfaces to be called by the initiating end corresponding to the multiple interface call requests, determine the number of interface call requests issued by each initiating end to the target interface;
[0190] Determining the calling frequency of each initiator for the target interface according to the number of interface calling requests issued by each initiator;
[0191] Based on the calling frequencies of the plurality of target interfaces, determining the calling frequency of the target interface group corresponding to each initiator;
[0192] According to the calling frequency of the target interface group, a weight coefficient of the interface calling request initiator for the target interface group is calculated and determined. The calculation formula of the weight coefficient of the interface calling request initiator for the target interface group includes:
[0193]
[0194] Where P represents the weight coefficient of the interface call request initiator for the target interface group, k represents the number of interface call requests at the current initiator, and x iIndicates the number of interface call requests from the i-th initiator.
[0195] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0196] Based on the target time window, obtain the number of processable interface call requests corresponding to the target interface group;
[0197] Based on the number of processable interface call requests and the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests from different initiators are allocated to the target interface group, and a request queue is generated.
[0198] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0199] In response to detecting that the duration of the interface processing the interface call request is greater than a third preset threshold within the target time window, obtaining the number of interface call request processing in the previous time window;
[0200] The number of interface call requests processed in the previous time window is defined as the number of interface call requests that can be processed by the target interface group.
[0201] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0202] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, obtaining the number of requests in other request queues;
[0203] In response to detecting that the number of requests in other request queues is less than a fourth preset threshold, the interface call requests of the target request queue are allocated to other request queues and / or request waiting queues.
[0204] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0205] In response to detecting that the number of requests in the target request queue is less than a second preset threshold, obtaining the number of requests in other request queues;
[0206] In response to detecting that the number of requests in other request queues is greater than a fifth preset threshold, the interface call requests in other request queues are allocated to the target request queue and / or the request waiting queue.
[0207] In one embodiment, a computer program product is provided, the computer program product comprising a computer program, the computer program when executed by a processor implements the following steps:
[0208] S1: based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group;
[0209] S2: in response to detecting an interface call request, allocating a corresponding number of interface call requests to the target interface group according to a weight coefficient of the interface call request initiator for the target interface group, and generating a request queue;
[0210] S3: in response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request;
[0211] S4: Respond to the interface call request based on the adjustment result.
[0212] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0213] Based on the functional attributes of the functional modules, multiple functional modules that process interface call requests in the distributed storage system management software are decoupled;
[0214] Based on the interface attributes, determine the mapping relationship between the target interface and the target functional module;
[0215] Based on the mapping relationship, multiple target interfaces are divided into groups to generate multiple interface groups.
[0216] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0217] Get the interface that the initiator needs to call corresponding to multiple interface call requests;
[0218] Determine the number of interface call requests issued by each initiator to the target interface based on the interfaces to be called by the initiators corresponding to the multiple interface call requests;
[0219] Determining the calling frequency of each initiator for the target interface according to the number of interface calling requests issued by each initiator;
[0220] Based on the calling frequencies of the plurality of target interfaces, determining the calling frequency of the target interface group corresponding to each initiator;
[0221] According to the calling frequency of the target interface group, a weight coefficient of the interface calling request initiator for the target interface group is calculated and determined. The calculation formula of the weight coefficient of the interface calling request initiator for the target interface group includes:
[0222]
[0223] Where P represents the weight coefficient of the interface call request initiator for the target interface group, k represents the number of interface call requests of the current initiator, and x i Indicates the number of interface call requests from the i-th initiator.
[0224] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0225] Based on the target time window, obtain the number of processable interface call requests corresponding to the target interface group;
[0226] Based on the number of processable interface call requests and the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests from different initiators are allocated to the target interface group, and a request queue is generated.
[0227] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0228] In response to detecting that the duration of the interface processing the interface call request is greater than a third preset threshold within the target time window, obtaining the number of interface call request processing in the previous time window;
[0229] The number of interface call requests processed in the previous time window is defined as the number of interface call requests that can be processed by the target interface group.
[0230] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0231] In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, obtaining the number of requests in other request queues;
[0232] In response to detecting that the number of requests in other request queues is less than a fourth preset threshold, the interface call requests of the target request queue are allocated to other request queues and / or request waiting queues.
[0233] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0234] In response to detecting that the number of requests in the target request queue is less than a second preset threshold, obtaining the number of requests in other request queues;
[0235] In response to detecting that the number of requests in other request queues is greater than a fifth preset threshold, the interface call requests in other request queues are allocated to the target request queue and / or the request waiting queue.
[0236] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0237] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0238] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. An interface traffic management method, characterized in that: The method comprises: Based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups, wherein one interface corresponds to at least one interface group; In response to detecting an interface call request, according to a weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and a request queue is generated; In response to detecting that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold, adjusting the allocation result of the interface call request; Based on the adjustment results, respond to the interface call request.
2. The interface traffic management method according to claim 1, characterized in that: Based on the interface attributes, multiple interfaces are grouped to obtain multiple interface groups including: Based on the functional attributes of the functional modules, multiple functional modules that process interface call requests in the distributed storage system management software are decoupled; Based on the interface attributes, determine the mapping relationship between the target interface and the target functional module; Based on the mapping relationship, multiple target interfaces are divided into groups to generate multiple interface groups.
3. The interface traffic management method according to claim 1, characterized in that: The method for determining the weight coefficient of the target interface group by the interface call request initiator includes: Get the interface that the initiator needs to call corresponding to multiple interface call requests; Based on the interfaces to be called by the initiating end corresponding to the multiple interface call requests, determine the number of interface call requests issued by each initiating end to the target interface; Determining the calling frequency of each initiator for the target interface according to the number of interface calling requests issued by each initiator; Based on the calling frequencies of the plurality of target interfaces, determining the calling frequency of the target interface group corresponding to each initiator; According to the calling frequency of the target interface group, a weight coefficient of the interface calling request initiator for the target interface group is calculated and determined. The calculation formula of the weight coefficient of the interface calling request initiator for the target interface group includes: Where P represents the weight coefficient of the interface call request initiator for the target interface group, k represents the number of interface call requests at the current initiator, and x i Indicates the number of interface call requests from the i-th initiator.
4. The interface traffic management method according to claim 1 or 3, characterized in that: According to the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests are allocated to the target interface group, and a request queue is generated including: Based on the target time window, obtain the number of processable interface call requests corresponding to the target interface group; Based on the number of processable interface call requests and the weight coefficient of the interface call request initiator for the target interface group, a corresponding number of interface call requests from different initiators are allocated to the target interface group, and a request queue is generated.
5. The interface traffic management method according to claim 4, characterized in that: Methods for determining the number of interface call requests that can be processed corresponding to the target interface group include: In response to detecting that the duration of the interface processing the interface call request is greater than a third preset threshold within the target time window, obtaining the number of interface call request processing in the previous time window; The number of interface call requests processed in the previous time window is defined as the number of interface call requests that can be processed by the target interface group.
6. The interface traffic management method according to claim 1, characterized in that: In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, adjusting the allocation result of the interface call request includes: In response to detecting that the number of requests in the target request queue is greater than a first preset threshold, obtaining the number of requests in other request queues; In response to detecting that the number of requests in other request queues is less than a fourth preset threshold, the interface call requests of the target request queue are allocated to other request queues and / or request waiting queues.
7. The interface traffic management method according to claim 1, characterized in that: In response to detecting that the number of requests in the target request queue is less than a second preset threshold, adjusting the allocation result of the interface call request includes: In response to detecting that the number of requests in the target request queue is less than a second preset threshold, obtaining the number of requests in other request queues; In response to detecting that the number of requests in other request queues is greater than a fifth preset threshold, the interface call requests in other request queues are allocated to the target request queue and / or the request waiting queue.
8. An interface traffic management device, characterized in that: The device comprises: A grouping module, used for grouping multiple interfaces based on interface attributes to obtain multiple interface groups, wherein one interface corresponds to at least one interface group; An allocation module, for allocating a corresponding number of interface call requests to a target interface group according to a weight coefficient of the interface call request initiator for the target interface group when an interface call request is detected, and generating a request queue; An adjustment module, configured to adjust the allocation result of the interface call request when it is detected that the number of requests in the target request queue is greater than a first preset threshold or less than a second preset threshold; The response module is used to respond to the interface call request based on the adjustment result.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Queue scheduling method and device
CN102223311A
Dynamic allocation request verification method
CN111212066A
Multi-interface shunt calling method and terminal
CN114189476A
Request call defense method and related equipment
CN114969822A
Information determination method, device and equipment and computer readable storage medium
CN117170890A
