A method and apparatus for monitoring an interface service
The integration of server and interface protection mechanisms addresses the instability issue in microservices under high traffic by automating service degradation and recovery, ensuring stable operation.
Patent Information
- Application Number
- CN202010872571.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-26
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2040-08-26
AI Technical Summary
The existing service protection mechanism cannot be effectively coordinated and connected, resulting in the inability to maintain the stability of front-end services that withstand large traffic. The existing technology cannot provide reliable current limiting and frequency prevention and brushing when facing large traffic and malicious requests, resulting in unstable service.
Through the methods and devices of monitoring interface services, combined with the protection mechanisms at the server level and interface level, a timing task mechanism is used to coordinate all levels of service to achieve current limiting, frequency prevention and service downgrades, provide a service recovery mechanism, and ensure service stability.
It has achieved effective protection against large traffic and malicious requests, maintained stable service, reduced waste of manpower and energy, and provided personalized service protection and recovery mechanisms.
Smart Images

Figure CN113760633B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular, to a method and device for monitoring interface services. Background Art
[0002] Currently, the application of the microservice architecture is becoming more and more extensive, and how to maintain the stability of services has become a key issue of concern. When a large amount of traffic surges in, the service is very likely to encounter situations such as slow processing of the thread pool, request timeouts, and server exceptions.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] The existing service protection mechanisms cannot be coordinated and cascaded, and the effect of 1 + 1 > 2 cannot be achieved, resulting in the inability to effectively maintain the stability of the front-end service that bears a large amount of traffic. Summary of the Invention
[0005] In view of this, embodiments of the present invention provide a method and device for monitoring interface services to solve the technical problem of being unable to effectively maintain the stability of the front-end service that bears a large amount of traffic.
[0006] To achieve the above object, according to one aspect of the embodiments of the present invention, a method for monitoring interface services is provided, including:
[0007] Judging whether the request frequency is greater than or equal to the request frequency threshold;
[0008] If so, rejecting the access of the current request;
[0009] If not, allowing the access of the current request, and continuing to judge whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each interface service; if not, calling the interface service and returning the call result of the interface service; if so, rejecting the call of the interface service.
[0010] Optionally, after rejecting the call of the interface service, it further includes:
[0011] Periodically scanning the cache query frequency of the interface service;
[0012] If it is monitored that the cache query frequency is less than the cache query frequency threshold, allowing the call of the interface service.
[0013] Optionally, after judging whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the interface frequency threshold corresponding to each interface service, it further includes:
[0014] Monitor the operating metrics of the system and determine whether the operating metrics of the system meet the preset metric requirements;
[0015] If not, continue to determine whether the interface service can be degraded; if so, stop the interface service.
[0016] Optionally, after stopping the interface service, it further includes:
[0017] Periodically scan the operating metrics of the system;
[0018] If it is monitored that the operating metrics of the system meet the preset metric requirements, resume the interface service.
[0019] Optionally, the operating metrics include: the CPU operating status of the server, the virtual machine operating status of the server, and / or the operating status of the interface service.
[0020] Optionally, after stopping the interface service, it further includes:
[0021] Periodically scan the operating metrics of the system;
[0022] If it is monitored that the operating metrics of the system do not meet the preset metric requirements, and the interface service is a degradable interface service but the interface service has not been stopped, forcefully stop the interface service.
[0023] In addition, according to another aspect of the embodiments of the present invention, there is provided a device for monitoring an interface service, including a monitoring module, configured to:
[0024] Determine whether the request frequency is greater than or equal to the request frequency threshold;
[0025] If so, reject the access of the current request;
[0026] If not, allow the access of the current request, and continue to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each interface service; if not, call the interface service and return the call result of the interface service; if so, reject the call of the interface service.
[0027] Optionally, it further includes a scanning module, configured to:
[0028] Periodically scan the cache query frequency of the interface service;
[0029] If it is monitored that the cache query frequency is less than the cache query frequency threshold, allow the call of the interface service.
[0030] Optionally, it further includes a degradation module, configured to:
[0031] After determining whether the cache query frequency of each interface service to be invoked by the currently accessed request is greater than or equal to the interface frequency threshold corresponding to each of the interface services, monitor the running metrics of the system and determine whether the running metrics of the system meet the preset metric requirements;
[0032] If not, continue to determine whether the interface service can be degraded; if so, stop the interface service.
[0033] Optionally, the degradation module is further configured to:
[0034] After stopping the interface service, periodically scan the running metrics of the system;
[0035] If it is monitored that the running metrics of the system meet the preset metric requirements, resume the interface service.
[0036] Optionally, the running metrics include: the CPU running status of the server, the virtual machine running status of the server, and / or the running status of the interface service.
[0037] Optionally, the degradation module is further configured to:
[0038] After stopping the interface service, periodically scan the running metrics of the system;
[0039] If it is monitored that the running metrics of the system do not meet the preset metric requirements, and the interface service is a degradable interface service but the interface service has not been stopped, forcibly stop the interface service.
[0040] According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including:
[0041] One or more processors;
[0042] A storage device for storing one or more programs,
[0043] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments.
[0044] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above embodiments is implemented.
[0045] One embodiment of the above invention has the following advantages or beneficial effects: Since it adopts the technical means that if the request frequency is less than the request frequency threshold, the current request is allowed to access, and it continues to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold. If so, the interface service is called, it overcomes the technical problem in the prior art that the stability of the front-end service that can withstand large traffic cannot be effectively maintained. The embodiment of the present invention integrates the service protection mechanisms at the server level and the interface level into a linkage system, and the independent current limiting and anti-brushing technologies cooperate to ensure the stability of the front-end service; and a service recovery mechanism is provided, saving a large amount of manpower and energy.
[0046] The further effects of the above non-conventional optional ways will be described below in conjunction with the specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] The drawings are used to better understand the present invention and do not constitute an improper limitation to the present invention. Among them:
[0048] Figure 1 is a schematic diagram of the main process of the method for monitoring interface services according to an embodiment of the present invention;
[0049] Figure 2 is a schematic diagram of the main process of the method for monitoring interface services according to a reference embodiment of the present invention;
[0050] Figure 3 is a schematic diagram of the structure of the system architecture according to an embodiment of the present invention;
[0051] Figure 4 is a schematic diagram of the main modules of the device for monitoring interface services according to an embodiment of the present invention;
[0052] Figure 5 is an exemplary system architecture diagram to which the embodiment of the present invention can be applied;
[0053] Figure 6 is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0054] The following describes the exemplary embodiments of the present invention in conjunction with the drawings. Among them, various details of the embodiments of the present invention are included to help understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described here without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted below.
[0055] To protect services from crashing, various technologies have emerged for support, mainly including:
[0056] Existing technology 1: Service degradation and service circuit breaker at the web application level;
[0057] Existing technology 2: Frequency prevention and brute-force prevention technologies at the web application level;
[0058] Existing technology 3: Traffic limiting at the server level.
[0059] In the process of implementing the present invention, the inventor found that there are at least the following problems in the existing technologies:
[0060] 1) From a macroscopic perspective, the above technologies all have their specific application scopes and can only solve specific problems in specific scenarios.
[0061] 2) Although there are corresponding service protection mechanisms in each scenario currently, there is a lack of a mature application system and coordination and fallback solutions, which makes each technology unable to be coordinated and concatenated, and cannot achieve the effect of 1 + 1 > 2. For example, the commonly used Hystrix framework for service degradation and circuit breaker and the anti-brute-force traffic limiting module of the interface have overlapping functions. If the service needs to be degraded, the role of the anti-brute-force module will be zero, wasting a large amount of cache and computing time in vain.
[0062] 3) Each service itself has various uncontrollable factors. In specific scenarios, especially during the influx of a large amount of traffic, it is not possible to fully "trust" the existing technologies to solve complex problems in various scenarios. Finally, it is found that manually degrading the service is more reassuring, so it goes back to the old way of manual service degradation, wasting time and energy.
[0063] Therefore, the technical problem to be solved by the present invention is to use a timed task mechanism to coordinate the service protection mechanisms at all levels for the front-end service that bears a large amount of traffic, so as to achieve reliable and efficient service traffic limiting, frequency prevention, and service degradation, and ensure the stability of the service in the face of peak traffic and malicious requests, providing support for the normal flow of data in the background.
[0064] Figure 1 It is a schematic diagram of the main process of the method for monitoring an interface service according to an embodiment of the present invention. As an embodiment of the present invention, as Figure 1 shown, the method for monitoring an interface service may include:
[0065] Step 101, determine whether the request frequency is greater than or equal to the request frequency threshold; if so, execute step 102; if not, execute step 103.
[0066] Internet users initiate requests to the server through various clients, such as applets, applications, web pages, etc. The requests first reach the proxy server. On the proxy server, the function of the proxy server itself can be used to limit the request frequency and determine whether the request frequency is greater than or equal to the pre-configured request frequency threshold.
[0067] Step 102, reject access to the current request.
[0068] If the request frequency is greater than or equal to the pre-configured request frequency threshold, reject access to the current request, thus achieving the first-level anti-frequency and anti-current-limiting effect.
[0069] Step 103, allow access to the current request, and continue to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each said interface service; if so, execute Step 104; if not, execute Step 105.
[0070] If the request frequency is less than the pre-configured request frequency threshold, allow access to the current request, and continue to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each said interface service. It should be noted that a request may need to call multiple interface services, so the corresponding cache query frequency threshold can be pre-configured for each interface service respectively. Optionally, in the embodiments of the present invention, the cache query frequency threshold can be configured for relatively important interface services to provide anti-frequency and anti-brush support at the interface level for relatively important interface services, reduce repeated requests, and relieve the database pressure.
[0071] After allowing the request to access, determine whether the cache query frequency of each interface service to be called by the request is greater than or equal to the cache query frequency threshold corresponding to each said interface service respectively.
[0072] Optionally, if the request frequency is less than the pre-configured request frequency threshold, further screen the traffic by executing the lua script to determine whether it is an illegal request or an invalid request, and finally decide whether the request can pass.
[0073] Step 104, reject calling the said interface service.
[0074] If the cache query frequency of any one interface service is greater than or equal to the cache query frequency threshold corresponding to the interface service, reject calling the interface service.
[0075] Optionally, after refusing to call the interface service, it also includes: regularly scanning the cache query frequency of the interface service; if the cache query frequency is monitored to be less than the cache query frequency threshold, then allowing the interface service to be called. The embodiment of the present invention sets a cache query switch for the interface service. If the cache query switch is turned on, the cache query frequency of the interface service is monitored to see whether it is greater than or equal to the set cache query frequency threshold. If so, the request to enter the interface is rejected until the cache query frequency is less than the cache query frequency threshold, then the request to enter the interface is allowed.
[0076] Step 105: call the interface service and return the calling result of the interface service.
[0077] If there is any interface service whose cache query frequency is less than the cache query frequency threshold corresponding to the interface service, the interface service is called, and then the calling result of the interface service is returned.
[0078] According to the various embodiments described above, it can be seen that the embodiments of the present invention allow access to the current request if the request frequency is less than the request frequency threshold, and continue to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold. If so, the technical means of calling the interface service solves the technical problem that the prior art cannot effectively maintain the stability of the foreground service that bears large traffic. The embodiments of the present invention integrate the service protection mechanisms at the server level and the interface level into an interlocking system, and the independent current limiting and anti-brushing technologies work together to provide protection for the stability of the foreground service; and provide a service recovery mechanism, saving a lot of manpower and energy.
[0079] Figure 2 Schematic diagram of the main process of a method for monitoring interface services according to a reference embodiment of the present invention. As another embodiment of the present invention, Figure 2 As shown, the method for monitoring interface services may include:
[0080] Step 201, determine whether the request frequency is greater than or equal to the request frequency threshold; if so, execute step 202; if not, execute step 203.
[0081] Internet users initiate requests to the server through various clients, such as applets, applications, web pages, etc. The requests first reach the proxy server. On the proxy server, the proxy server’s own functions can be used to limit the request frequency and determine whether the request frequency is greater than or equal to the pre-configured request frequency threshold.
[0082] Step 202: deny access to the current request.
[0083] If the request frequency is greater than or equal to a pre-configured request frequency threshold, access to the current request is rejected, thus achieving the effect of preventing frequency and limiting traffic at the first layer.
[0084] Step 203: Allow access to the current request, and continue to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each of the interface services; if so, execute Step 204; if not, execute Step 205.
[0085] If the request frequency is less than the pre-configured request frequency threshold, access to the current request is allowed, and continue to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each of the interface services. It should be noted that a request may need to call multiple interface services, so a corresponding cache query frequency threshold can be pre-configured for each interface service respectively. Optionally, in the embodiments of the present invention, a cache query frequency threshold can be configured for relatively important interface services to provide anti-frequency and anti-brush support at the interface level for relatively important interface services, reduce duplicate requests, and relieve the database pressure.
[0086] After allowing the request to access, determine respectively whether the cache query frequency of each interface service to be called by the request is greater than or equal to the cache query frequency threshold corresponding to each of the interface services.
[0087] Optionally, if the request frequency is less than the pre-configured request frequency threshold, the traffic is further screened by executing a lua script to determine whether it is an illegal request or an invalid request, and finally decide whether the request can pass.
[0088] Step 204: Reject the call to the interface service.
[0089] If there is any interface service whose cache query frequency is greater than or equal to the cache query frequency threshold corresponding to the interface service, reject the call to the interface service.
[0090] Optionally, after rejecting the call to the interface service, it further includes: regularly scanning the cache query frequency of the interface service; if it is monitored that the cache query frequency is less than the cache query frequency threshold, allow the call to the interface service. The embodiments of the present invention set a cache query switch for the interface service. If the cache query switch is turned on, monitor whether the cache query frequency of the interface service is greater than or equal to the set cache query frequency threshold. If so, reject the request from entering the interface until the cache query frequency is less than the cache query frequency threshold and then allow the request to enter the interface.
[0091] Step 205: Call the interface service and return the call result of the interface service.
[0092] If the cache query frequency of any interface service is less than the cache query frequency threshold corresponding to the interface service, then call the interface service and return the call result of the interface service.
[0093] Step 206, monitor the running metrics of the system, and determine whether the running metrics of the system meet the preset metric requirements; if so, end; if not, execute step 207.
[0094] Optionally, the running metrics include: the CPU running metrics of the server, the running status of the virtual machine of the server, and / or the running status of the interface service. The running metrics can be customized by the operation and maintenance personnel. For example, the running metrics configuration of the advertisement recommendation interface is as follows:
[0095] CPU running metrics: CPU usage < 60%; memory occupancy < 70%;
[0096] Running status of the virtual machine: heap memory usage < 70%;
[0097] Running status of the interface service: interface availability < 90%; TP99 set value 500ms, and the number of times continuously exceeding the set value within one minute reaches 10 times.
[0098] In order to avoid the occurrence of service avalanche, the embodiment of the present invention introduces the Hytrix fuse framework, so that service automatic degradation and fuse functions can be provided when the upstream interface is abnormal, achieving the effect of sacrificing the pawn to save the rook.
[0099] Step 207, determine whether the interface service can be degraded; if so, execute step 208; if not, end.
[0100] If any one of the running metrics does not meet the preset metric requirements, then determine whether the interface service can be degraded.
[0101] Step 208, stop the interface service.
[0102] If the service interface can be degraded, then perform degradation and fuse processing on the interface service (that is, stop the interface service), and the service function provided by the interface service stops.
[0103] Step 209, periodically scan the running metrics of the system. If it is monitored that the running metrics of the system meet the preset metric requirements, then resume the interface service.
[0104] After stopping the interface service, the running metrics of the system can be periodically scanned through a scheduled task, such as the CPU running metrics of the server and the running status of the virtual machine of the server. It should be noted that since the interface service has stopped, the running status of the interface service is not one of the metrics for service recovery.
[0105] If it is monitored that the operation metrics of the system meet the preset metric requirements, the interface service is restored, and at this time, the service function provided by the interface service is automatically enabled. If the interface service has been automatically degraded, it will no longer provide services. After the operation metrics of the system return to normal, the interface service will be automatically restored and provide services again.
[0106] Step 210, regularly scan the operation metrics of the system. If it is monitored that the operation metrics of the system do not meet the preset metric requirements and the interface service has not stopped, forcefully stop the interface service.
[0107] The operation metrics of the system can be regularly scanned through a scheduled task (such as: the CPU operation metrics of the server, the running status of the virtual machine of the server, and / or the running status of the interface service). If it is monitored that any one of the operation metrics of the system does not meet the preset metric requirements, and the interface service is a degradable interface service but the interface service has not been stopped yet, forcefully stop the interface service to prevent service crashes.
[0108] The present invention tries to make more personalized processing for the degradation, anti-brush and anti-frequency of the interface service by formulating various degradation and coordination schemes. At the same time, it serves as a backup for each protection mechanism module, and when abnormal operation metrics are monitored, it will handle them according to the specified scheme by itself; and a service recovery mechanism is provided to automatically restore the interface that has stopped serving, saving a lot of manpower and energy.
[0109] In addition, the specific implementation content of the method for monitoring the interface service in a reference embodiment of the present invention has been described in detail in the above-mentioned method for monitoring the interface service, so the repeated content will not be described here again.
[0110] Figure 3 It is a schematic structural diagram of the system architecture according to an embodiment of the present invention. As Figure 3 shown, the system architecture includes a proxy server, an application server, and a service layer service protection coordination system.
[0111] Internet users initiate requests to the server through various clients, such as applets, applications, web pages, etc. The requests first reach the proxy server (Nginx server). On the proxy server, the function of the proxy server itself can be used to limit the request frequency and determine whether the request frequency is greater than or equal to the pre-configured request frequency threshold. The proxy server can perform flow limiting at the lower server level, smooth the traffic peaks, and prevent high-frequency requests.
[0112] If the request frequency is less than the pre-configured request frequency threshold, the proxy server forwards the request to the application server, and determines whether the cache query frequencies of the respective interface services to be invoked by the currently accessed request are greater than or equal to the cache query frequency thresholds corresponding to the respective interface services; if not, the interface service is invoked and the call result of the interface service is returned; if so, the invocation of the interface service is rejected. The application server provides interface-level anti-frequency and anti-brush support for relatively important interface services, reduces duplicate requests, and alleviates the database pressure. The application server can also periodically scan the cache query frequencies of the interface services; if it monitors that the cache query frequency is less than the cache query frequency threshold, the invocation of the interface service is allowed. Optionally, Redis cache can be used for interface anti-brush and anti-frequency protection.
[0113] Optionally, the Hytrix fuse framework can be used for fuse degradation, monitoring the running metrics of the system, and determining whether the running metrics of the system meet the preset metric requirements; if not, it continues to determine whether the interface service is degradable; if so, the interface service is stopped. After stopping the interface service, it further includes: periodically scanning the running metrics of the system; if it monitors that the running metrics of the system meet the preset metric requirements, the interface service is restored. If it monitors that the running metrics of the system do not meet the preset metric requirements, and the interface service is a degradable interface service but the interface service has not been stopped, the interface service is forcibly stopped.
[0114] The service-level service protection coordination system can formulate various degradation and coordination schemes internally, enabling more personalized processing of interface degradation, anti-brush, and anti-frequency. At the same time, it serves as a backup for each protection mechanism module, automatically processing according to the specified scheme when abnormal running metrics are monitored; and provides a service recovery mechanism to automatically restore the interfaces that have stopped service, saving a large amount of manpower and effort.
[0115] Figure 4 is a schematic diagram of the main modules of the device for monitoring interface services according to an embodiment of the present invention, as Figure 4 shown, the device 400 for monitoring interface services includes a monitoring module 401, a scanning module 402, and a degradation module 403.
[0116] Among them, the monitoring module 401 is used to:
[0117] Determine whether the request frequency is greater than or equal to the request frequency threshold;
[0118] If so, reject the current request;
[0119] If not, then the current request is allowed to access, and it continues to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each of the interface services; if not, then the interface service is called and the call result of the interface service is returned; if so, then the call of the interface service is rejected.
[0120] Optionally, the scanning module 402 is configured to:
[0121] Regularly scan the cache query frequency of the interface service;
[0122] If it is monitored that the cache query frequency is less than the cache query frequency threshold, then the call of the interface service is allowed.
[0123] Optionally, the degradation module 403 is configured to:
[0124] After determining whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the interface frequency threshold corresponding to each of the interface services, monitor the running metrics of the system and determine whether the running metrics of the system meet the preset metric requirements;
[0125] If not, then continue to determine whether the interface service can be degraded; if so, then stop the interface service.
[0126] Optionally, the degradation module 403 is further configured to:
[0127] After stopping the interface service, regularly scan the running metrics of the system;
[0128] If it is monitored that the running metrics of the system meet the preset metric requirements, then resume the interface service.
[0129] Optionally, the running metrics include: the CPU running status of the server, the virtual machine running status of the server, and / or the running status of the interface service.
[0130] Optionally, the degradation module 403 is further configured to:
[0131] After stopping the interface service, regularly scan the running metrics of the system;
[0132] If it is monitored that the running metrics of the system do not meet the preset metric requirements, and the interface service is a degradable interface service but the interface service has not been stopped, then forcefully stop the interface service.
[0133] According to the various embodiments described above, it can be seen that in the embodiments of the present invention, if the request frequency is less than the request frequency threshold, the current request is allowed to access, and it is continuously determined whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold. If so, the technical means of calling the interface service solves the technical problem in the prior art that the stability of the foreground service that can withstand large traffic cannot be effectively maintained. The embodiments of the present invention integrate the service protection mechanisms at the server level and the interface level into a linkage system, and the independent current limiting and anti-brushing technologies cooperate to ensure the stability of the foreground service; and a service recovery mechanism is provided, saving a large amount of manpower and energy.
[0134] It should be noted that the specific implementation content of the device for monitoring interface services in the present invention has been described in detail in the method for monitoring interface services described above, so the repeated content will not be described here.
[0135] Figure 5 An exemplary system architecture 500 to which the method for monitoring interface services or the device for monitoring interface services according to the embodiments of the present invention can be applied is shown.
[0136] As Figure 5 shown, the system architecture 500 may include terminal devices 501, 502, 503, a network 504, and a server 505. The network 504 is used to provide a medium for a communication link between the terminal devices 501, 502, 503 and the server 505. The network 504 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.
[0137] Users can use the terminal devices 501, 502, 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0138] The terminal devices 501, 502, 503 may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.
[0139] The server 505 may be a server providing various services, such as a background management server (only as an example) that supports a shopping website browsed by users using the terminal devices 501, 502, 503. The background management server may analyze and process data such as item information query requests received, and feedback the processing results (such as target push information, item information - only as examples) to the terminal devices.
[0140] It should be noted that the method for monitoring interface services provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the device for monitoring interface services is generally disposed in the server 505 .
[0141] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0142] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0143] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0144] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0145] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above functions defined in the system of the present invention are performed.
[0146] It should be noted that the computer-readable medium shown in the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. And in the present invention, the computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries the computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted by any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functions, and operations of possible implementations of systems, methods, and computer programs according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a segment of a program, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the boxes may occur in a different order than that marked in the accompanying drawings. For example, two consecutive boxes shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, as well as combinations of boxes in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0148] The modules described in the embodiments of the present invention can be implemented in software or in hardware. The described modules can also be provided in a processor. For example, it can be described as: a processor includes a monitoring module, a scanning module, and a degradation module. In some cases, the names of these modules do not constitute a limitation on the module itself.
[0149] As another aspect, the present invention also provides a computer-readable medium, which can be included in the device described in the above embodiments; or can exist separately and not be assembled into the device. The above computer-readable medium carries one or more programs. When the one or more programs are executed by the device, the device implements the following method: determining whether the request frequency is greater than or equal to the request frequency threshold; if so, rejecting the current request; if not, allowing access to the current request and continuing to determine whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold corresponding to each interface service; if not, calling the interface service and returning the call result of the interface service; if so, rejecting the call to the interface service.
[0150] According to the technical solution of the embodiment of the present invention, since the technical means is adopted that if the request frequency is less than the request frequency threshold, the current request is allowed to access, and it continues to judge whether the cache query frequency of each interface service to be called by the currently accessed request is greater than or equal to the cache query frequency threshold, and if so, the interface service is called, the technical problem in the prior art that the front-end service bearing a large traffic cannot be effectively maintained stably is overcome. The embodiment of the present invention integrates the service protection mechanisms at the server level and the interface level into a linked system, and the independent current limiting and anti-brushing technologies cooperate to provide guarantee for the stability of the front-end service; and a service recovery mechanism is provided, saving a large amount of manpower and energy.
[0151] The above specific embodiments do not constitute a limitation to the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for monitoring an interface service, characterized in that, including: judging whether the request frequency is greater than or equal to the request frequency threshold; if so, rejecting access to the current request; if not, allowing access to the current request and continuing to judge whether the cache query frequencies of the respective interface services to be called by the currently accessed request are greater than or equal to the cache query frequency thresholds corresponding to the respective interface services; if not, calling the interface service and returning the call result of the interface service; if so, rejecting the call of the interface service; after rejecting the call of the interface service, further including: periodically scanning the cache query frequency of the interface service; if it is monitored that the cache query frequency is less than the cache query frequency threshold, allowing the call of the interface service; after judging whether the cache query frequencies of the respective interface services to be called by the currently accessed request are greater than or equal to the interface frequency thresholds corresponding to the respective interface services, further including: monitoring the running metrics of the system and judging whether the running metrics of the system meet the preset metric requirements; if not, continuing to judge whether the interface service can be degraded; if so, stopping the interface service; after stopping the interface service, further including: periodically scanning the running metrics of the system; if it is monitored that the running metrics of the system meet the preset metric requirements, restoring the interface service; if it is monitored that the running metrics of the system do not meet the preset metric requirements, and the interface service is a degradable interface service but the interface service has not been stopped, forcibly stopping the interface service.
2. The method according to claim 1, characterized in that, The running metrics include: the CPU running status of the server, the virtual machine running status of the server, and / or the running status of the interface service.
3. A device for monitoring an interface service, characterized in that, including a monitoring module for: judging whether the request frequency is greater than or equal to the request frequency threshold; if so, rejecting access to the current request; if not, allowing access to the current request and continuing to judge whether the cache query frequencies of the respective interface services to be called by the currently accessed request are greater than or equal to the cache query frequency thresholds corresponding to the respective interface services; if not, calling the interface service and returning the call result of the interface service; if so, rejecting the call of the interface service; further including a scanning module for: periodically scanning the cache query frequency of the interface service; if it is monitored that the cache query frequency is less than the cache query frequency threshold, allowing the call of the interface service; further including a degradation module for: after judging whether the cache query frequencies of the respective interface services to be called by the currently accessed request are greater than or equal to the interface frequency thresholds corresponding to the respective interface services, monitoring the running metrics of the system and judging whether the running metrics of the system meet the preset metric requirements; if not, continuing to judge whether the interface service can be degraded; if so, stopping the interface service; the degradation module is further used for: after stopping the interface service, periodically scanning the running metrics of the system; if it is monitored that the running metrics of the system meet the preset metric requirements, restoring the interface service; if it is monitored that the running metrics of the system do not meet the preset metric requirements, and the interface service is a degradable interface service but the interface service has not been stopped, forcibly stopping the interface service.
4. An electronic device, characterized in that, including: one or more processors; A storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to claim 1 or 2.
5. A computer-readable medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, the method according to claim 1 or 2 is implemented.
Citation Information
Patent Citations
Dynamic current limiting method, Nginx server, storage medium and device
CN108073465A
Interface invocation method, interface invocation response method, and server
CN109189509A