CN105471614A - Overload protection method and device and server - Google Patents
Overload protection method and device and server Download PDFInfo
- Publication number
- CN105471614A CN105471614A CN201410460897.6A CN201410460897A CN105471614A CN 105471614 A CN105471614 A CN 105471614A CN 201410460897 A CN201410460897 A CN 201410460897A CN 105471614 A CN105471614 A CN 105471614A
- Authority
- CN
- China
- Prior art keywords
- core
- cpu
- client
- consumption data
- data
- 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.)
- Pending
Links
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention provides an overload protection method and device and a server. The method comprises that resource consumption data of a CPU within a preset sampling period is obtained; according to the resource consumption data of the CPU, the CPU occupancy rate, for processing client request, of a process within the preset sampling period is calculated, and if the CPU occupancy rate exceeds a preset threshold, the process is rejected to process the client request, and if the CPU occupancy rate does not exceed the preset threshold, the process continues to process the client request in the next preset sampling period.
Description
Technical field
The present invention relates to field of Internet communication, particularly relate to a kind of overload protection method, device and server.
Background technology
Between client and server is a kind of network interactive mode applied at present widely alternately.Wherein, client, by request and server communication, has carried out various data interaction.
In order to the situation that cannot effectively process when settlement server receives the too many request from client; the overload protection method be often applied in prior art in server is; carry out Control Server load by the request amount in every period of predetermined sampling period of restriction process client, server is remained under certain load level.Concrete, comprise: define a variable as counter, and be initialized as 0, within one period of predetermined sampling period (such as 1 second), cumulative calculation receives the number of request of row relax of going forward side by side, in interval during this period of time, when accumulative number of request is no more than predetermined threshold (such as 1000), normal process request; In same amount of time interval, when accumulative number of request exceedes predetermined threshold, refusal accepts new request.After exceeding this period of time interval, again counter zero setting, and recalculate the number of request accepted in next period of time interval.
But on the one hand, the performance that each request consumes may be different, prior art cannot the load of accurate Control Server; On the other hand, if when limiting the predetermined threshold of request amount in every period of time interval, assessing the consumption performance of each request, assessing more loaded down with trivial details again; And to the server of difference configuration, need to carry out different petition configurations, configuration management is complicated.
Summary of the invention
In view of this, the invention provides a kind of can the accurately load protective method of Control Server load, device and server.
A kind of overload protection method, comprising: obtain the cpu resource consumption data in the predetermined sampling period; Calculate within the described predetermined sampling period, for the treatment of the CPU usage of the process of client-requested; And if described CPU usage exceedes predetermined threshold, then refuse the request of described process process from described client, if described CPU usage does not exceed predetermined threshold, described process continues the request of process from described client in the next one predetermined sampling period.
A kind of overload protection arrangement, comprising: data acquisition module, for obtaining the Cpu resource consumption data in the predetermined sampling period; Data processing module, for calculating within the described predetermined sampling period, for the treatment of the CPU usage of the process of client-requested; And request processing module, if exceed predetermined threshold for described CPU usage, then refuse the request of described process process from described client, if described CPU usage does not exceed predetermined threshold, described process continues the request of process from described client in the next one predetermined sampling period.
A kind of server, comprises memory and processor, and the module of overload protection arrangement of described memory for storing the embodiment of the present invention and providing, described processor is for running the module of the described overload protection arrangement be stored in described memory.
The overload protection method that the embodiment of the present invention provides, device and server; by obtaining the load weighing this process for the treatment of the CPU usage of the process of client-requested; relative to the method carrying out Control Server load in prior art according to number of request; accuracy is higher; and without the need to being configured for different servers; automatic management can be realized, without the need to manually intervening for various server.
For above and other object of the present invention, feature and advantage can be become apparent, preferred embodiment cited below particularly, and coordinate institute's accompanying drawings, be described in detail below.
Accompanying drawing explanation
Fig. 1 is the applied environment figure of a kind of overload protection method provided by the invention and device.
Fig. 2 shows a kind of structured flowchart of server.
The flow chart of the overload protection method that Fig. 3 provides for first embodiment of the invention.
The flow chart of the overload protection method that Fig. 4 provides for second embodiment of the invention.
The particular flow sheet of part run in the overload protection method that Fig. 5 provides for second embodiment of the invention.
The flow chart of the overload protection method that Fig. 6 provides for third embodiment of the invention.
The structured flowchart of the overload protection arrangement that Fig. 7 provides for fourth embodiment of the invention.
Fig. 8 is the storage environment schematic diagram of the device of Fig. 7.
The structured flowchart of the overload protection arrangement that Fig. 9 provides for fifth embodiment of the invention.
Embodiment
For further setting forth the present invention for the technological means that realizes predetermined goal of the invention and take and effect, below in conjunction with accompanying drawing and preferred embodiment, to according to the specific embodiment of the present invention, structure, feature and effect thereof, be described in detail as follows.
The overload protection method that the embodiment of the present invention provides can be applicable to, in applied environment as shown in Figure 1, realize the overload protection to server.As shown in Figure 1, user terminal 100, server 200 are arranged in wireless network or cable network, and by this wireless network or cable network, user terminal 100 is mounted with various client and server 200 carries out data interaction.
User terminal 100 can comprise smart mobile phone, panel computer, E-book reader, MP3 player (MovingPictureExpertsGroupAudioLayerIII, dynamic image expert compression standard audio frequency aspect 3), MP4 (MovingPictureExpertsGroupAudioLayerIV, dynamic image expert compression standard audio frequency aspect 4) player, pocket computer on knee, desktop computer computer, vehicle-mounted computer, wearable device etc.
Fig. 2 shows a kind of structured flowchart of server.As shown in Figure 2, server 200 comprises: memory 201, processor 202 and mixed-media network modules mixed-media 203.
Be appreciated that the structure shown in Fig. 2 is only signal, server 200 also can comprise than assembly more or less shown in Fig. 2, or has the configuration different from shown in Fig. 2.Each assembly shown in Fig. 2 can adopt hardware, software or its combination to realize.In addition, the server in the embodiment of the present invention can also comprise the server of multiple concrete difference in functionality.
Memory 201 can be used for storing software program and module; as the overload protection method in the embodiment of the present invention and program command/module corresponding to device; processor 202 is by running the software program and module that are stored in memory 201; thus perform the application of various function and data processing, namely realize the overload protection method in the embodiment of the present invention.Memory 201 can comprise high speed random asccess memory, also can comprise nonvolatile memory, as one or more magnetic storage device, flash memory or other non-volatile solid state memories.In some instances, memory 201 can comprise the memory relative to the long-range setting of processor 202 further, and these remote memories can be connected to server 200 by network.Further, above-mentioned software program and module also can comprise: service module 221 and operating system 222.Wherein operating system 222, such as can be LINUX, UNIX, WINDOWS, it can comprise the various component software for management system task (such as memory management, memory device control, power management etc.) and/or driving, and can with various hardware or the mutual communication of component software, thus provide the running environment of other component softwares.Service module 221 operates on the basis of operating system 222, and monitors the request of automatic network by the network service of operating system 222, completes corresponding data processing, and return result to client according to request.That is, service module 221 is for providing services on the Internet to client.
Mixed-media network modules mixed-media 203 is for receiving and sending network signal.Above-mentioned network signal can comprise wireless signal or wire signal.In an example, above-mentioned network signal is cable network signal.Now, mixed-media network modules mixed-media 203 can comprise the elements such as processor, random asccess memory, transducer, crystal oscillator.
In the embodiment of the present invention, client can be installed on user terminal 100.In the embodiment of the present invention, client can be the various application being installed on user terminal 100, such as: instant messaging application (such as QQ, micro-letter etc.) in user terminal 100, browser or game application etc., user in user terminal 100, input user account number and password can log in corresponding application and use the miscellaneous service that server 200 provides.
For further setting forth the present invention for the technological means that realizes predetermined goal of the invention and take and effect, below in conjunction with accompanying drawing and preferred embodiment, to according to the specific embodiment of the present invention, structure, feature and effect thereof, be described in detail as follows.
First embodiment
The flow chart of the overload protection method that Fig. 3 provides for first embodiment of the invention.Composition graphs 1, what the present embodiment described is the handling process of server, and the overload protection method of the present embodiment comprises the following steps:
Step S11, obtains the cpu resource consumption data in the predetermined sampling period.
CPU is CentralProcessingUnit, the English abbreviation of central processing unit, namely usually said processor, is one piece of ultra-large integrated circuit.CPU according to from memory fetch to instruction decide its act of execution.In the embodiment of the present invention, cpu resource consumption data refers to total resource that CPU consumes, such as, in (SuSE) Linux OS, cpu resource consumption data refers to the summation that CPU is in the time that the time of User space execution, the time of system kernel execution and idle systems process perform.
Step S12, according to described cpu resource consumption data, calculates within the described predetermined sampling period, for the treatment of the CPU usage of the process of client-requested.
The operating system of server can start multiple process simultaneously, and client application is put in a process by operating system, namely runs this client application by this process and the client-requested of process correspondence.Operating system is according to the corresponding relation of client application and process, the resource data of CPU for the treatment of the actual consumption of the process of client-requested can be obtained, then according to the value of the resource data/cpu resource consumption data of calculating actual consumption, the CPU usage of the process for the treatment of client-requested is obtained.
Step S13, if described CPU usage exceedes predetermined threshold, then refuse the request of described process process from described client, if described CPU usage does not exceed predetermined threshold, described process continues the request of process from described client in the next one predetermined sampling period.
The overload protection method that the embodiment of the present invention provides; by obtaining the load weighing this process for the treatment of the CPU usage of the process of client-requested; relative to the method carrying out Control Server load in prior art according to number of request; accuracy is higher; and without the need to being configured for different servers; automatic management can be realized, without the need to manually intervening for various server.
Second embodiment
The flow chart of the processing method of the service request that Fig. 4 provides for second embodiment of the invention.Composition graphs 1, what the present embodiment described is the handling process of server, and the processing method of the service request that the present embodiment provides comprises the following steps:
Step S21, obtains the cpu resource consumption data in the predetermined sampling period and the core cpu number in server.
That current most CPU adopts is multi-core CPU, and the symmetric multiprocessor in MPP device can be integrated in same chip by multi-core CPU, the process that each processor executed in parallel is different.
The respective cpu resource consumption data of each core and total cpu resource consumption data is included in the cpu resource consumption data obtained.
Step S22, according to described core cpu number and described cpu resource consumption data, calculates within the described predetermined sampling period, for the treatment of the process of client-requested in the CPU usage of each core.
A process is generally correspond to an executable file (as .exe file), a process can comprise multiple thread (multithread programs), each thread operates in a core cpu, therefore, for the process of multithreading, can be corresponding with multiple core, be exactly single-threaded process, also can be specified by system and adopt which core to run.Such as, in an embodiment of the present invention, the process for the treatment of client-requested is designated corresponding with the core of 4 in CPU.
Please refer to Fig. 5, step S22 can comprise further:
Step S221, according to cpu resource consumption data, the process for the treatment of client-requested of obtaining is in the resource consumption data of each core;
Step S222, according to the resource consumption data of each core and the free time consumption data of system configuration, obtains the resource data of the actual consumption of each core;
Step S223, calculates the ratio of the resource data of the actual consumption of each core and the resource consumption data of each core, and the process for the treatment of client-requested of obtaining is in the CPU usage of each core.
Step S23, judges whether the CPU usage of each core exceedes described predetermined threshold.
Step S24, if there is the CPU usage of core to exceed predetermined threshold, the process process that then refusal is corresponding with this core is from the request of described client, other processes continue the request of process from described client, if the CPU usage of each core does not all exceed described predetermined threshold, all processes for the treatment of client-requested continue the request of process from described client.
Concrete, can set up a timer, timing calculates process for the treatment of client-requested in the CPU usage of each core.Further, a process status table can also be set up, the CPU usage state recording at every turn calculated is got off.If when the CPU usage being checked through certain process exceedes or arrives a limiting value (predetermined threshold of also just upgrading), such as: 90%, 95% or 100% etc., then this state of a process in process status table is revised as exception, and refuses the request of this process process from client.Because Timer interval is fixing, in process status table, abnormal process has been labeled as certain, if when being checked through its CPU usage lower than the limiting value specified, then this state of a process in process status table can be revised as normally, make this process can continue to process the request from described client.
The overload protection method that the embodiment of the present invention provides; by obtaining the load weighing this process for the treatment of the CPU usage in each core of the process of client-requested; relative to the method carrying out Control Server load in prior art according to number of request; accuracy is higher; and without the need to being configured for different servers; automatic management can be realized, without the need to manually intervening for various server.
3rd embodiment
The flow chart of the processing method of the service request that Fig. 6 provides for third embodiment of the invention.Composition graphs 1, what the present embodiment described is the handling process of server, and the processing method of the service request that the present embodiment provides comprises the following steps:
Step S300, obtains the core cpu number in server.
Step S301, obtains the cpu resource consumption data total1 of each core of current time.
Step S302, obtains the cpu resource consumption data total2 of each core through the described predetermined sampling period.
Step S303, according to the free time consumption data of resource consumption data total1 and system configuration, calculates at described current time, for the treatment of the process of client-requested at the resource data used1 of each core actual consumption.
Step S304, according to the free time consumption data of resource consumption data total2 and system configuration, calculates through the described predetermined sampling period, for the treatment of the process of client-requested, at the resource data used2 of the actual consumption of each core.
Step S305, utilizes formula P=(used2-used1)/(total2-total1) * 100%, and the process for the treatment of client-requested of calculating is at the CPU usage P of each core.
Step S306, judges whether the CPU usage of each core exceedes described predetermined threshold.
Step S307, if there is the CPU usage of core to exceed predetermined threshold, the process process that then refusal is corresponding with this core is from the request of described client, other processes continue the request of process from described client, if the CPU usage of each core does not all exceed described predetermined threshold, all processes for the treatment of client-requested continue the request of process from described client.
For (SuSE) Linux OS, the overload protection method in the present embodiment will be described in detail below.It should be noted that, although be described for (SuSE) Linux OS in the present embodiment, embodiments of the present invention are not limited with concrete operating system, and the technical scheme in various embodiments of the present invention is equally applicable to other operating system.
First, read the core number of server CPU, such as, by the processor field under reading/proc/cpuinfo file, or cpucores field determines the core number of CPU.Wherein, processor field is for showing the maximum core numbering of CPU, and the core due to CPU is by 0 open numbering, therefore, if the processor field read is 3, the core that so can obtain CPU is numbered 0,1,2,3, that is the core number of CPU is 4.In addition, cpucores field is for showing the core number of CPU, if reading cpucores field is 4, the core number that so directly can obtain CPU is 4.
The core number supposing to obtain CPU is 4, represents 4 cores of CPU respectively with CPU0, CPU1, CPU2, CPU3.
Read the cpu resource consumption data total1 of current time, concrete, the cpu resource consumption data of current time can be obtained by the data in reading/proc/stat file.Under linux system, CPU usage is divided into User space, systematic thinking way and Idle state, represents that CPU is in the time of User space execution respectively, the time that system kernel performs, and the time that idle systems process performs.CPU usage refers to: CPU perform nonsystematic idle process time/CPU total time of implementation.
In the kernel of Linux, there is global variable a: Jiffies.Jiffies represents the time.Its unit is different with the difference of hardware platform.Define a constant HZ in system, represent the number of per second kind of minimum interval.The unit of such jiffies is exactly 1/HZ.The unit of Intel platform jiffies is 1/100 second, the minimum interval that system that Here it is can be differentiated.Each CPU time sheet, Jiffies will add 1.Total be exactly the occupancy of CPU with perform User space+systematic thinking way Jiffies divided by Jifffies represent.
Suppose reading/proc/stat file, the cpu resource consumption data obtained is as shown in table 1:
Table 1
col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | |
CPU | 58881059 | 276558 | 79626046 | 39233433523 | 12364186 | 847076 | 14038754 | 0 |
CPU0 | 22740763 | 118390 | 39867589 | 9768789325 | 6115347 | 847070 | 11388298 | 0 |
CPU1 | 5773426 | 50387 | 9885799 | 9831592484 | 2241835 | 0 | 323006 | 0 |
CPU2 | 18818718 | 51212 | 14915724 | 9813169718 | 2681267 | 2 | 230148 | 0 |
CPU3 | 11548151 | 56568 | 14956931 | 9819881995 | 1325735 | 3 | 2097299 | 0 |
In table 1, the data representation that CPU is expert at be total cpu resource consumption data, the cpu resource consumption data of core CPU 0 that what CPU0 represented is, the cpu resource consumption data of core CPU 1 that what CPU1 represented is, the cpu resource consumption data of core CPU 2 that what CPU2 represented is, the cpu resource consumption data of core CPU 3 that what CPU3 represented is.Suppose the cpu resource consumption data (time of implementation that namely CPU is total) representing current time with total1, so, cpu resource consumption data total1 corresponding to each core can utilize formula (1) to calculate:
total1=col1+col2+col3+col4+col5+col6+col7+col8.(1)
Wherein, what col1-col8 represented respectively is the cpu resource consumption data that this core arranges at 1-8, and unit is jiffies.What suppose to calculate is the cpu resource consumption data of core CPU 0, so total1 (CPU0)=
58881059+276558+79626046+39233433523+12364186+847076+14038754。
Wherein, col4 and col5 is the free time consumption data of operating system configuration, the namely time of CPU executive system idle process, so, at described current time, the resource data used1 for the treatment of process actual consumption in each core of client-requested can be calculated by formula (2):
used1=total1-col4-col5.(2)
What suppose calculating is at described current time, for the treatment of the cpu resource consumption data of process resource data used1 core CPU 0 of actual consumption in core CPU 0 of client-requested, so used1 (CPU0)=total1 (CPU0)-39233433523-12364186.
Suppose that the predetermined sampling period is 10 seconds, so obtain current time each core cpu resource consumption data total1 and according to the free time consumption data of resource consumption data total1 and system configuration, calculate the process for the treatment of client-requested, in each core of described current time actual consumption resource data used1 after, through 10 seconds, then obtain cpu resource consumption data total2.That is, suppose that current time is t0, the predetermined sampling period is 10 seconds, so when t0+10, obtain cpu resource consumption data total2, and calculate through 10 seconds time according to said method, for the treatment of the resource data used2 of process actual consumption in each core of described current time of client-requested, recycling formula (3) calculates the CPU usage P of process in each core for the treatment of client-requested:
P=(used2-used1)/(total2-total1)*100%.(3)
After the CPU usage P of the process for the treatment of client-requested of calculating in each core, judge whether the CPU usage of each core exceedes described predetermined threshold.Suppose that the CPU usage of core CPU0 exceedes predetermined threshold (such as 90%), then corresponding with this core process for the treatment of client-requested is refused to process the request from described client, other CPU occupation rates do not exceed the core CPU 1 of predetermined threshold, the process for the treatment of client-requested corresponding to CPU2, CPU3 then can continue to process the request from described client.
Understandable, according to the predetermined sampling period of different duration, the CPU occupation rate in different cycles can be obtained, get the shorter predetermined sampling period (such as 1 second), instantaneous CPU occupation rate can be calculated, get the longer predetermined sampling period (such as 10 seconds), can average load be calculated, namely can carry out peak clipping process to the burr of data, the data obtained are more accurate.
The overload protection method that the embodiment of the present invention provides; by obtaining the load weighing this process for the treatment of the CPU usage in each core of the process of client-requested; relative to the method carrying out Control Server load in prior art according to number of request; accuracy is higher; and without the need to being configured for different servers; automatic management can be realized, without the need to manually intervening for various server.
4th embodiment
The structured flowchart of the overload protection arrangement that Fig. 7 provides for fourth embodiment of the invention.The overload protection arrangement that the present embodiment provides can run on server, may be used for the overload protection method in above-described embodiment.As shown in Figure 7, overload protection arrangement 40 comprises: data acquisition module 41, data processing module 42, request processing module 43.
Wherein, data acquisition module 41, for obtaining the cpu resource consumption data in the predetermined sampling period;
Data processing module 42, for calculating within the described predetermined sampling period, for the treatment of the CPU usage of the process of client-requested; And
Request processing module 43, if exceed predetermined threshold for described CPU usage, then refuse the request of described process process from described client, if described CPU usage does not exceed predetermined threshold, described process continues the request of process from described client in the next one predetermined sampling period.
Further, in an embodiment of the present invention, described data acquisition module 41 is also for obtaining the cpu resource consumption data total1 of each core of current time and the cpu resource consumption data total2 through the described predetermined sampling period respectively.
Described data processing module 42 also for: according to the free time consumption data of resource consumption data total1 and system configuration, calculate at described current time, for the treatment of the process of client-requested at the resource data used1 of each core actual consumption; According to the free time consumption data of resource consumption data total2 and system configuration, calculate through the described predetermined sampling period, for the treatment of the process of client-requested, at the resource data used2 of the actual consumption of each core; Utilize formula P=(used2-used1)/(total2-total1) * 100%, the process for the treatment of client-requested of calculating is at the CPU usage P of each core.
Each module can be by software code realization above, and now, above-mentioned each module can be stored in memory 201, as shown in Figure 8.Each module can be realized by hardware such as integrated circuit (IC) chip equally above.
The present embodiment, to the detailed process of each Implement of Function Module of overload protection arrangement 40 function separately, refers to the particular content of above-mentioned Fig. 1 to middle description embodiment illustrated in fig. 6, repeats no more herein.
The overload protection arrangement that the embodiment of the present invention provides; by obtaining the load weighing this process for the treatment of the CPU usage of the process of client-requested; relative to the method carrying out Control Server load in prior art according to number of request; accuracy is higher; and without the need to being configured for different servers; automatic management can be realized, without the need to manually intervening for various server.
5th embodiment
The structured flowchart of the overload protection arrangement that Fig. 9 provides for fifth embodiment of the invention.The overload protection arrangement that the present embodiment provides can run on server, may be used for the overload protection method in above-described embodiment.As shown in Figure 9, overload protection arrangement 50 can comprise: data acquisition module 51, data processing module 52, request processing module 53.
With the 4th embodiment unlike, in the present embodiment, described data acquisition module 51 is also for obtaining the core cpu number in server.When described core number is more than or equal to two, described data processing module 52 is also for according to described core cpu number and described cpu resource consumption data, calculate within the described predetermined sampling period, for the treatment of the process of client-requested in the CPU usage of each core.Described request processing module 53 is also for judging whether the CPU usage of each core exceedes described predetermined threshold, if there is the CPU usage of core to exceed predetermined threshold, the process process that then refusal is corresponding with this core is from the request of described client, and other processes continue the request of process from described client.
Described data processing module 52 also comprises:
Process data acquiring unit 521, for according to cpu resource consumption data, the process for the treatment of client-requested of obtaining is in the resource consumption data of each core;
Actual consumption computing unit 522, for according to the resource consumption data of each core and the free time consumption data of system configuration, obtains the resource data of the actual consumption of each core;
Occupancy computing unit 523, for the ratio of the resource consumption data of the resource data and each core that calculate the actual consumption of each core, the process for the treatment of client-requested of obtaining is in the CPU usage of each core.
Each module can be by software code realization above, and now, above-mentioned each module can be stored in memory 201.Each module can be realized by hardware such as integrated circuit (IC) chip equally above.
The present embodiment, to the detailed process of each Implement of Function Module of overload protection arrangement 50 function separately, refers to the particular content of above-mentioned Fig. 1 to middle description embodiment illustrated in fig. 6, repeats no more herein.
The overload protection arrangement that the embodiment of the present invention provides; by obtaining the load weighing this process for the treatment of the CPU usage in each core of the process of client-requested; relative to the method carrying out Control Server load in prior art according to number of request; accuracy is higher; and without the need to being configured for different servers; automatic management can be realized, without the need to manually intervening for various server.
6th embodiment
The server that sixth embodiment of the invention provides can be as shown in Figure 2; comprise memory and processor; described memory is for storing the module of the overload protection arrangement in the 4th or the 5th embodiment; described processor, for running the module of the described overload protection arrangement be stored in described memory, realizes the overload protection to server.
It should be noted that, each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For device class embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
It should be noted that, in this article, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or device and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or device.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the device comprising key element and also there is other identical element.
One of ordinary skill in the art will appreciate that all or part of step realizing above-described embodiment can have been come by hardware, the hardware that also can carry out instruction relevant by program completes, program can be stored in a kind of computer-readable recording medium, the above-mentioned storage medium mentioned can be read-only memory, disk or CD etc.
Above, it is only preferred embodiment of the present invention, not any pro forma restriction is done to the present invention, although the present invention discloses as above with preferred embodiment, but and be not used to limit the present invention, any those skilled in the art, do not departing within the scope of technical solution of the present invention, make a little change when the technology contents of above-mentioned announcement can be utilized or be modified to the Equivalent embodiments of equivalent variations, in every case be do not depart from technical solution of the present invention content, according to any simple modification that technical spirit of the present invention is done above embodiment, equivalent variations and modification, all still belong in the scope of technical solution of the present invention.
Claims (9)
1. an overload protection method, is characterized in that, comprising:
Obtain the cpu resource consumption data in the predetermined sampling period;
According to cpu resource consumption data, calculate within the described predetermined sampling period, for the treatment of the CPU usage of the process of client-requested; And
If described CPU usage exceedes predetermined threshold, then refuse the request of described process process from described client, if described CPU usage does not exceed predetermined threshold, described process continues the request of process from described client in the next one predetermined sampling period.
2. method according to claim 1, it is characterized in that, also comprise before the step of the cpu resource consumption data in the described acquisition predetermined sampling period: obtain the core cpu number in server, when described core number is more than or equal to two, described calculating within the described predetermined sampling period, for the treatment of the CPU usage of the process of client-requested, and if described CPU usage exceed predetermined threshold, then refuse described process process from the step of the request of described client, comprising:
According to described core cpu number and described cpu resource consumption data, calculate within the described predetermined sampling period, for the treatment of the process of client-requested in the CPU usage of each core;
When there being the CPU usage of core to exceed predetermined threshold, then the process process that refusal is corresponding with this core is from the request of described client, and other processes continue the request of process from described client.
3. method according to claim 2, it is characterized in that, described according to described core cpu number and described cpu resource consumption data, calculate within the described predetermined sampling period, for the treatment of the process of client-requested in the step of the CPU usage of each core, comprise
According to cpu resource consumption data, the process for the treatment of client-requested of obtaining is in the resource consumption data of each core;
According to the resource consumption data of each core and the free time consumption data of system configuration, obtain the resource data of the actual consumption of each core;
Calculate the ratio of the resource data of the actual consumption of each core and the resource consumption data of each core, the process for the treatment of client-requested of obtaining is in the CPU usage of each core.
4. method according to claim 1, is characterized in that,
The step of the cpu resource consumption data in the described acquisition predetermined sampling period, comprising:
Obtain the cpu resource consumption data total1 of each core of current time;
Obtain the cpu resource consumption data total2 through each core in described predetermined sampling period;
Described calculating, within the described predetermined sampling period, for the treatment of the step of the CPU usage of the process of client-requested, comprising:
According to the free time consumption data of resource consumption data total1 and system configuration, calculate at described current time, for the treatment of the process of client-requested at the resource data used1 of each core actual consumption;
According to the free time consumption data of resource consumption data total2 and system configuration, calculate through the described predetermined sampling period, for the treatment of the process of client-requested, at the resource data used2 of the actual consumption of each core;
Utilize formula P=(used2-used1)/(total2-total1) * 100%, the process for the treatment of client-requested of calculating is at the CPU usage P of each core.
5. an overload protection arrangement, runs on server, it is characterized in that, comprising:
Data acquisition module, for obtaining the cpu resource consumption data in the predetermined sampling period;
Data processing module, for according to cpu resource consumption data, calculates within the described predetermined sampling period, for the treatment of the CPU usage of the process of client-requested; And
Request processing module, if exceed predetermined threshold for described CPU usage, then refuse the request of described process process from described client, if described CPU usage does not exceed predetermined threshold, described process continues the request of process from described client in the next one predetermined sampling period.
6. device according to claim 5, it is characterized in that, described data acquisition module is also for obtaining the core cpu number in server, when described core number is more than or equal to two, described data processing module is also for according to described core cpu number and described cpu resource consumption data, calculate within the described predetermined sampling period, for the treatment of the process of client-requested in the CPU usage of each core; Described request processing module is also for judging whether the CPU usage of each core exceedes described predetermined threshold, predetermined threshold is exceeded when there being the CPU usage of core, the process process that then refusal is corresponding with this core is from the request of described client, and other processes continue the request of process from described client.
7. device according to claim 6, is characterized in that, described data processing module also comprises:
Process data acquiring unit, for according to cpu resource consumption data, the process for the treatment of client-requested of obtaining is in the resource consumption data of each core;
Actual consumption computing unit, for according to the resource consumption data of each core and the free time consumption data of system configuration, obtains the resource data of the actual consumption of each core;
Occupancy computing unit, for the ratio of the resource consumption data of the resource data and each core that calculate the actual consumption of each core, the process for the treatment of client-requested of obtaining is in the CPU usage of each core.
8. device according to claim 5, is characterized in that,
Described data acquisition module is also for obtaining the cpu resource consumption data total1 of each core of current time and the cpu resource consumption data total2 through the described predetermined sampling period respectively;
Described data processing module also for: according to the free time consumption data of resource consumption data total1 and system configuration, calculate at described current time, for the treatment of the process of client-requested at the resource data used1 of each core actual consumption; According to the free time consumption data of resource consumption data total2 and system configuration, calculate through the described predetermined sampling period, for the treatment of the process of client-requested, at the resource data used2 of the actual consumption of each core; Utilize formula P=(used2-used1)/(total2-total1) * 100%, the process for the treatment of client-requested of calculating is at the CPU usage P of each core.
9. a server; comprise memory and processor; it is characterized in that, described memory is for storing the module as the overload protection arrangement in claim 5-8 as described in any one, and described processor is for running the module of the described overload protection arrangement be stored in described memory.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410460897.6A CN105471614A (en) | 2014-09-11 | 2014-09-11 | Overload protection method and device and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410460897.6A CN105471614A (en) | 2014-09-11 | 2014-09-11 | Overload protection method and device and server |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105471614A true CN105471614A (en) | 2016-04-06 |
Family
ID=55608929
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410460897.6A Pending CN105471614A (en) | 2014-09-11 | 2014-09-11 | Overload protection method and device and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105471614A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107092526A (en) * | 2016-11-02 | 2017-08-25 | 北京小度信息科技有限公司 | Task processing method and device |
CN107465627A (en) * | 2017-08-11 | 2017-12-12 | 北京小度信息科技有限公司 | Overload protection method, device, electronic equipment and flow processing system |
CN107613030A (en) * | 2017-11-06 | 2018-01-19 | 网宿科技股份有限公司 | A kind of method and system of processing business request |
CN108156091A (en) * | 2016-12-02 | 2018-06-12 | 阿里巴巴集团控股有限公司 | A kind of flow control methods and system |
WO2018188542A1 (en) * | 2017-04-10 | 2018-10-18 | 平安科技(深圳)有限公司 | Counting method, counter, and storage medium |
CN115297176A (en) * | 2022-08-02 | 2022-11-04 | 成都市吉祥锐意科技有限公司 | Adaptive overload protection method and system |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1480878A (en) * | 2002-09-02 | 2004-03-10 | 联想(北京)有限公司 | Method for obtaining information of linux operation system |
WO2009129487A2 (en) * | 2008-04-17 | 2009-10-22 | Tekelec | Methods, systems, and computer readable media for session initiation protocol (sip) overload control |
CN103092738A (en) * | 2012-12-26 | 2013-05-08 | 杭州华为数字技术有限公司 | Method and device of resource visualization |
CN103164663A (en) * | 2011-12-12 | 2013-06-19 | 深圳市腾讯计算机系统有限公司 | Overload protection method and device of server based on sliding window |
CN103399800A (en) * | 2013-08-07 | 2013-11-20 | 山东大学 | Dynamic load balancing method based on Linux parallel computing platform |
CN103581048A (en) * | 2013-11-08 | 2014-02-12 | 国家电网公司 | Method for having control over overload of distributed resources of electric power communication network |
CN103580922A (en) * | 2013-11-08 | 2014-02-12 | 国家电网公司 | Overload control method for electric power communication network application server based on hybrid optimization |
CN104239193A (en) * | 2014-09-04 | 2014-12-24 | 浪潮电子信息产业股份有限公司 | Linux-based CPU (Central Processing Unit) and memory usage rate collection method |
-
2014
- 2014-09-11 CN CN201410460897.6A patent/CN105471614A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1480878A (en) * | 2002-09-02 | 2004-03-10 | 联想(北京)有限公司 | Method for obtaining information of linux operation system |
WO2009129487A2 (en) * | 2008-04-17 | 2009-10-22 | Tekelec | Methods, systems, and computer readable media for session initiation protocol (sip) overload control |
CN103164663A (en) * | 2011-12-12 | 2013-06-19 | 深圳市腾讯计算机系统有限公司 | Overload protection method and device of server based on sliding window |
CN103092738A (en) * | 2012-12-26 | 2013-05-08 | 杭州华为数字技术有限公司 | Method and device of resource visualization |
CN103399800A (en) * | 2013-08-07 | 2013-11-20 | 山东大学 | Dynamic load balancing method based on Linux parallel computing platform |
CN103581048A (en) * | 2013-11-08 | 2014-02-12 | 国家电网公司 | Method for having control over overload of distributed resources of electric power communication network |
CN103580922A (en) * | 2013-11-08 | 2014-02-12 | 国家电网公司 | Overload control method for electric power communication network application server based on hybrid optimization |
CN104239193A (en) * | 2014-09-04 | 2014-12-24 | 浪潮电子信息产业股份有限公司 | Linux-based CPU (Central Processing Unit) and memory usage rate collection method |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107092526A (en) * | 2016-11-02 | 2017-08-25 | 北京小度信息科技有限公司 | Task processing method and device |
CN108156091A (en) * | 2016-12-02 | 2018-06-12 | 阿里巴巴集团控股有限公司 | A kind of flow control methods and system |
WO2018188542A1 (en) * | 2017-04-10 | 2018-10-18 | 平安科技(深圳)有限公司 | Counting method, counter, and storage medium |
CN107465627A (en) * | 2017-08-11 | 2017-12-12 | 北京小度信息科技有限公司 | Overload protection method, device, electronic equipment and flow processing system |
CN107613030A (en) * | 2017-11-06 | 2018-01-19 | 网宿科技股份有限公司 | A kind of method and system of processing business request |
CN115297176A (en) * | 2022-08-02 | 2022-11-04 | 成都市吉祥锐意科技有限公司 | Adaptive overload protection method and system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105471614A (en) | Overload protection method and device and server | |
CN107770088B (en) | Flow control method and device | |
CN107679081B (en) | Information modification method and device, computer equipment and computer readable storage medium | |
US20170024316A1 (en) | Systems and methods for scheduling tasks in a heterogeneous processor cluster architecture using cache demand monitoring | |
KR102060430B1 (en) | SYSTEM ON CHIP(SoC) CAPABLE OF REDUCING WAKE-UP TIME, APPLICATION PROCESSOR, AND COMPUTER SYSTEM HAVING SAME | |
US9087146B2 (en) | Wear-out equalization techniques for multiple functional units | |
US20130205149A1 (en) | Apparatus and method for dynamically adjusting frequency of central processing unit | |
CN114257551A (en) | Distributed current limiting method and system and storage medium | |
CN105260655A (en) | Application program starting protection method, device and system | |
US20170235598A1 (en) | Method for identifying application causing temperature rise of terminal, and terminal | |
CN117056054A (en) | Interrupt control method, interrupt controller, computer device, and storage medium | |
CN111983412A (en) | Monitoring system, monitoring method, monitoring terminal and storage medium | |
CN114253619A (en) | SSD multi-level Boot method and device, computer equipment and storage medium | |
CN110286981A (en) | The display methods and display system of the use state of virtual cloud desktop server | |
CN111159038B (en) | Method for simulating CPU load and electronic equipment | |
CN113238842A (en) | Task execution method and device and storage medium | |
CN110399166B (en) | ME Nonce value saving method, device, equipment and storage medium | |
CN110175450B (en) | Information processing method, device and equipment | |
CN109408225B (en) | Resource capacity expansion method, device, computer equipment and storage medium | |
CN115033459A (en) | CPU utilization monitoring method and device and storage medium | |
CN112673354B (en) | System state detection method, system state device and terminal equipment | |
KR20140111558A (en) | Optimizing method of mobile system | |
KR100763527B1 (en) | Method and device managing power in embedded linux system | |
CN115413337A (en) | Electronic device, system-on-chip and physical core allocation method | |
US20150106601A1 (en) | Method for Automatically Adapting Application to Suitable Multicore Processing Mode and Mobile Device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160406 |