System self-adaptive current limiting method based on server software and hardware indexes
Technical Field
The invention relates to a server processing method, in particular to a system self-adaptive current limiting method based on server software and hardware indexes.
Background
With the development of technology, internet applications are becoming more common, and the technical requirements on network servers are also becoming higher. For a large server, the interfaces are frequently called by the outside, and if no access flow control is added, the calling frequency of the interfaces is too high, so that the stability of the system is affected.
A server, also called a server, is a device that provides computing services. Since the server needs to respond to the service request and process it, the server should generally have the ability to afford the service and secure the service. The server includes a processor, a hard disk, a memory, a system bus, and the like, and is similar to a general-purpose computer architecture, but is required to provide highly reliable services, and thus has high demands in terms of processing capacity, stability, reliability, security, scalability, manageability, and the like.
In the server system, resources such as cpu and memory are allocated to the back-end server every time a request is processed, and under the condition of high concurrency or under the condition that the system is under flow attack, the cpu utilization rate and the memory utilization rate of the back-end server always stay high, so that the risk of breakdown exists.
Accordingly, improvements in the art are needed.
Disclosure of Invention
The invention aims to provide a system self-adaptive current limiting method based on server software and hardware indexes.
In order to solve the technical problems, the invention provides a system self-adaptive current limiting method based on server software and hardware indexes, which comprises the following steps:
1) The server receives the user data and monitors the state of the server in real time;
2) Triggering a current limiting strategy when the server reaches a preset condition, and executing the step 3;
3) And reducing the data received by the server.
As an improvement on the self-adaptive current limiting method of the system based on the software and hardware indexes of the server, the invention:
In step 1:
when the server receives the user data, the user data are marked with characteristics, such as the parameters in the CPU of the user data, the read-write speed of the IO interface, the memory size parameter and the like, if the parameters exceed the set values, the labels with larger corresponding parameters are marked, and one user data can comprise a plurality of labels, so that the parameters of certain types of user data can be quickly searched for speed limit.
The set point is twice the average value used.
As a further improvement on the self-adaptive current limiting method of the system based on the software and hardware indexes of the server:
The preset conditions in the step 2 comprise that parameters in a CPU of the server reach a parameter threshold, or reading and writing of an IO interface of the server reach a reading and writing threshold, or the memory size of the server reaches a memory threshold;
As a further improvement on the self-adaptive current limiting method of the system based on the software and hardware indexes of the server:
When the server does not trigger the current limiting strategy, the response time period rt of the data request is only less than 1% and exceeds the response threshold;
The response threshold setting method comprises the following steps:
rt threshold = minRT core number coefficient
MinRT is the minimum value of the response time rt in the historical data of the server, the core number is the total number of cores of the CPU of the server, and the coefficient can be set manually.
As a further improvement on the self-adaptive current limiting method of the system based on the software and hardware indexes of the server:
in step 3, the server reduces the received data according to the area, the user type and the user tag.
According to the regional current limiting, each region is represented by a province, a city and a district, and when the current limiting is performed, the user data of the specific province, city and district can be limited, or the user data of the province, city and district with the most data is received for current limiting;
the user type comprises member users and common users, and the user data of the common users can be limited to be limited when the user type is limited.
And according to the user label current limiting, selecting user data containing labels with larger corresponding parameters to limit the current according to the parameters reaching preset conditions.
As a further improvement on the self-adaptive current limiting method of the system based on the software and hardware indexes of the server:
the method of limiting the current includes rejecting new user data directly or the new user data is in a pending state and re-reading after the limiting policy is over.
The system self-adaptive current limiting method based on the server software and hardware indexes has the technical advantages that:
According to the invention, by combining monitoring indexes of Load, CPU utilization rate, ensemble average RT, inlet QPS, jmeter threads and the like in several dimensions, through a self-adaptive flow control strategy, the inlet flow of the system and the Load of the system are balanced, so that the system runs at the maximum throughput as much as possible and the overall stability of the system is ensured.
Drawings
The following describes the embodiments of the present invention in further detail with reference to the accompanying drawings.
FIG. 1 is a flow chart of the adaptive current limiting method of the system based on the software and hardware indexes of the server.
Detailed Description
The invention will be further described with reference to specific examples, but the scope of the invention is not limited thereto.
Embodiment 1, a system adaptive current limiting method based on server software and hardware indexes, as shown in fig. 1, includes the following steps:
1) The server receives the user data and monitors the state of the server in real time;
When the server receives the user data, the user data are marked with features, such as the parameters in the CPU of the user data, the read-write speed of the IO interface, the memory size parameter and the like, if the parameters exceed the set values (for example, the average value is doubled), the labels with larger corresponding parameters are marked, and one user data can comprise a plurality of labels, so that the parameters of certain types of user data can be quickly searched for limiting the speed.
The API on line is evaluated by a stress test (such as jmeter, etc.) to define the API type according to the stress test result, so as to classify the API.
2) Triggering a current limiting strategy when the server reaches a preset condition, and executing the step 3;
The preset conditions comprise that parameters in a CPU of the server reach a parameter threshold, or reading and writing of an IO interface of the server reach a reading and writing threshold, or when the memory size of the server reaches a memory threshold, a current limiting strategy is executed, and step 3 is executed;
parameters in the CPU of the server include CPU Load, CPU comprehensive utilization, jumps of the CPU.
The query rate QSP per second of the server has a limit value, the limit value is 1.5w, the service response time period rt is too long after the limit value is exceeded, it is required to ensure that the response time period rt of only less than 1% of data requests exceeds a response threshold, and the response threshold can be set to 3s.
The response threshold setting method comprises the following steps:
rt threshold = minRT core number coefficient
MinRT is the minimum value of the response time rt in the historical data of the server, the core number is the total number of cores of the cpu of the server, and the coefficient can be set manually, for example, 2.5 is used. By changing the magnitude of the coefficient, the magnitude of the response time period rt can be changed.
The corresponding time period rt and the query rate QSP per second are positively correlated, and the larger the corresponding time period rt is, the larger the query rate QSP per second is. The query rate QSP needs to be ensured to be within the safety range, the preset condition is set accordingly, and if the threshold value of the preset condition is not reached, the query rate QSP is within the safety range. Current limiting is required when a threshold value of a preset condition is reached.
3) And reducing user data received by the server until the server does not reach a preset condition, namely that parameters in a CPU of the server are lower than a parameter threshold, reading and writing of an IO interface of the server are lower than a reading and writing threshold, and the memory size of the server is lower than a memory threshold.
The server reduction of received data may be reduced according to region, user type, user tag, etc.
According to the regional current limiting, each region is represented by a province, a city, a district and the like, and when the current limiting is performed, the user data of the specific province, city and district can be limited, or the user data of the province, city and district with the most data received can be limited;
the user type includes member users, common users and the like, and the user data of the common users can be limited to be limited in the process of limiting the current.
And according to the user label current limiting, selecting user data containing labels with larger corresponding parameters to limit the current according to the parameters reaching preset conditions.
The method of limiting the current includes rejecting new user data directly or the new user data is in a pending state and re-reading after the limiting policy is over.
Finally, it should also be noted that the above list is merely a few specific embodiments of the present invention. Obviously, the invention is not limited to the above embodiments, but many variations are possible. All modifications directly derived or suggested to one skilled in the art from the present disclosure should be considered as being within the scope of the present invention.