CN109547282B - Overload protection method and device, computer readable storage medium and server - Google Patents

Overload protection method and device, computer readable storage medium and server Download PDF

Info

Publication number
CN109547282B
CN109547282B CN201811231449.3A CN201811231449A CN109547282B CN 109547282 B CN109547282 B CN 109547282B CN 201811231449 A CN201811231449 A CN 201811231449A CN 109547282 B CN109547282 B CN 109547282B
Authority
CN
China
Prior art keywords
data request
unit period
data
request response
requester
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811231449.3A
Other languages
Chinese (zh)
Other versions
CN109547282A (en
Inventor
傅俊泽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN201811231449.3A priority Critical patent/CN109547282B/en
Publication of CN109547282A publication Critical patent/CN109547282A/en
Application granted granted Critical
Publication of CN109547282B publication Critical patent/CN109547282B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Abstract

The invention relates to the field of Internet, in particular to an overload protection method, an overload protection device, a computer readable storage medium and a server, wherein the method comprises the following steps: counting the number of the abnormal data request response state codes received in the first unit period; judging whether the number of the abnormal data request response state codes in a first unit period is greater than an overload threshold value; if yes, feeding back a preset processing message to the data request party when the data request of the data request party is received again in a first unit period; in a second unit period, counting the number of the abnormal data request response state codes of the second unit period; and judging whether the number of the abnormal data request response state codes in the second unit period is greater than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data request party is received again in the second unit period. The invention flexibly implements overload protection on the server.

Description

Overload protection method and device, computer readable storage medium and server
Technical Field
The invention relates to the field of internet, in particular to an overload protection method, an overload protection device, a computer readable storage medium and a server.
Background
With the development of internet technology, a large number of platforms promote various activities attracting users to improve user activity and viscosity, and during a certain period of time when an activity is carried out, a large number of users access the activity in a short time and send requests to a platform server, and an excessive access concurrency greatly exceeds the bearing capacity of the platform server, so that the requests cannot be processed in a short time, and the platform server may be overloaded and down, and subsequent business processing cannot be completed.
Disclosure of Invention
In order to overcome the above technical problems, especially the problem that the overload protection mechanism of the server cannot be configured flexibly and efficiently in the prior art, the following technical solutions are proposed:
in a first aspect, the present invention provides an overload protection method, including:
counting the number of the abnormal data request response state codes received in the first unit period;
judging whether the number of the abnormal data request response state codes in a first unit period is greater than an overload threshold value;
if the number of the abnormal data request response status codes in the first unit period is larger than the overload threshold, in the first unit period, when a data request of a data requester is received again, feeding back a preset processing message to the data requester;
in a second unit period, counting the number of the abnormal data request response state codes of the second unit period; and judging whether the number of the abnormal data request response state codes in the second unit period is greater than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data request party is received again in the second unit period.
Further, the counting the number of the abnormal data request response status codes in the second unit period includes:
and obtaining the attenuation quantity according to the quantity of the abnormal data request response state codes in the first unit period, wherein the attenuation quantity is added with the quantity of the abnormal data request response state codes received in the second unit period and is used as the quantity of the abnormal data request response state codes in the second unit period.
Further, the method further comprises:
and counting the frequency of the data requests sent by the same data requester in unit time, and if the frequency of the data requests sent by the data requester in unit time is greater than the limit frequency, feeding back a preset processing message to the data requester.
Further, in the first unit period, after feeding back a preset processing message to the data requester when the data request from the data requester is received again, the method further includes:
and adding the data requests which are not responded in the first unit period into the asynchronous processing queue, and processing the data requests in the asynchronous processing queue in the second unit period.
Further, the adding the unresponsive data request of the first unit cycle into the asynchronous processing queue includes:
and acquiring multiple data requests of the same data requester in a first unit period, and adding one data request into the asynchronous processing queue.
Further, when the data request of the data requester is received again, feeding back a preset processing message to the data requester includes:
when the data request of the data requester is received again, selecting the data request with the first preset proportion, and feeding back a preset processing message to the data requester with the first preset proportion; and selecting data requests with a second preset proportion, feeding back preset processing information to the data requesters with the second preset proportion, and adding the data requests with the second preset proportion into the asynchronous processing queue.
In a second aspect, the present invention provides an overload protection apparatus, comprising:
a statistic module: the number of the abnormal data request response state codes received in the first unit period is counted;
a judging module: the system is used for judging whether the number of the abnormal data request response status codes in a first unit period is larger than an overload threshold value or not;
a first processing module: the data processing method comprises the steps of feeding back a preset processing message to a data requester when the data request of the data requester is received again in a first unit period if the number of the abnormal data request response status codes in the first unit period is larger than an overload threshold;
a second processing module: the number of the abnormal data request response state codes in the second unit period is counted; and judging whether the number of the abnormal data request response state codes in the second unit period is greater than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data request party is received again in the second unit period.
Further, the apparatus further comprises:
a frequency limiting module: the method is used for counting the frequency of data requests sent by the same data requester in unit time, and feeding back a preset processing message to the data requester if the frequency of the data requests sent by the data requester in unit time is greater than a limit frequency.
In a third aspect, the present invention further provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the overload protection method described above.
In a fourth aspect, the present invention also provides a server comprising one or more processors, memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the overload protection method described above.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides an overload protection method for a background server, which comprises the steps of counting the number of abnormal data request response state codes received in a first unit period, judging whether the number of the abnormal data request response state codes in the first unit period is larger than an overload threshold value, if so, implementing overload protection on the server in the first unit period, feeding back a preset processing message to a data requester when the data request of the data requester is received again in the first unit period, not performing specific service processing on subsequent data requests in the first unit period, then continuing counting whether the number of the abnormal data request response state codes is larger than the overload threshold value in the second unit period, if not, performing specific service response on the received data requests in the second unit period, and enabling the data requests to obtain normal responses, the method has the advantages that corresponding services are completed, normal operation of the server is recovered, the overload protection mechanism of the server is flexibly configured and takes effect in real time, and normal operation of the server can be timely recovered while overload protection is implemented on the server, so that normal service processing is completed.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
FIG. 1 is a flow chart illustrating an overload protection method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating an overload protection method according to another embodiment of the present invention;
fig. 3 is a schematic view of an overload protection apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative only and should not be construed as limiting the invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, or operations, but do not preclude the presence or addition of one or more other features, integers, steps, operations, or groups thereof.
It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
It will be appreciated by those skilled in the art that the terms "application," "computer program" and similar terms used herein refer to the same concepts known to those skilled in the art that refer to computer software electronically-adapted to be organized into a series of computer instructions and associated data sources. Unless otherwise specified, such nomenclature is not itself limited by the programming language class, level, or operating system or platform upon which it depends. Of course, such concepts are not limited to any type of terminal.
An embodiment of the present invention provides an overload protection method, as shown in fig. 1, the method includes the following steps:
s10: and counting the number of the abnormal data request response status codes received in the first unit period.
The platform holds an activity, a user can participate in the activity through a client, when the activity starts, a phenomenon that a client data request is highly concurrent often occurs at a certain stage of the activity, the highly concurrent client data request generates great pressure on a load of a background server, and the background server cannot effectively process the data request of the client, so that a large amount of data requests are queued for processing or abnormal, an abnormal http response status code is generated at the moment, and the http response status code is defined as an abnormal data request response status code in the embodiment; the abnormal data request response status code comprises 499 which indicates that the client is actively disconnected, and the occurrence of 499 status code mainly causes that the client is actively disconnected because the request queue of the background server is too large and the client cannot respond in time; the exception data request response status code includes 408, indicating a client request timeout. In this embodiment, when the backend server receives the abnormal data request response status code, the number of the abnormal data request response status codes received in a unit period is counted, for example, the activity start time is 10:00 to 11:30, when the backend server receives the abnormal data request response status code, the nginx layer of the backend server starts to register and count, and the number of the abnormal data request response status codes received in a first unit period (10:00 to 10:01) is counted in a unit period, for example, 1 minute.
S20: and judging whether the number of the abnormal data request response state codes in the first unit period is greater than an overload threshold value.
It can be known that statistics of the abnormal data request response status codes is continuously performed in a unit period, and overload protection needs to be performed on the background server because the abnormal data request response status codes are mainly due to overload of the background server.
S30: and if the number of the abnormal data request response status codes in the first unit period is larger than the overload threshold, feeding back a preset processing message to the data requester when the data request of the data requester is received again in the first unit period.
If the number of the abnormal data request response status codes in the first unit period is greater than the overload threshold, which indicates that the background server cannot process the data request of the client in time in the first unit period, if a new data request of a data requester (i.e., the client) is received again, feeding back a preset processing message to the data requester, specifically, in this embodiment, feeding back the preset processing message to the data requester directly from the nginx layer of the background server, and the data request does not reach the application server layer, where the application server layer is used for specifically responding to the data request of the client, thereby implementing overload protection on the background server, reducing the server load in the unit period, preventing the server from being down due to an excessive load, and ensuring the normal operation of the background server.
S40: in a second unit period, counting the number of the abnormal data request response state codes of the second unit period; and judging whether the number of the abnormal data request response state codes in the second unit period is greater than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data request party is received again in the second unit period.
After implementing overload protection in the first unit cycle, the background server still continues to count whether the number of the abnormal data request response status codes is greater than the overload threshold in the next unit cycle (the second unit cycle), because the number of the abnormal data request response status codes in the first unit cycle is already greater than the overload threshold, the number of the initial abnormal data request response status codes in the second unit cycle needs to be reconfigured, the number of the abnormal data request response status codes in the first unit cycle cannot be used, and the number of the new abnormal data request response status codes in the second unit cycle cannot be counted again, in this embodiment, before the number of the abnormal data request response status codes in the second unit cycle is not greater than the overload threshold, if a data request of a data requester is received, the data request is responded according to a preset service flow, the normal processing of the service is completed, the data request can be normally responded, the corresponding service is completed, the normal operation of the server is recovered, and the overload protection mechanism of the server is flexibly configured and takes effect in real time. If the number of the abnormal data request response status codes in the second unit period is larger than the overload threshold, when the data request of the data requester is received again, similarly, feeding back a preset processing message to the data requester.
The embodiment provides an overload protection method for a background server, which includes counting the number of abnormal data request response status codes received in a first unit period, then judging whether the number of the abnormal data request response status codes in the first unit period is greater than an overload threshold, if so, implementing overload protection on the server in the first unit period, when a data request of a data requester is received again, feeding back a preset processing message to the data requester, not performing specific service processing on subsequent data requests in the first unit period, then in a second unit period, continuing counting whether the number of the abnormal data request response status codes is greater than the overload threshold, if not, performing specific service response on the received data requests in the second unit period, and enabling the data requests to obtain normal responses, the method has the advantages that corresponding services are completed, normal operation of the server is recovered, the overload protection mechanism of the server is flexibly configured and takes effect in real time, and normal operation of the server can be timely recovered while overload protection is implemented on the server, so that normal service processing is completed.
In an embodiment of the present invention, the counting the number of the abnormal data request response status codes in the second unit period includes:
and obtaining the attenuation quantity according to the quantity of the abnormal data request response state codes in the first unit period, wherein the attenuation quantity is added with the quantity of the abnormal data request response state codes received in the second unit period and is used as the quantity of the abnormal data request response state codes in the second unit period.
In this embodiment, in the process of counting the number of the abnormal data request response status codes in the second unit cycle, the number of the initial abnormal data request response status codes in the second unit cycle is preset to be the attenuation number of the abnormal data request response status codes in the first unit cycle, for example, the number of the initial abnormal data request response status codes in the second unit cycle is N2, the number of the abnormal data request response status codes in the first unit cycle is N1, and the initial value N2 is 1/2 · N1, then on the basis of the number of the initial abnormal data request response status codes, the number of the abnormal data request response status codes newly received in the second unit cycle is counted as the number of the abnormal data request response status codes in the second unit cycle, when the number of the abnormal data request response status codes in the first unit cycle is too large, the initial value of the number of the abnormal data request response state codes in the second unit period is higher, the number of the data requests which can be processed in the second unit period is less, and the overload protection of the second unit period can be configured in advance according to the number of the abnormal data request response state codes received in the first unit period, so that the normal operation of the background server is ensured.
Optionally, the calculation method for obtaining the attenuation number according to the number of the abnormal data request response status codes in the first unit cycle is as follows:
acquiring a preset attenuation proportion; acquiring the number of abnormal data request response state codes of a first unit period; judging whether the number is larger than a maximum preset value or not; if so, multiplying the maximum preset value by the attenuation proportion to obtain the attenuation quantity; if not, multiplying the number by the attenuation proportion to obtain the attenuation number. The method avoids the situation that the number of the abnormal data request response state codes in the first unit period is very large, and after attenuation, the number of the abnormal data request response state codes in the second unit period is still larger than an overload threshold value, so that the maximum preset value is limited.
In an embodiment of the invention, the method further comprises:
in a third unit period, counting the number of abnormal data request response state codes in the third unit period; the number of the abnormal data request response state codes in the third unit period is the attenuation number obtained according to the number of the abnormal data request response state codes in the first unit period and the second unit period, and the number of the abnormal data request response state codes received in the third unit period;
the attenuation number obtained according to the number of the abnormal data request response status codes of the first unit period and the second unit period is calculated by the following method:
acquiring a preset attenuation proportion;
acquiring the number of the abnormal data request response state codes of the first unit period and the second unit period;
if the number of the abnormal data request response state codes in the first unit period and the second unit period is larger than the maximum preset value, multiplying the number of the maximum preset value by the attenuation proportion to obtain the number obtained after attenuation;
if the number of the abnormal data request response state codes of the first unit period and the second unit period is not larger than the maximum preset value, multiplying the number of the abnormal data request response state codes of the first unit period by one third of the attenuation proportion to obtain a first value, multiplying the number of the abnormal data request response state codes of the second unit period by two thirds of the attenuation proportion to obtain a second value, and adding the first value and the second value to obtain the number obtained after attenuation;
if the number of the abnormal data request response state codes in the first unit period is greater than a maximum preset value and the number of the abnormal data request response state codes in the second unit period is not greater than the maximum preset value, multiplying the maximum preset value by one third of the attenuation proportion to obtain a first value, multiplying the number of the abnormal data request response state codes in the second unit period by two thirds of the attenuation proportion to obtain a second value, and adding the first value and the second value to obtain the number obtained after attenuation;
if the number of the abnormal data request response state codes in the first unit period is not larger than the maximum preset value and the number of the abnormal data request response state codes in the second unit period is larger than the maximum preset value, multiplying the number of the abnormal data request response state codes in the first unit period by one third of the attenuation ratio to obtain a first value, multiplying the maximum preset value by two thirds of the attenuation ratio to obtain a second value, and adding the first value and the second value to obtain the number obtained after attenuation.
In an embodiment of the invention, the method further comprises: counting the frequency of sending data requests by the same data request party in unit time, and feeding back a preset processing message to the data request party if the frequency of sending data requests by the data request party in unit time is greater than the limit frequency.
In the implementation of overload protection on the background server, the embodiment also implements overload protection on the background server by using a frequency limiting measure, in the embodiment, multiple requests of the same data requester in a short time are distributed to the same nginx server in the background server, the nginx server dynamically configures the instantaneous maximum connection number and the maximum request number in a unit time by using a lua-reserve-limit-traffic module, for example, the maximum connection number of a single IP is limited to be 3, and the devices connected with the same IP can only have 3 data requests valid; the maximum number of requests, for example, the maximum number of requests for a single IP within 1 minute is limited to 10, and more than 10 requests are invalid; based on this, when a data request party sends a data request, the frequency of sending the data request by the same data request party in unit time is counted, specifically, multiple devices connected by the same IP can be counted, then all the request numbers of the devices are counted, the frequency of sending the data request can be counted, if the frequency of the data request party in unit time is greater than the limiting frequency, a preset processing message is directly fed back to the data request party from the nginx layer of the background server, the data request does not reach the application server layer any more, and part of the data request is directly intercepted and interrupted from the nginx server layer in the background server, so that the purpose of limiting the frequency of the data request is achieved.
As shown in fig. 2, in the first unit period, after feeding back a preset processing message to the data requester when the data requester receives a data request again, the method further includes:
s31: and adding the data requests which are not responded in the first unit period into the asynchronous processing queue, and processing the data requests in the asynchronous processing queue in the second unit period.
In this embodiment, if overload protection has been started for the server in the first unit cycle, if a data request of the data requester is received again in the first unit cycle, on one hand, a preset processing message is directly fed back to the data requester, and the data request cannot obtain a response of the application server, and on the other hand, an unresponsive data request is added to the asynchronous processing queue, and then the data request in the asynchronous processing queue is preferentially processed in the second unit cycle. For example, a data request which fails to respond in the first unit cycle 10:00-10:01 is stored in an asynchronous processing queue, and then a preset processing message such as "request waiting" is returned to a data requester, and when the second unit cycle 10:01-10:02 is reached, the data request in the asynchronous processing queue is configured to be processed preferentially, so that the background server is protected from overload on one hand, and the effective processing of the data request can be ensured on the other hand.
In an embodiment of the present invention, the adding the unresponsive data request of the first unit cycle to the asynchronous processing queue includes:
and acquiring multiple data requests of the same data requester in a first unit period, and adding one data request into the asynchronous processing queue.
On the basis of the above embodiment, in this embodiment, when a data request that is not responded in a first unit cycle is added to an asynchronous processing queue, multiple data requests of the same data requester in a current cycle are obtained, and then one of the data requests is added to the asynchronous processing queue.
In an embodiment of the present invention, when receiving a data request from a data requester again, feeding back a preset processing message to the data requester includes:
when the data request of the data requester is received again, selecting the data request with the first preset proportion, and feeding back a preset processing message to the data requester with the first preset proportion; and selecting data requests with a second preset proportion, feeding back preset processing information to the data requesters with the second preset proportion, and adding the data requests with the second preset proportion into the asynchronous processing queue.
On the basis of the above embodiment, in this embodiment, after the overload protection is started in the first unit cycle, if the data request of the data requester is received again, the background server selects the data request in the first preset proportion, and feeds back the preset processing message to the data requester in the first preset proportion, and in this embodiment, a certain amount of data requests are randomly selected, and then the preset processing message is directly fed back to the data requester at the nginx server layer; in addition, the data requests with the second preset proportion are selected, preset processing information is fed back to the data requesters with the second preset proportion, meanwhile, the data requests with the second preset proportion are added into the asynchronous processing queue, so that the data requests in the asynchronous processing queue can be processed subsequently, the pressure of the background server is effectively reduced in the first unit period, and the normal operation of the background server is guaranteed.
In another embodiment, as shown in fig. 3, the present invention provides an overload protection apparatus, including:
the statistic module 10: the number of the abnormal data request response state codes received in the first unit period is counted;
the judging module 20: the system is used for judging whether the number of the abnormal data request response status codes in a first unit period is larger than an overload threshold value or not;
the first processing module 30: the data processing method comprises the steps of feeding back a preset processing message to a data requester when the data request of the data requester is received again in a first unit period if the number of the abnormal data request response status codes in the first unit period is larger than an overload threshold;
the second processing module 40: the number of the abnormal data request response state codes in the second unit period is counted; and judging whether the number of the abnormal data request response state codes in the second unit period is greater than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data request party is received again in the second unit period.
In an embodiment of the present invention, the second processing module 40 performs counting of the number of the abnormal data request response status codes in the second unit period, including:
and obtaining the attenuation quantity according to the quantity of the abnormal data request response state codes in the first unit period, wherein the attenuation quantity is added with the quantity of the abnormal data request response state codes received in the second unit period and is used as the quantity of the abnormal data request response state codes in the second unit period.
In an embodiment of the invention, the apparatus further comprises:
a frequency limiting module: the method is used for counting the frequency of data requests sent by the same data requester in unit time, and feeding back a preset processing message to the data requester if the frequency of the data requests sent by the data requester in unit time is greater than a limit frequency.
In an embodiment of the present invention, the first processing module 30 further performs:
and adding the data requests which are not responded in the first unit period into the asynchronous processing queue, and processing the data requests in the asynchronous processing queue in the second unit period.
In an embodiment of the present invention, the first processing module 30 performs adding the unresponsive data request of the first unit cycle to the asynchronous processing queue, including:
and acquiring multiple data requests of the same data requester in a first unit period, and adding one data request into the asynchronous processing queue.
In an embodiment of the present invention, the first processing module 30 performs, when the data request of the data requester is received again, feeding back a preset processing message to the data requester, where the method includes:
when the data request of the data requester is received again, selecting the data request with the first preset proportion, and feeding back a preset processing message to the data requester with the first preset proportion; and selecting data requests with a second preset proportion, feeding back preset processing information to the data requesters with the second preset proportion, and adding the data requests with the second preset proportion into the asynchronous processing queue.
In another embodiment, the present invention provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the overload protection method described in the above embodiments. The computer-readable storage medium includes, but is not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks, ROMs (Read-Only memories), RAMs (Random AcceSS memories), EPROMs (EraSable Programmable Read-Only memories), EEPROMs (Electrically EraSable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a storage device includes any medium that stores or transmits information in a form readable by a device (e.g., a computer, a cellular phone), and may be a read-only memory, a magnetic or optical disk, or the like.
The computer-readable storage medium provided by the embodiment of the invention can realize the statistics of the number of the abnormal data request response status codes received in the first unit period; judging whether the number of the abnormal data request response state codes in a first unit period is greater than an overload threshold value; if the number of the abnormal data request response status codes in the first unit period is larger than the overload threshold, in the first unit period, when a data request of a data requester is received again, feeding back a preset processing message to the data requester; in a second unit period, counting the number of the abnormal data request response state codes of the second unit period; and judging whether the number of the abnormal data request response state codes in the second unit period is greater than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data request party is received again in the second unit period. By providing an overload protection method for a background server, counting the number of abnormal data request response state codes received in a first unit period, then judging whether the number of the abnormal data request response state codes in the first unit period is greater than an overload threshold value, if so, implementing overload protection on the server in the first unit period, when a data request of a data requester is received again, feeding back a preset processing message to the data requester, not performing specific service processing on subsequent data requests in the first unit period, then in a second unit period, continuously counting whether the number of the abnormal data request response state codes is greater than the overload threshold value, if not, performing specific service response on the received data requests in the second unit period, and enabling the data requests to obtain normal responses, the method has the advantages that corresponding services are completed, normal operation of the server is recovered, the overload protection mechanism of the server is flexibly configured and takes effect in real time, and normal operation of the server can be timely recovered while overload protection is implemented on the server, so that normal service processing is completed.
The computer-readable storage medium provided in the embodiment of the present invention can implement the embodiment of the overload protection method, and for specific function implementation, reference is made to the description in the embodiment of the method, which is not described herein again.
In addition, in another embodiment, the present invention further provides a server, as shown in fig. 4, the server includes a processor 403, a memory 405, an input unit 407, a display unit 409, and the like. Those skilled in the art will appreciate that the structural elements shown in fig. 4 do not constitute a limitation of all servers and may include more or fewer components than those shown, or some combination of components. The memory 405 may be used to store the computer program 401 and the functional modules, and the processor 403 executes the computer program 401 stored in the memory 405, thereby executing various functional applications of the device and data processing. The memory 405 may be an internal memory or an external memory, or include both internal and external memories. The memory may comprise read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), flash memory, or random access memory. The external memory may include a hard disk, a floppy disk, a ZIP disk, a usb-disk, a magnetic tape, etc. The disclosed memory includes, but is not limited to, these types of memory. The memory 405 disclosed herein is provided by way of example only and not by way of limitation.
The input unit 407 is configured to receive signal input and user input, and the input unit 407 may include a touch panel and other input devices, where the touch panel may collect touch operations of a user on or near the touch panel (for example, operations of a user on or near the touch panel using any suitable object or accessory such as a finger, a stylus pen, etc.) and drive a corresponding connection device according to a preset program; other input devices may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., play control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like. The display unit 409 may be used to display information input by a user or information provided to a user and various menus of the computer device. The display unit 409 may take the form of a liquid crystal display, an organic light emitting diode, or the like. The processor 403 is a control center of the computer device, connects various parts of the entire computer using various interfaces and lines, and performs various functions and processes data by operating or executing software programs and/or modules stored in the memory 405 and calling data stored in the memory.
In one embodiment, the server includes one or more processors 403, and one or more memories 405, one or more computer programs 401, wherein the one or more computer programs 401 are stored in the memory 405 and configured to be executed by the one or more processors 403, and the one or more computer programs 401 are configured to perform the overload protection method described in the above embodiments. The one or more processors 403 shown in fig. 4 can execute and implement the functions of the statistics module 10, the determination module 20, the first processing module 30, and the second processing module 40 shown in fig. 3.
The server provided by the embodiment of the invention can realize the statistics of the number of the abnormal data request response state codes received in the first unit period; judging whether the number of the abnormal data request response state codes in a first unit period is greater than an overload threshold value; if the number of the abnormal data request response status codes in the first unit period is larger than the overload threshold, in the first unit period, when a data request of a data requester is received again, feeding back a preset processing message to the data requester; in a second unit period, counting the number of the abnormal data request response state codes of the second unit period; and judging whether the number of the abnormal data request response state codes in the second unit period is greater than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data request party is received again in the second unit period. By providing an overload protection method for a background server, counting the number of abnormal data request response state codes received in a first unit period, then judging whether the number of the abnormal data request response state codes in the first unit period is greater than an overload threshold value, if so, implementing overload protection on the server in the first unit period, when a data request of a data requester is received again, feeding back a preset processing message to the data requester, not performing specific service processing on subsequent data requests in the first unit period, then in a second unit period, continuously counting whether the number of the abnormal data request response state codes is greater than the overload threshold value, if not, performing specific service response on the received data requests in the second unit period, and enabling the data requests to obtain normal responses, the method has the advantages that corresponding services are completed, normal operation of the server is recovered, the overload protection mechanism of the server is flexibly configured and takes effect in real time, and normal operation of the server can be timely recovered while overload protection is implemented on the server, so that normal service processing is completed.
The server provided in the embodiment of the present invention can implement the embodiment of the overload protection method provided above, and for specific function implementation, reference is made to the description in the embodiment of the method, which is not described herein again.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (9)

1. An overload protection method, comprising:
counting the number of the abnormal data request response state codes received in the first unit period;
judging whether the number of the abnormal data request response state codes in a first unit period is greater than an overload threshold value;
if the number of the abnormal data request response status codes in the first unit period is larger than the overload threshold, in the first unit period, when a data request of a data requester is received again, feeding back a preset processing message to the data requester;
in a second unit period, counting the number of the abnormal data request response state codes of the second unit period; judging whether the number of the abnormal data request response state codes in the second unit period is larger than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data requester is received again in the second unit period;
the counting the number of the abnormal data request response status codes of the second unit period includes:
and obtaining the attenuation quantity according to the quantity of the abnormal data request response state codes in the first unit period, wherein the attenuation quantity is added with the quantity of the abnormal data request response state codes received in the second unit period and is used as the quantity of the abnormal data request response state codes in the second unit period.
2. The method of claim 1, further comprising:
and counting the frequency of the data requests sent by the same data requester in unit time, and if the frequency of the data requests sent by the data requester in unit time is greater than the limit frequency, feeding back a preset processing message to the data requester.
3. The method according to claim 1, wherein after feeding back a preset processing message to the data requester when the data request from the data requester is received again in the first unit period, the method further comprises:
and adding the data requests which are not responded in the first unit period into the asynchronous processing queue, and processing the data requests in the asynchronous processing queue in the second unit period.
4. The method of claim 3, wherein the adding the first unit cycle of unresponsive data requests to the asynchronous processing queue comprises:
and acquiring multiple data requests of the same data requester in a first unit period, and adding one data request into the asynchronous processing queue.
5. The method according to claim 3, wherein feeding back a preset processing message to the data requester when the data request of the data requester is received again comprises:
when the data request of the data requester is received again, selecting the data request with the first preset proportion, and feeding back a preset processing message to the data requester with the first preset proportion; and selecting data requests with a second preset proportion, feeding back preset processing information to the data requesters with the second preset proportion, and adding the data requests with the second preset proportion into the asynchronous processing queue.
6. An overload protection apparatus, comprising:
a statistic module: the number of the abnormal data request response state codes received in the first unit period is counted;
a judging module: the system is used for judging whether the number of the abnormal data request response status codes in a first unit period is larger than an overload threshold value or not;
a first processing module: the data processing method comprises the steps of feeding back a preset processing message to a data requester when the data request of the data requester is received again in a first unit period if the number of the abnormal data request response status codes in the first unit period is larger than an overload threshold;
a second processing module: the number of the abnormal data request response state codes in the second unit period is counted; judging whether the number of the abnormal data request response state codes in the second unit period is larger than an overload threshold, if not, responding to the data request according to a preset service process when the data request of the data requester is received again in the second unit period;
the second processing module is specifically configured to: and obtaining the attenuation quantity according to the quantity of the abnormal data request response state codes in the first unit period, wherein the attenuation quantity is added with the quantity of the abnormal data request response state codes received in the second unit period and is used as the quantity of the abnormal data request response state codes in the second unit period.
7. The apparatus of claim 6, further comprising:
a frequency limiting module: the method is used for counting the frequency of data requests sent by the same data requester in unit time, and feeding back a preset processing message to the data requester if the frequency of the data requests sent by the data requester in unit time is greater than a limit frequency.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, implements the overload protection method according to any one of claims 1 to 5.
9. A server, comprising:
one or more processors;
a memory;
one or more computer programs, wherein the one or more computer programs are stored in the memory and configured to be executed by the one or more processors, the one or more computer programs configured to perform the overload protection method of any one of claims 1 to 5.
CN201811231449.3A 2018-10-22 2018-10-22 Overload protection method and device, computer readable storage medium and server Active CN109547282B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811231449.3A CN109547282B (en) 2018-10-22 2018-10-22 Overload protection method and device, computer readable storage medium and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811231449.3A CN109547282B (en) 2018-10-22 2018-10-22 Overload protection method and device, computer readable storage medium and server

Publications (2)

Publication Number Publication Date
CN109547282A CN109547282A (en) 2019-03-29
CN109547282B true CN109547282B (en) 2022-04-12

Family

ID=65844181

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811231449.3A Active CN109547282B (en) 2018-10-22 2018-10-22 Overload protection method and device, computer readable storage medium and server

Country Status (1)

Country Link
CN (1) CN109547282B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111193760B (en) * 2019-07-18 2022-01-07 腾讯科技(深圳)有限公司 Information sending method, device and storage medium
CN111031105B (en) * 2019-11-26 2022-06-28 北京百度网讯科技有限公司 Statistical method, device, equipment and storage medium for message frequency in automatic driving
CN112860465A (en) * 2019-11-27 2021-05-28 中移物联网有限公司 Service overload protection method and device and server
CN111585831B (en) * 2020-03-30 2022-10-21 福建天泉教育科技有限公司 Abnormal application processing method and storage medium
CN112350950A (en) * 2020-10-28 2021-02-09 北京中电普华信息技术有限公司 Request message control method and device
CN113660215A (en) * 2021-07-26 2021-11-16 杭州安恒信息技术股份有限公司 Attack behavior detection method and device based on Web application firewall

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2055301U (en) * 1989-05-31 1990-03-28 徐雅佳 Automatic overload protective arrangement
CN101741850A (en) * 2009-12-25 2010-06-16 北京邮电大学 Multitask concurrent executive system and method for hybrid network service

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101521583B (en) * 2008-02-29 2012-07-04 华为技术有限公司 Resource admission control method, system and device
CN101340634B (en) * 2008-08-14 2012-12-05 中兴通讯股份有限公司 Implementing method for duplication removing protection of MMS forwarding message
CN105471933B (en) * 2014-08-07 2019-04-26 腾讯科技(深圳)有限公司 Server overload guard method, server overload protection system and server
CN107370806B (en) * 2017-07-12 2020-11-24 北京京东尚科信息技术有限公司 HTTP status code monitoring method, device, storage medium and electronic equipment
CN107995127B (en) * 2017-12-13 2022-01-21 深圳乐信软件技术有限公司 Overload protection method and device
CN108234349A (en) * 2017-12-22 2018-06-29 中国联合网络通信集团有限公司 The method and apparatus for improving SOA system robustness

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2055301U (en) * 1989-05-31 1990-03-28 徐雅佳 Automatic overload protective arrangement
CN101741850A (en) * 2009-12-25 2010-06-16 北京邮电大学 Multitask concurrent executive system and method for hybrid network service

Also Published As

Publication number Publication date
CN109547282A (en) 2019-03-29

Similar Documents

Publication Publication Date Title
CN109547282B (en) Overload protection method and device, computer readable storage medium and server
CN109104336B (en) Service request processing method and device, computer equipment and storage medium
US8355709B2 (en) Device that determines whether to launch an application locally or remotely as a webapp
US10425349B2 (en) Idle worker-process page-out
US8386512B2 (en) System for managing data collection processes
US8479202B2 (en) Method and system for autonomic application program spawning in a computing environment
CN111190745B (en) Data processing method, device and computer readable storage medium
CN109284046B (en) Method, device, terminal and storage medium for controlling control
CN108111554B (en) Control method and device for access queue
CN112437018A (en) Flow control method, device, equipment and storage medium for distributed cluster
CN105550051A (en) Asynchronous processing method and device of business request
CN111131058A (en) Access point control method and device
CN107819797B (en) Access request processing method and device
CN107172182A (en) A kind of information push method, message push server and terminal
CN109815716A (en) Access request processing method, device, storage medium and server
CN109542718A (en) Monitoring method, device, storage medium and the server of service call
CN106550021B (en) Push method and device for push message
CN114328156B (en) Health detection method, device and equipment of protocol port and readable storage medium
US10992517B1 (en) Dynamic distributed execution budget management system
CN109547563B (en) Message push processing method and device, storage medium and server
CN111611123B (en) Data processing method, data processing system and equipment
CN111090627B (en) Log storage method and device based on pooling, computer equipment and storage medium
CN109062707A (en) The method that is communicated between electronic device and its limiting process, storage medium
CN111124547B (en) Task processing method and device
CN116719621B (en) Data write-back method, device, equipment and medium for mass tasks

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant