Interface capacity evaluation method, device and system
By obtaining the CPU share and call volume of the interface and calculating its available capacity, the problem that the existing technology cannot accurately evaluate the capacity of each interface is solved, and dynamic resource adjustment and efficient resource utilization are achieved.
Patent Information
- Application Number
- CN202111201575.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-15
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2041-10-15
AI Technical Summary
Existing capacity evaluation methods cannot accurately evaluate each interface and cannot dynamically adjust resources to meet the change needs of the interface.
By obtaining the CPU share of the latest cycle of record and the total call volume of the interface, the first available capacity of the interface is calculated and responding to the demand. If the demand is less than the available capacity, the available capacity will be returned.
Accurate capacity evaluation of each interface is realized, resources are dynamically adjusted to meet the change needs of the interface, and resource utilization efficiency is improved.
Smart Images

Figure CN113934613B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to an interface capacity evaluation method, apparatus, and system. Background Art
[0002] Performing capacity evaluation is an important environment for controlling server costs. Usually, the current capacity level of a service is obtained by stress testing the service, and then considering the usage model of new requirements, dynamically considering whether the existing resources are sufficient to support this change.
[0003] Existing capacity evaluation methods are only applicable to the capacity evaluation of the overall users and cannot accurately evaluate the capacity of each interface. Summary of the Invention
[0004] In view of this, the present application provides an interface capacity evaluation method, apparatus, and system, which can accurately evaluate the currently invokable capacity of each interface.
[0005] To solve the above technical problems, the technical solution of the present application is implemented as follows:
[0006] In one embodiment, an interface capacity evaluation method is provided. The method includes:
[0007] When receiving a request for evaluating the interface capacity sent by the service side, obtaining the CPU occupancy rate of the latest period and the total call volume of the interface recorded;
[0008] Calculating the first available capacity of the interface according to the CPU occupancy rate and the total call volume of the interface;
[0009] If it is determined that the demand carried in the request is less than the first available capacity, sending a response to the service side that the first available capacity of the interface meets the call;
[0010] Wherein, the CPU occupancy rate and the total call volume of the interface are the CPU occupancy rate and the total call volume corresponding to the time period with the largest total call volume of all interfaces in the corresponding period, and each period is divided into multiple consecutive time periods of the same duration
[0011] In another embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method for interface capacity evaluation as described above is implemented.
[0012] In another embodiment, an interface capacity evaluation system is provided. The system includes:
[0013] A service side and the electronic device, wherein the service side is signal-connected to the electronic device.
[0014] In another embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the steps of the interface capacity evaluation method are implemented.
[0015] In another embodiment, a computer program product is provided, including a computer program which, when executed by a processor, implements the interface capacity evaluation method.
[0016] As can be seen from the above technical solutions, in the above embodiments, the available capacity of the current interface is evaluated by the CPU occupancy ratio of the historical record and the call volume of the interface, and the currently callable capacity of each interface can be accurately evaluated. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0018] Figure 1 It is a schematic diagram of the interface capacity evaluation process in the first embodiment of the present application;
[0019] Figure 2 It is a schematic diagram of the interface capacity evaluation process in the second embodiment of the present application;
[0020] Figure 3 It is a schematic diagram of the structure of the interface capacity evaluation device in the embodiments of the present application;
[0021] Figure 4 It is a schematic diagram of the interface capacity evaluation system in the embodiments of the present application;
[0022] Figure 5 It is a schematic diagram of the physical structure of the electronic device provided in the embodiments of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0023] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts fall within the scope of protection of the present application.
[0024] In the description of the present invention, the claims, and the above-mentioned drawings, the terms "first", "second", "third", "fourth", etc. (if any) are used to distinguish similar objects and do not necessarily describe a specific order or sequence. It should be understood that such data used can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein, for example, can be implemented in an order other than those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0025] The technical solution of the present invention will be described in detail below with specific embodiments. The following several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0026] In an embodiment of the present application, an interface capacity evaluation method is provided. By using the CPU occupancy ratio in the historical record and the call volume of the interface, the available capacity of the current interface is evaluated, and the callable capacity of each interface can be accurately evaluated.
[0027] In an embodiment of the present application, relevant information is recorded periodically. Specifically, each period is divided into multiple consecutive time periods of the same duration. The call volume of each interface in the corresponding period is recorded, the total call volume of each interface is statistically calculated in units of the time period, and the CPU occupancy ratio corresponding to the time period with the largest total call volume of all interfaces is obtained.
[0028] In specific implementation, since only the CPU occupancy ratio corresponding to the time period with the highest total call volume and the total call volume of the interface are used for calculation, therefore, for each period, only the CPU occupancy ratio of the time period with the highest total call volume and the total call volume of each interface can be recorded; or the total call volume, CPU occupancy ratio, and total call volume of each interface of each time period can be recorded; when evaluation is needed, then the CPU occupancy ratio of the time period with the largest total call volume and the total call volume of the interface are obtained.
[0029] The period here can be set according to actual needs, and there is no specific limit on the length of the period, such as 1 day, 1 week, etc.
[0030] In specific implementation, actual data can be collected and recorded every period, or when there is no increase in the new call volume or no decrease in the original call volume in a period, the data of the previous period can be directly used as the relevant data of the current period.
[0031] In specific implementation, one minute can be set as a time period, but it is not limited to this setting.
[0032] In specific implementation, record the real-time call volume of each interface. For each time period, aggregation can be performed by interface name to calculate the total call volume in that time period, and determine the time period with the highest total call volume to obtain the CPU occupancy rate for the corresponding time period.
[0033] For the case of hybrid deployment of multiple software services, record the corresponding data in the following manner:
[0034] The first method: Deploy multiple services on a single server, and record the call volume of all services on the interface for this server.
[0035] In specific implementation, when multiple services are hybridly deployed in the server, record the call volume during the entire cycle of the multiple services, and use the call volume of all services to calculate the total call volume of the corresponding interface, that is, the CPU occupancy rate used, and the total call volume of the interface is the CPU occupancy rate when all services are running, as well as the call volume of the interface, rather than only using the data corresponding to the called service for capacity evaluation.
[0036] The second method: When the number of servers on which multiple hybridly deployed services are deployed is different, use the records on the server with the largest total call volume to obtain the CPU occupancy rate for the corresponding cycle and the total call volume of the interface.
[0037] When the number of servers on which multiple hybridly deployed services are deployed is different, it is possible that the total call volume of some servers is relatively high. Using the server with the highest total call volume in the corresponding cycle and corresponding time period for capacity evaluation can avoid the cask effect and prevent a collapse after one overloaded server goes down.
[0038] When multiple services are hybridly deployed, it is more practical when the trend changes of the multiple services being called in the corresponding cycle are consistent.
[0039] The interface in the embodiments of the present application can be an API interface.
[0040] Next, in conjunction with the accompanying drawings, the interface capacity evaluation process will be described in detail.
[0041] Embodiment 1
[0042] Refer to Figure 1 , Figure 1 which is a schematic diagram of the interface capacity evaluation process in Embodiment 1 of the present application. The specific steps are as follows:
[0043] Step 101, when receiving a request from the service side to evaluate the interface capacity, obtain the CPU occupancy rate of the latest cycle and the total call volume of the interface recorded.
[0044] Among them, the CPU occupancy ratio and the total number of calls of the interface are the CPU occupancy ratio and the total number of calls of the interface corresponding to the time period with the largest total number of calls of all interfaces in the corresponding cycle. Each cycle is divided into multiple consecutive time periods of the same duration.
[0045] Step 102, calculate the first available capacity of the interface according to the CPU occupancy ratio and the total number of calls of the interface.
[0046] In this step, calculating the first available capacity of the interface according to the CPU occupancy ratio and the total number of calls of the interface includes:
[0047] Calculate the difference between the preset CPU occupancy ratio threshold and the CPU occupancy ratio of the latest cycle;
[0048] Calculate the product of the total number of calls corresponding to the interface in the latest cycle and the difference;
[0049] Calculate the ratio of the product to the preset CPU occupancy ratio threshold as the first available capacity.
[0050] If the preset CPU occupancy ratio threshold is 50%, the CPU occupancy ratio of the latest cycle is 30%, and the total number of calls of the interface in the latest cycle is 70, then the first available capacity is:
[0051] 70×(50% - 30%) / 50%.
[0052] Step 103, if it is determined that the required quantity carried in the request is less than the first available capacity, send a response indicating that the first available capacity of the interface meets the call to the service end.
[0053] When the required quantity is less than the first available capacity, it means that the remaining capacity of the requested interface can fully meet the call of the service end that sends the request. Then respond to the service end that the corresponding interface can be called, and give an indication that the first available capacity can be called, that is, the corresponding interface can be called on the premise of being unaffected by the increase and decrease of the capacity of other interfaces. Specifically, when implementing, the specific value of the first available capacity can also be sent to the service end, and the service end can further perform business judgment to finally decide whether to call and the call volume that can be used if called.
[0054] In the embodiments of the present application, when the call volume of all interfaces increases equally, on the premise that the remaining resources will be evenly served for each interface, by using the historical CPU occupancy ratio and the call volume of the interface to evaluate the available capacity of the current interface, the available capacity that can be called by each interface currently can be accurately evaluated.
[0055] Embodiment Two
[0056] See Figure 2 , Figure 2This is a schematic diagram of the interface capacity evaluation process in the second embodiment of the present application. The specific steps are as follows:
[0057] Step 201, when receiving a request for evaluating the interface capacity sent by the service end, obtain the CPU occupancy rate of the latest period and the total call volume of the interface recorded.
[0058] Among them, the CPU occupancy rate and the total call volume of the interface are the CPU occupancy rate and the total call volume corresponding to the time period with the largest total call volume of all interfaces in the corresponding period. Each period is divided into multiple consecutive time periods of the same duration.
[0059] Step 202, calculate the first available capacity of the interface according to the CPU occupancy rate and the total call volume of the interface.
[0060] In this step, calculating the first available capacity of the interface according to the CPU occupancy rate and the total call volume of the interface includes:
[0061] Calculate the difference between the preset CPU occupancy rate threshold and the CPU occupancy rate of the latest period;
[0062] Calculate the product of the total call volume corresponding to the interface in the latest period and the difference;
[0063] Calculate the ratio of the product to the preset CPU occupancy rate threshold as the first available capacity.
[0064] Assume that the preset CPU occupancy rate threshold is 50%, the CPU occupancy rate of the latest period is 40%, and the total call volume of the interface in the latest period is 70. Then the first available capacity is:
[0065] 70×(50% - 40%) / 50%.
[0066] Step 203, determine that the demand carried in the request is less than the first available capacity. If so, execute Step 204; otherwise, execute Step 205.
[0067] Step 204, send a response to the service end that the first available capacity of the interface meets the call, and end this process.
[0068] When the demand is less than the first available capacity, it means that the remaining capacity of the requested interface can fully meet the call of the service end that sends the request. Then respond to the service end that the corresponding interface can be called, and give an indication that the first available capacity can be called, that is, the corresponding interface can be called without being affected by the increase and decrease of the capacity of other interfaces. Specifically, when implementing, the specific value of the first available capacity can also be sent to the service end, and the service end further makes a business judgment to finally decide whether to call and the call volume that can be used if called.
[0069] Step 205, calculate the second available capacity of the interface on the premise that the call volume of all interfaces other than the said interface does not increase.
[0070] In this step, the specific implementation of calculating the second available capacity of the interface is as follows:
[0071] Calculate the difference between the total call volume of the latest period of the interface and the total call volume of the previous period of the latest period as the first difference;
[0072] Calculate the difference between the preset CPU occupancy ratio threshold of the interface and the CPU occupancy ratio corresponding to the latest period as the second difference;
[0073] Calculate the difference between the CPU occupancy ratio corresponding to the latest period of the interface and the CPU occupancy ratio corresponding to the previous period of the latest period as the third difference;
[0074] Calculate the product of the first difference and the second difference;
[0075] Calculate the ratio of the product to the third difference as the second available capacity of the interface.
[0076] Assume that the preset CPU occupancy ratio threshold is 50%, the CPU occupancy ratio of the latest period is 40%, the total call volume of the interface in the latest period is 70, the CPU occupancy ratio of the previous period of the latest period is 20, and the total call volume corresponding to the interface in the previous period of the latest period is 50. Then the second available capacity is:
[0077] (70 - 50) × (50% - 40%) / (40% - 20%).
[0078] Step 206, determine whether the demand is less than the second available capacity. If so, execute Step 207; otherwise, execute Step 208.
[0079] Step 207, send a response to the service side that the second available capacity of the interface meets the call, and end this process.
[0080] The demand being less than the second available capacity indicates that on the premise that the call volume of all interfaces other than the said interface does not increase, the maximum available call volume that the interface can provide can meet the demand of the service side to call the interface. At this time, respond to the service side that on the premise that the call volume of all interfaces other than the said interface does not increase, the maximum call volume that the interface can provide, that is, the second available volume, can meet the demand of the service side to call the interface, enabling the service side to determine whether to make a call according to actual needs;
[0081] And in specific implementation, the second available call volume can also be carried in the response and sent to the service side, and the service side can further determine whether to make a call.
[0082] Step 208: Send a response indicating that the interface does not meet the call requirement to the service side.
[0083] In the embodiment of the present application, when the call volume of all interfaces is increased equally, the remaining resources of the server will serve each interface on average. On this premise, the current first callable volume is evaluated. If the first callable volume cannot meet the user's demand, based on the premise that the call volume of the interfaces other than the current interface is not increased (it can be controlled that no more call volume applications from other interfaces are accepted. Then all the remaining resources will be used for the call of the new interface), through the CPU occupancy rate recorded in history and the call volume of the interface, the second available capacity of the current interface is evaluated, so as to accurately evaluate the currently callable capacity of each interface for the user to determine whether to call the interface.
[0084] Embodiment III
[0085] In specific implementation, if multiple requests for evaluating the interface capacity are received simultaneously, the multiple requests are merged for interface capacity evaluation.
[0086] For example, if requests A and B are received simultaneously, and the corresponding demand amounts are G A and G B .
[0087] If the requests are for calls to the same interface, then G A +G B is used as the demand amount for this interface, and the capacity evaluation is performed in the manner of Embodiment II.
[0088] If the requests are not for calls to the same interface, then first, the capacity evaluation is performed on the corresponding interfaces according to their respective demand amounts in the call manner of Embodiment I. If there is a situation where the demand amount is not met, then G A +G B is used as the demand amount for any interface, and the capacity evaluation is performed in the manner of Step 205.
[0089] Embodiment IV
[0090] For the latest cycle, if the interface capacity has been evaluated and the evaluation result is that the demand amount is less than the first available capacity or the demand amount is less than the second available capacity, and if a request for evaluating the interface capacity is received again, then determine whether the difference between the demand amount carried in the request and the maximum callable capacity of the corresponding interface in the previous cycle is greater than a preset threshold. If so, perform the interface capacity evaluation for the request; otherwise, wait until the end of the current cycle and then perform the interface capacity evaluation for the request.
[0091] If the first request is received in the current cycle, perform the interface capacity evaluation according to Embodiment II;
[0092] If the evaluation result is that the demand is less than the first available capacity, or the demand is not less than the second available capacity and the second request is received, determine whether the difference between the demand carried in the second request and the maximum invocable amount of the corresponding interface in the previous cycle is greater than a preset threshold. If so, use the data information recorded in the latest cycle for capacity evaluation; otherwise, wait until the end of the current cycle to perform capacity evaluation.
[0093] When the third, fourth, and so on requests are received, handle them in the same way as the second request.
[0094] For the previous cycle, if the interface capacity has been evaluated and the evaluation result is that the demand is greater than the second available capacity, when a request for evaluating the interface capacity is received again, do not perform capacity evaluation on this request and wait until the end of the current cycle to perform capacity evaluation.
[0095] Based on the same inventive concept, an interface capacity evaluation device is also provided in an embodiment of the present application. See Figure 3 , Figure 3 This is a schematic structural diagram of the interface capacity evaluation device in an embodiment of the present application. The device includes: a recording unit 301, a receiving unit 302, an obtaining unit 303, a calculating unit 304, a determining unit 305, and a responding unit 306;
[0096] The recording unit 301 is used to divide each cycle into multiple consecutive time periods of the same duration; record the CPU occupancy corresponding to the time period with the largest total call volume of all interfaces in each cycle and the total call volume of each interface;
[0097] The receiving unit 302 is used to receive a request for evaluating the interface capacity sent by the service end;
[0098] The obtaining unit 303 is used to obtain the CPU occupancy of the latest cycle and the total call volume of the interface recorded by the recording unit 301 when the receiving unit 302 receives a request for evaluating the interface capacity sent by the service end;
[0099] The calculating unit 304 is used to calculate the first available capacity of the interface according to the CPU occupancy and the total call volume of the interface obtained by the obtaining unit 303;
[0100] The determining unit 305 is used to determine whether the demand carried in the request is less than the first available capacity calculated by the calculating unit;
[0101] The responding unit 306 is used to send a response that the first available capacity of the interface meets the call to the service end if the determining unit 305 determines that the demand carried in the request is less than the first available capacity.
[0102] In another embodiment,
[0103] The calculation unit 304 is further configured to, if it is determined by the determination unit 305 that the required quantity carried in the request is not less than the first available capacity, calculate the second available capacity of the interface on the premise that the call volume is not increased for any interface other than the interface.
[0104] The determination unit 305 is further configured to determine whether the required quantity is less than the second available capacity.
[0105] The response unit 306 is further configured to, when the determination unit 305 determines that the required quantity is less than the second available capacity, send a response to the service side indicating that the second available capacity of the interface meets the call; otherwise, send a response to the service side indicating that the interface does not meet the call requirement.
[0106] In another embodiment,
[0107] When the calculation unit 304 is specifically configured to calculate the first available capacity of the interface, it includes:
[0108] Calculating the difference between the preset CPU occupancy ratio threshold and the CPU occupancy ratio in the latest period;
[0109] Calculating the product of the total call volume corresponding to the interface in the latest period and the difference;
[0110] Calculating the ratio of the product to the preset CPU occupancy ratio threshold as the first available capacity.
[0111] In another embodiment,
[0112] When the calculation unit 304 is specifically configured to calculate the second available capacity of the interface, it includes:
[0113] Calculating the difference between the total call volume of the interface in the latest period and the total call volume in the previous period of the latest period as the first difference;
[0114] Calculating the difference between the preset CPU occupancy ratio threshold of the interface and the CPU occupancy ratio corresponding to the latest period as the second difference;
[0115] Calculating the difference between the CPU occupancy ratio corresponding to the latest period of the interface and the CPU occupancy ratio corresponding to the previous period of the latest period as the third difference;
[0116] Calculating the product of the first difference and the second difference;
[0117] Calculating the ratio of the product to the third difference as the second available capacity of the interface.
[0118] In another embodiment,
[0119] The recording unit 301 is specifically configured to periodically record the call volume of each interface in a corresponding period, statistically calculate the total call volume of each interface in units of the time period, and obtain the CPU occupancy ratio corresponding to the time period.
[0120] In another embodiment,
[0121] When multiple services are hybridly deployed on a single server, record the call volume of all services on the interface for this server;
[0122] When the number of servers on which multiple hybridly deployed services are deployed is different, use the records on the server with the largest total call volume to calculate the CPU occupancy ratio and the total call volume of the interface.
[0123] In another embodiment,
[0124] When multiple requests for evaluating interface capacity are received simultaneously, merge the multiple requests for interface capacity evaluation.
[0125] In another embodiment,
[0126] For the previous period, if interface capacity evaluation has been performed and the evaluation result is that the demand is less than the first available capacity or the demand is less than the second available capacity, when a request for evaluating interface capacity is received again, determine whether the difference between the demand carried in the request and the maximum callable volume of the corresponding interface in the previous period is greater than a preset threshold. If so, perform interface capacity evaluation for the request; otherwise, wait until the end of the current period and then perform interface capacity evaluation for the request.
[0127] The units in the above embodiments can be integrated into one body or separately deployed; they can be combined into one unit or further split into multiple sub-units.
[0128] In another embodiment, an electronic device is further provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the interface capacity evaluation method are implemented.
[0129] In an embodiment of the present application, an interface capacity evaluation system is further provided. Refer to Figure 4 , Figure 4 which is a schematic diagram of the interface capacity evaluation system in an embodiment of the present application. The system includes: a service end and an electronic device; wherein, the service end is signal-connected to the electronic device.
[0130] The electronic device is used to implement the above interface capacity evaluation method, and the service end is used to send an interface capacity evaluation request to the electronic device and receive a response.
[0131] In another embodiment, a computer-readable storage medium is further provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps in the interface capacity evaluation method can be implemented.
[0132] In another embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the interface capacity evaluation method is implemented.
[0133] Figure 5 The following is a schematic physical structure diagram of the electronic device provided by the embodiments of the present invention. As Figure 5 shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540. Among them, the processor 510, the communication interface 520, and the memory 530 complete mutual communication through the communication bus 540. The processor 510 can call the logical instructions in the memory 530 to execute the following method:
[0134] When receiving a request for evaluating the interface capacity sent by the service end, obtain the CPU occupancy rate of the latest period and the total call volume of the interface recorded;
[0135] Calculate the first available capacity of the interface according to the CPU occupancy rate and the total call volume of the interface;
[0136] If it is determined that the required quantity carried in the request is less than the first available capacity, send a response to the service end that the first available capacity of the interface meets the call;
[0137] Among them, the CPU occupancy rate is the CPU occupancy rate corresponding to the time period with the largest total call volume of all interfaces in the corresponding period, and the total call volume of the interface is the total call volume of the interface corresponding to the time period. Each period is divided into multiple consecutive time periods of the same duration.
[0138] In addition, when the logical instructions in the above-mentioned memory 530 can be implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0139] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0140] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the technical solution, 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 can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disks, optical discs, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments.
[0141] The above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the scope of protection of the present invention.
Claims
1. An interface capacity evaluation method, characterized in that, The method includes: When receiving a request for evaluating the capacity of an interface sent by a service end, obtaining the CPU occupancy rate of the latest period and the total call volume of the interface recorded, where each period is divided into multiple consecutive time periods of the same duration, and the total call volume of the interface is the total call volume of the interface counted in units of the time period; Calculating the first available capacity of the interface according to the CPU occupancy rate and the total call volume of the interface, including: calculating the difference between the preset CPU occupancy rate threshold and the CPU occupancy rate of the latest period; calculating the product of the total call volume corresponding to the interface in the latest period and the difference; calculating the ratio of the product to the preset CPU occupancy rate threshold as the first available capacity; If it is determined that the demand carried in the request is less than the first available capacity, sending a response to the service end that the first available capacity of the interface meets the call; When calculating the first available capacity of the interface according to the CPU occupancy rate and the total call volume of the interface, the CPU occupancy rate and the total call volume of the interface are the CPU occupancy rate and the total call volume corresponding to the time period with the largest total call volume of all interfaces in the corresponding period; The method further includes: Recording the call volume of each interface in the corresponding period in a cycle, counting the total call volume of each interface in units of the time period, and obtaining the CPU occupancy rate corresponding to the time period with the largest total call volume of all interfaces.
2. The method according to claim 1, characterized in that, The method further includes: If it is determined that the demand carried in the request is not less than the first available capacity, calculating the second available capacity of the interface on the premise that the call volume of interfaces other than the interface does not increase; Determining whether the demand is less than the second available capacity, if so, sending a response to the service end that the second available capacity of the interface meets the call; otherwise, sending a response to the service end that the interface does not meet the call demand.
3. The method according to claim 2, characterized in that, The calculating the second available capacity of the interface includes: Calculating the difference between the total call volume of the latest period of the interface and the total call volume of the previous period of the latest period as the first difference; Calculating the difference between the preset CPU occupancy rate threshold of the interface and the CPU occupancy rate corresponding to the latest period as the second difference; Calculating the difference between the CPU occupancy rate corresponding to the latest period of the interface and the CPU occupancy rate corresponding to the previous period of the latest period as the third difference; Calculating the product of the first difference and the second difference; Calculating the ratio of the product to the third difference as the second available capacity of the interface.
4. The method according to claim 1, characterized in that, The method further includes: When multiple services are mixedly deployed on a single server, recording the call volume of all services on the interface for this server; When the number of servers on which multiple mixedly deployed services are deployed is different, using the records on the server with the largest total call volume to obtain the CPU occupancy rate and the total call volume of the interface corresponding to the corresponding period.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: If multiple requests for evaluating the capacity of an interface are received simultaneously, merging the multiple requests for evaluating the capacity of an interface for interface capacity evaluation.
6. The method according to any one of claims 2-4, characterized in that, The method further includes: If the interface capacity has been evaluated for the latest cycle, and the evaluation result is that the demand is less than the first available capacity or the demand is less than the second available capacity, when a request to evaluate the interface capacity is received again, it is determined whether the difference between the demand carried in the request and the maximum callable amount of the corresponding interface in the previous cycle is greater than a preset threshold. If so, the interface capacity is evaluated for the request; otherwise, wait until the end of the current cycle and then evaluate the interface capacity for the request.
7. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, the method described in any one of claims 1-6 is implemented.
8. An interface capacity evaluation system, characterized in that, The system includes: A service end and the electronic device described in claim 7, wherein the service end is signal-connected to the electronic device.
9. A computer-readable storage medium, on which a computer program is stored, characterized in that, When the program is executed by a processor, the method described in any one of claims 1-6 is implemented.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the method described in any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Method for controlling management computer and method for controlling server
JP2006302249A