A method and device for dynamically adjusting message receiving rate

By dynamically adjusting the message reception rate, based on the maximum and core message reception rate thresholds and the monitoring indicators of the service server, the problem of single current limit control and insufficient environmental adaptability is solved, traffic management and resource optimization are realized, and service availability is improved. and resource utilization efficiency.

CN113765813BActive Publication Date: 2024-12-10BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011019731.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-24
Publication Date
2024-12-10
Estimated Expiration
2040-09-24

AI Technical Summary

Technical Problem

In the prior art, the current limit control is single or cannot be dynamically adjusted according to different environments, resulting in inefficient service availability and resource utilization.

Method used

By determining to return an exception to the terminal based on the maximum message reception rate threshold and the core message reception rate threshold, and dynamically adjust the core message reception rate threshold according to the response time, response result or resource utilization of the service server, to Implement flow control and resource optimization.

Benefits of technology

Effectively reduce bandwidth usage, make full use of service and network resources, ensure service availability and adapt to changes in different environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113765813B_ABST
    Figure CN113765813B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for dynamically adjusting the message receiving rate, and relates to the field of computer technology. A specific implementation of the method includes: receiving message data sent by a terminal, determining to return an exception to the terminal, placing the message data into a buffer queue, or sending the message data to a service server according to a maximum message receiving rate threshold and a core message receiving rate threshold; obtaining the response time, response result, or resource utilization rate of the service server, and dynamically adjusting the core message receiving rate threshold according to the response time, response result, or resource utilization rate of the service server. This implementation can solve the technical problem that the current limiting control is single or cannot be dynamically adjusted according to different environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and device for dynamically adjusting a message receiving rate. Background Art

[0002] High concurrency, high availability, and large traffic are synonymous with Internet companies. In order to ensure service availability, effective traffic control is the key to ensuring system availability.

[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] At present, the commonly used current limiting methods either have the problem of relatively simple current limiting control or the problem of being unable to be dynamically adjusted according to different environments. Summary of the invention

[0005] In view of this, an embodiment of the present invention provides a method and apparatus for dynamically adjusting a message receiving rate, so as to solve the technical problem that the current limiting control is single or cannot be dynamically adjusted according to different environments.

[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for dynamically adjusting a message receiving rate is provided, comprising:

[0007] Receive message data sent by a terminal, and determine, according to a maximum message receiving rate threshold and a core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server;

[0008] Obtain the response time, response result or resource utilization rate of the business server, and dynamically adjust the core message receiving rate threshold according to the response time, response result or resource utilization rate of the business server.

[0009] Optionally, determining, according to a maximum message receiving rate threshold and a core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server includes:

[0010] Determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold;

[0011] If so, returning an exception to the terminal;

[0012] If not, determining whether the actual message receiving rate is greater than the core message receiving rate threshold;

[0013] If yes, the message data is placed in a buffer queue;

[0014] If not, the message data is sent to the service server.

[0015] Optionally, determining, according to a maximum message receiving rate threshold and a core message receiving rate threshold, that an exception is returned, putting the message data into a buffer queue, or sending the message data to a service server, further includes:

[0016] At every preset time interval, determining whether the current actual message receiving rate is greater than the core message receiving rate threshold;

[0017] If not, taking out the message data from the head of the buffer queue and sending the message data to the service server;

[0018] If so, continue waiting.

[0019] Optionally, dynamically adjusting the core message receiving rate threshold according to the response time, response result or resource usage of the service server includes:

[0020] If the response time of the service server is greater than the standard response time for a number of times exceeding the first number threshold within the preset time period, the core message receiving rate threshold is lowered;

[0021] If the response result of the service server is an abnormal state result, lowering the core message receiving rate threshold;

[0022] If the resource usage of the service server is greater than the first resource threshold, the core message receiving rate threshold is lowered.

[0023] Optionally, dynamically adjusting the core message receiving rate threshold according to the response time, response result or resource usage of the service server further includes:

[0024] If the response time of the service server is less than or equal to the preset response time for more than a second number threshold within the preset time period, the core message receiving rate threshold is increased;

[0025] If the response result of the business server is that the service is available, the core message receiving rate threshold is increased;

[0026] If the resource usage rate of the service server is less than or equal to the second resource threshold, the core message receiving rate threshold is increased.

[0027] Optionally, the resource usage rate includes at least one of the following: CPU usage rate, memory usage rate, and number of requested connections;

[0028] The abnormal status results include interface timeout or service failure.

[0029] Optionally, the method is applied to a reverse proxy server.

[0030] In addition, according to another aspect of an embodiment of the present invention, a device for dynamically adjusting a message receiving rate is provided, comprising:

[0031] A message processing module, used for receiving message data sent by a terminal, and determining, according to a maximum message receiving rate threshold and a core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server;

[0032] The rate adjustment module is used to obtain the response time, response result or resource utilization rate of the business server, and dynamically adjust the core message receiving rate threshold according to the response time, response result or resource utilization rate of the business server.

[0033] Optionally, the message processing module is further used to:

[0034] Determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold;

[0035] If so, returning an exception to the terminal;

[0036] If not, determining whether the actual message receiving rate is greater than the core message receiving rate threshold;

[0037] If yes, the message data is placed in a buffer queue;

[0038] If not, the message data is sent to the service server.

[0039] Optionally, the message processing module is further used to:

[0040] At every preset time interval, determining whether the current actual message receiving rate is greater than the core message receiving rate threshold;

[0041] If not, taking out the message data from the head of the buffer queue and sending the message data to the service server;

[0042] If so, continue waiting.

[0043] Optionally, the rate adjustment module is further used to:

[0044] If the response time of the service server is greater than the standard response time for a number of times exceeding the first number threshold within the preset time period, the core message receiving rate threshold is lowered;

[0045] If the response result of the service server is an abnormal state result, lowering the core message receiving rate threshold;

[0046] If the resource usage of the service server is greater than the first resource threshold, the core message receiving rate threshold is lowered.

[0047] Optionally, the rate adjustment module is further used to:

[0048] If the response time of the service server is less than or equal to the preset response time for more than a second number threshold within the preset time period, the core message receiving rate threshold is increased;

[0049] If the response result of the business server is that the service is available, the core message receiving rate threshold is increased;

[0050] If the resource usage rate of the service server is less than or equal to the second resource threshold, the core message receiving rate threshold is increased.

[0051] Optionally, the resource usage rate includes at least one of the following: CPU usage rate, memory usage rate, and number of requested connections;

[0052] The abnormal status results include interface timeout or service failure.

[0053] Optionally, the method is applied to a reverse proxy server.

[0054] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:

[0055] one or more processors;

[0056] a storage device for storing one or more programs,

[0057] 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 one of the above embodiments.

[0058] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0059] An embodiment of the above invention has the following advantages or beneficial effects: because it adopts a technical means to determine whether to return an exception to the terminal, put the message data into a buffer queue or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, and dynamically adjust the core message receiving rate threshold according to the response time, response result or resource utilization rate of the service server, it overcomes the technical problem that the current limiting control in the prior art is single or cannot be dynamically adjusted according to different environments. The embodiment of the present invention determines whether to return an exception to the terminal, put the message data into a buffer queue or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, limits the flow of requests, and ensures that the service is available; dynamically adjusts the core message receiving rate threshold according to the response time, response result or resource utilization rate of the service server, and can dynamically adjust the core message receiving rate threshold according to different environments, which can not only effectively reduce the bandwidth, but also make full use of service resources and network resources.

[0060] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0062] Figure 1 is a schematic diagram of the main process of a method for dynamically adjusting a message receiving rate according to an embodiment of the present invention;

[0063] Figure 2 It is a schematic diagram of the main process of a method for dynamically adjusting a message receiving rate according to a reference embodiment of the present invention;

[0064] Figure 3 Schematic diagram of the main process of a method for dynamically adjusting a message receiving rate according to another reference embodiment of the present invention

[0065] Figure 4 is a schematic diagram of main modules of a device for dynamically adjusting a message receiving rate according to an embodiment of the present invention;

[0066] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0067] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0068] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein 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 in the following description.

[0069] At present, the commonly used current limiting methods are as follows:

[0070] Method 1: Use remote service to call the middleware. This method requires configuring the current limit and time interval, and clearing the number of requests to zero at each time interval. The terminal calls the counter before each call. If the number of requests does not exceed the current limit, the call continues. If it exceeds the current limit, an exception is thrown.

[0071] Mode 2: Sliding time window mode. Configure the message receiving rate threshold. If the actual message receiving rate is greater than the preset message receiving rate threshold, the receiving end time window is increased; if the actual message receiving rate is less than the preset message receiving rate threshold, the receiving end time window is reduced.

[0072] Method 1 has a relatively simple flow control for service calls and requires manual settings. If it is set too low in a non-high-concurrency environment, it will affect the service request rate. If it is set too high during high-concurrency, it will easily cause instability and availability of key services.

[0073] Compared with method 1, method 2 can dynamically set the message receiving rate threshold, but it still needs to be manually set and then dynamically adjust the threshold. If the service is expanded, the set message receiving rate threshold should be changed from the original one, which still needs to be manually modified and controlled, and cannot be dynamically adjusted according to different environments.

[0074] In order to solve the technical problems existing in the prior art, an embodiment of the present invention provides a method for dynamically adjusting a message receiving rate, which can dynamically adjust the message receiving rate to ensure system availability.

[0075] Figure 1 FIG. 1 is a schematic diagram of the main process of the method for dynamically adjusting the message receiving rate according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the method for dynamically adjusting the message receiving rate may include:

[0076] Step 101, receiving message data sent by a terminal, and determining, according to a maximum message receiving rate threshold and a core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server.

[0077] Optionally, the method is applied to a reverse proxy server. After receiving the message data sent by the terminal, the reverse proxy server determines whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server according to the maximum message reception rate threshold and the core message reception rate threshold. The embodiment of the present invention controls the flow through the maximum message reception rate threshold, the core message reception rate threshold, and the buffer queue, and plays a flow limiting role on the request.

[0078] Optionally, determining, according to a maximum message receiving rate threshold and a core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server includes:

[0079] Determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold;

[0080] If so, returning an exception to the terminal;

[0081] If not, determining whether the actual message receiving rate is greater than the core message receiving rate threshold;

[0082] If yes, the message data is placed in a buffer queue;

[0083] If not, the message data is sent to the service server.

[0084] In the embodiment of the present invention, when the actual message receiving rate is greater than the core message receiving rate threshold but less than or equal to the maximum message receiving rate threshold, the message data can be put into the buffer queue to wait for processing, which plays a buffering role, rather than the sudden increase in traffic to immediately reach the maximum message receiving rate threshold. Therefore, the embodiment of the present invention can effectively control the traffic and play a flow limiting role on the request.

[0085] Optionally, determining to return an exception, put the message data into a buffer queue, or send the message data to a service server based on a maximum message receiving rate threshold and a core message receiving rate threshold also includes: judging whether the current actual message receiving rate is greater than the core message receiving rate threshold at every preset time interval; if not, taking out the message data from the head of the buffer queue and sending the message data to the service server; if so, continuing to wait. The reverse proxy server can judge whether the current actual message receiving rate is greater than the core message receiving rate threshold at every preset time interval. If so, the message data in the buffer queue continues to wait; if not, taking out the message data from the head of the buffer queue and sending the message data to the service server, so that the service server processes the message data in the buffer queue.

[0086] Step 102: Obtain the response time, response result or resource usage rate of the service server, and dynamically adjust the core message receiving rate threshold according to the response time, response result or resource usage rate of the service server.

[0087] The reverse proxy server obtains the response time, response result or resource utilization rate of the business server, and then dynamically adjusts the core message receiving rate threshold according to the response time, response result or resource utilization rate of the business server, thereby quickly adjusting the core message receiving rate threshold to ensure system availability.

[0088] Optionally, the core message receiving rate threshold is dynamically adjusted according to the response time, response result or resource utilization rate of the business server, including: if the response time of the business server is greater than the standard response time for more than a first number threshold within a preset time period, the core message receiving rate threshold is lowered; if the response result of the business server is an abnormal status result, the core message receiving rate threshold is lowered; if the resource utilization rate of the business server is greater than the first resource threshold, the core message receiving rate threshold is lowered.

[0089] The reverse proxy server can collect monitoring indicators of the business server and analyze whether it is necessary to adjust the core message receiving rate threshold based on the collected data. The monitoring indicators collected by the reverse proxy server mainly include:

[0090] 1) Service response time

[0091] You can use the built-in parameter $request_time of the reverse proxy server (such as Nginx) to obtain the response time of the business server. If it exceeds the normal access time, for example, the response time of the business server exceeds the standard response time for more than the first number threshold within the preset time period, it means that the performance of the business server interface is not good. If the interface is called at a high frequency for a long time, it will cause the service to hang up or even cause the machine to crash. Therefore, the reverse proxy server automatically lowers the core message receiving rate threshold.

[0092] For example, if the standard response time is set to 200ms, if the response time of at least 10 requests exceeds 200ms within 5 seconds, the core message receiving rate threshold needs to be lowered by 10% or 20%.

[0093] 2) Service abnormality monitoring

[0094] If the business server suddenly returns abnormal status codes such as 502 (interface timeout) or 504 (service down), it means that the core message receiving rate threshold needs to be lowered, otherwise it is easy to cause machine downtime. The reverse proxy server can dynamically adjust the core message receiving rate threshold according to the status code returned by the business server, such as lowering the core message receiving rate threshold by 80% or 90%.

[0095] 3) Service resource utilization

[0096] The reverse proxy server can count the resource usage of the business server every minute, including CPU usage, memory usage, number of request connections, etc. For example, if the CPU usage exceeds 90%, the core message receiving rate threshold is immediately lowered; if the memory usage exceeds 80%, the core message receiving rate threshold is immediately lowered to prevent service unavailability.

[0097] Optionally, the core message receiving rate threshold is dynamically adjusted according to the response time, response result or resource utilization rate of the business server, and also includes: if the response time of the business server is less than or equal to the preset response time for more than a second number threshold within a preset time period, the core message receiving rate threshold is increased; if the response result of the business server is that the service is available, the core message receiving rate threshold is increased; if the resource utilization rate of the business server is less than or equal to the second resource threshold, the core message receiving rate threshold is increased, so that service resources and network resources can be fully utilized.

[0098] You can set a preset response time (less than the standard response time), such as 100ms or 150ms. If the response time of at least 20 requests within 5 seconds is less than or equal to 150ms, you need to increase the core message receiving rate threshold.

[0099] If the service is available, the business server will return a status code of 200, indicating that the service has returned to normal, and the reverse proxy server will automatically increase the core message receiving rate threshold.

[0100] If the CPU usage is less than or equal to 30%, the core message receiving rate threshold is increased; if the memory usage is less than or equal to 20%, the core message receiving rate threshold is increased.

[0101] According to the various embodiments described above, it can be seen that the embodiments of the present invention solve the technical problems in the prior art that the current limiting control is single or cannot be dynamically adjusted according to different environments by determining to return an exception to the terminal, put the message data into a buffer queue, or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, and dynamically adjusting the core message receiving rate threshold according to the response time, response result, or resource utilization rate of the service server. The embodiments of the present invention determine to return an exception to the terminal, put the message data into a buffer queue, or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, and limit the flow of requests to ensure service availability; dynamically adjust the core message receiving rate threshold according to the response time, response result, or resource utilization rate of the service server, and can dynamically adjust the core message receiving rate threshold according to different environments, which can not only effectively reduce bandwidth, but also make full use of service resources and network resources.

[0102] Figure 2 FIG. 1 is a schematic diagram of the main process of a method for dynamically adjusting a message receiving rate according to a reference embodiment of the present invention. As another embodiment of the present invention, Figure 2 As shown, the method for dynamically adjusting the message receiving rate may include:

[0103] Step 201: receiving message data sent by a terminal.

[0104] Step 202, determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold; if so, execute step 203; if not, execute step 204.

[0105] Step 203: Return an exception to the terminal.

[0106] Step 204, determining whether the actual message receiving rate is greater than the core message receiving rate threshold; if so, executing step 205; if not, executing step 206.

[0107] Step 205: put the message data into a buffer queue to wait for processing.

[0108] Step 206: Send the message data to the service server.

[0109] It should be pointed out that in an embodiment of the present invention, the reverse proxy server can determine whether the current actual message receiving rate is greater than the core message receiving rate threshold at every preset time interval. If so, the message data in the buffer queue continues to wait; if not, the message data is taken out from the head of the buffer queue and sent to the business server so that the business server processes the message data in the buffer queue.

[0110] In addition, the specific implementation content of the method for dynamically adjusting the message receiving rate in a reference embodiment of the present invention has been described in detail in the method for dynamically adjusting the message receiving rate described above, so the repeated content will not be described here.

[0111] Figure 3 FIG. 1 is a schematic diagram of the main process of a method for dynamically adjusting a message receiving rate according to another reference embodiment of the present invention. As another embodiment of the present invention, Figure 3 As shown, the method for dynamically adjusting the message receiving rate may include:

[0112] The maximum message receiving rate threshold and the core message receiving rate threshold can be configured in the traffic counter. When the reverse proxy server receives the message data sent by the terminal, it reads the maximum message receiving rate threshold and the core message receiving rate threshold from the traffic counter to determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold.

[0113] If so, returning an exception to the terminal;

[0114] If not, determining whether the actual message receiving rate is greater than the core message receiving rate threshold;

[0115] If yes, the message data is placed in a buffer queue;

[0116] If not, the message data is sent to the service server.

[0117] It should be noted that after the reverse proxy server receives the message data sent by the terminal, it also needs to update the actual message receiving rate so that it can determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold and the core message receiving rate threshold after receiving the message data next time.

[0118] If the business server suddenly returns abnormal status codes such as 502 (interface timeout) or 504 (service down) to the reverse proxy server, it means that the core message receiving rate threshold needs to be lowered, otherwise it is easy to cause machine downtime. The reverse proxy server can dynamically adjust the core message receiving rate threshold based on the status code returned by the business server.

[0119] The reverse proxy server also monitors the service response time. You can use the reverse proxy server's built-in parameter $request_time to obtain the response time of the business server. If it exceeds the normal access time, for example, the response time of the business server exceeds the standard response time for more than the first number threshold within the preset time period, it means that the business server interface performance is not good. If the interface is called at a high frequency for a long time, it will cause the service to hang up, or even cause the machine to crash. Therefore, the reverse proxy server automatically lowers the core message receiving rate threshold.

[0120] The reverse proxy server can count the resource usage of the business server every minute, including CPU usage, memory usage, number of request connections, etc. For example, if the CPU usage exceeds the preset CPU usage threshold, the core message receiving rate threshold is immediately lowered; if the memory usage exceeds the preset memory usage threshold, the core message receiving rate threshold is immediately lowered to prevent service unavailability.

[0121] If the response time of the business server is less than or equal to the preset response time for more than a second number threshold within the preset time period, the core message receiving rate threshold will be increased; if the response result of the business server is that the service is available, the core message receiving rate threshold will be increased; if the resource utilization rate of the business server is less than or equal to the second resource threshold, the core message receiving rate threshold will be increased, so that service resources and network resources can be fully utilized.

[0122] In addition, the specific implementation content of the method for dynamically adjusting the message receiving rate in another reference embodiment of the present invention has been described in detail in the method for dynamically adjusting the message receiving rate described above, so the repeated content will not be described here.

[0123] Figure 4 is a schematic diagram of main modules of a device for dynamically adjusting a message receiving rate according to an embodiment of the present invention, such as Figure 4 As shown, the device 400 for dynamically adjusting the message receiving rate includes a message processing module 401 and a rate adjustment module 402; wherein, the message processing module 401 is used to receive message data sent by the terminal, and determine whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a business server according to a maximum message receiving rate threshold and a core message receiving rate threshold; the rate adjustment module 402 is used to obtain the response time, response result or resource utilization rate of the business server, and dynamically adjust the core message receiving rate threshold according to the response time, response result or resource utilization rate of the business server.

[0124] Optionally, the message processing module 401 is further used to:

[0125] Determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold;

[0126] If so, returning an exception to the terminal;

[0127] If not, determining whether the actual message receiving rate is greater than the core message receiving rate threshold;

[0128] If yes, the message data is placed in a buffer queue;

[0129] If not, the message data is sent to the service server.

[0130] Optionally, the message processing module 401 is further used to:

[0131] At every preset time interval, determining whether the current actual message receiving rate is greater than the core message receiving rate threshold;

[0132] If not, taking out the message data from the head of the buffer queue and sending the message data to the service server;

[0133] If so, continue waiting.

[0134] Optionally, the rate adjustment module 402 is further configured to:

[0135] If the response time of the service server is greater than the standard response time for a number of times exceeding the first number threshold within the preset time period, the core message receiving rate threshold is lowered;

[0136] If the response result of the service server is an abnormal state result, lowering the core message receiving rate threshold;

[0137] If the resource usage of the service server is greater than the first resource threshold, the core message receiving rate threshold is lowered.

[0138] Optionally, the rate adjustment module 402 is further configured to:

[0139] If the response time of the service server is less than or equal to the preset response time for more than a second number threshold within the preset time period, the core message receiving rate threshold is increased;

[0140] If the response result of the business server is that the service is available, the core message receiving rate threshold is increased;

[0141] If the resource usage rate of the service server is less than or equal to the second resource threshold, the core message receiving rate threshold is increased.

[0142] Optionally, the resource usage rate includes at least one of the following: CPU usage rate, memory usage rate, and number of requested connections;

[0143] The abnormal status results include interface timeout or service failure.

[0144] Optionally, the method is applied to a reverse proxy server.

[0145] According to the various embodiments described above, it can be seen that the embodiments of the present invention solve the technical problems in the prior art that the current limiting control is single or cannot be dynamically adjusted according to different environments by determining to return an exception to the terminal, put the message data into a buffer queue, or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, and dynamically adjusting the core message receiving rate threshold according to the response time, response result, or resource utilization rate of the service server. The embodiments of the present invention determine to return an exception to the terminal, put the message data into a buffer queue, or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, and limit the flow of requests to ensure service availability; dynamically adjust the core message receiving rate threshold according to the response time, response result, or resource utilization rate of the service server, and can dynamically adjust the core message receiving rate threshold according to different environments, which can not only effectively reduce bandwidth, but also make full use of service resources and network resources.

[0146] It should be noted that the specific implementation content of the device for dynamically adjusting the message receiving rate of the present invention has been described in detail in the method for dynamically adjusting the message receiving rate described above, so the repeated content will not be described here.

[0147] Figure 5 An exemplary system architecture 500 is shown to which the method for dynamically adjusting the message receiving rate or the apparatus for dynamically adjusting the message receiving rate according to the embodiments of the present invention can be applied.

[0148] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0149] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on 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).

[0150] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0151] Server 505 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using terminal devices 501, 502, and 503. The backend management server may analyze and process the received data such as item information query requests, and feed back the processing results to the terminal device.

[0152] It should be noted that the method for dynamically adjusting the message receiving rate provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the device for dynamically adjusting the message receiving rate is generally arranged in the server 505 .

[0153] 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.

[0154] 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.

[0155] 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.

[0156] 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.

[0157] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0158] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with 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, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may 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 may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0159] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0160] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a message processing module and a rate adjustment module, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.

[0161] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: receiving message data sent by a terminal, and determining whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server according to a maximum message receiving rate threshold and a core message receiving rate threshold; obtaining the response time, response result, or resource utilization rate of the service server, and dynamically adjusting the core message receiving rate threshold according to the response time, response result, or resource utilization rate of the service server.

[0162] According to the technical solution of the embodiment of the present invention, because it adopts the technical means of determining whether to return an exception to the terminal, put the message data into a buffer queue or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, and dynamically adjusting the core message receiving rate threshold according to the response time, response result or resource utilization rate of the service server, it overcomes the technical problems in the prior art that the flow limiting control is single or cannot be dynamically adjusted according to different environments. The embodiment of the present invention determines whether to return an exception to the terminal, put the message data into a buffer queue or send the message data to the service server according to the maximum message receiving rate threshold and the core message receiving rate threshold, limits the flow of requests, and ensures that the service is available; dynamically adjusts the core message receiving rate threshold according to the response time, response result or resource utilization rate of the service server, and can dynamically adjust the core message receiving rate threshold according to different environments, which can not only effectively reduce the bandwidth, but also make full use of service resources and network resources.

[0163] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for dynamically adjusting a message receiving rate, characterized in that: include: Receive message data sent by a terminal, and determine, according to a maximum message receiving rate threshold and a core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server; Obtaining the response time, response result or resource utilization rate of the business server, and dynamically adjusting the core message receiving rate threshold according to the response time, response result or resource utilization rate of the business server; Determining, according to the maximum message receiving rate threshold and the core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server includes: Determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold; If so, returning an exception to the terminal; If not, determining whether the actual message receiving rate is greater than the core message receiving rate threshold; If yes, the message data is placed in a buffer queue; If not, the message data is sent to the service server.

2. The method according to claim 1, characterized in that Determining a return exception according to a maximum message receiving rate threshold and a core message receiving rate threshold, placing the message data into a buffer queue, or sending the message data to a service server, further comprising: At every preset time interval, determining whether the current actual message receiving rate is greater than the core message receiving rate threshold; If not, taking out the message data from the head of the buffer queue and sending the message data to the service server; If so, continue waiting.

3. The method according to claim 1, characterized in that Dynamically adjusting the core message receiving rate threshold according to the response time, response result or resource utilization rate of the service server includes: If the response time of the service server is greater than the standard response time for a number of times exceeding the first number threshold within the preset time period, the core message receiving rate threshold is lowered; If the response result of the service server is an abnormal state result, lowering the core message receiving rate threshold; If the resource usage of the service server is greater than the first resource threshold, the core message receiving rate threshold is lowered.

4. The method according to claim 3, characterized in that Dynamically adjusting the core message receiving rate threshold according to the response time, response result or resource utilization rate of the service server, further comprising: If the response time of the service server is less than or equal to the preset response time for more than a second number threshold within the preset time period, the core message receiving rate threshold is increased; If the response result of the business server is that the service is available, the core message receiving rate threshold is increased; If the resource usage rate of the service server is less than or equal to the second resource threshold, the core message receiving rate threshold is increased.

5. The method according to claim 3, characterized in that: The resource utilization rate includes at least one of the following: CPU utilization rate, memory utilization rate, and number of requested connections; The abnormal status results include interface timeout or service failure.

6. The method according to claim 1, characterized in that The method is applied to a reverse proxy server.

7. A device for dynamically adjusting a message receiving rate, characterized in that: include: A message processing module, used for receiving message data sent by a terminal, and determining, according to a maximum message receiving rate threshold and a core message receiving rate threshold, whether to return an exception to the terminal, put the message data into a buffer queue, or send the message data to a service server; A rate adjustment module, used to obtain the response time, response result or resource utilization rate of the business server, and dynamically adjust the core message receiving rate threshold according to the response time, response result or resource utilization rate of the business server; The message processing module is also used for: Determine whether the actual message receiving rate is greater than the maximum message receiving rate threshold; If so, returning an exception to the terminal; If not, determining whether the actual message receiving rate is greater than the core message receiving rate threshold; If yes, the message data is placed in a buffer queue; If not, the message data is sent to the service server.

8. An electronic device, characterized in that: include: 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 any one of claims 1 to 6.

9. 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 any one of claims 1 to 6 is implemented.