CN107612844A - A kind of method for mitigating server pulse, server and client side - Google Patents

A kind of method for mitigating server pulse, server and client side Download PDF

Info

Publication number
CN107612844A
CN107612844A CN201710697478.8A CN201710697478A CN107612844A CN 107612844 A CN107612844 A CN 107612844A CN 201710697478 A CN201710697478 A CN 201710697478A CN 107612844 A CN107612844 A CN 107612844A
Authority
CN
China
Prior art keywords
moment
server
duration
request
client
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.)
Granted
Application number
CN201710697478.8A
Other languages
Chinese (zh)
Other versions
CN107612844B (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710697478.8A priority Critical patent/CN107612844B/en
Publication of CN107612844A publication Critical patent/CN107612844A/en
Application granted granted Critical
Publication of CN107612844B publication Critical patent/CN107612844B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiments of the invention provide a kind of method for mitigating server pulse, server and client side, is at least used for solving the technical problem for how mitigating server pulse existing for prior art.Methods described includes:The first moment for being likely to occur pulse is estimated, the multiple client of request, and the first duration of the processing pulse will be sent at first moment;At the second moment first duration is sent to multiple clients, so that the client determines to send the delay value of request based on first duration, the delay value that multiple clients determine is incomplete same, second moment is identical with first moment, or second moment is before first moment;Receive multiple clients since the 3rd moment to be delayed successively according to the delay value request of transmission, the 3rd moment is any time after the second moment.

Description

A kind of method for mitigating server pulse, server and client side
Technical field
The present invention relates to field of computer technology, more particularly to a kind of method for mitigating server pulse, server And client.
Background technology
Request amount generally has general, i.e. request amount most of time is in certain limit, so can be according to request The server of the custom install respective negative carrying capacity of amount.For example, in the business of certain live platform, request amount is generally at tens of thousands of times It is per second per second to 100,000 times, then it is 10 that can set load capacity6The servers of N/s ranks provides business.
However, server can also receive in a large amount of requests, such as above-mentioned example suddenly in a short time once in a while, certain is watched Equal request server disconnects even wheat in 1,000,000 live spectators' short time.A large amount of requests that so moment occurs are similar in pulse Signal, so server can be regarded as in such cases by pulse.
, can be with upgrade server if it is desired to allow server to bear more to ask, such as increased hardware cost and/or soft Part complexity is realized.But pulse just occurs once in a while after all, therefore part server resource is unrestrained in most cases Take.If not upgrade server, pulse may cause servers go down again.
Therefore, there is the technical problem for how mitigating server pulse in prior art.
The content of the invention
The embodiments of the invention provide a kind of method for mitigating server pulse, server and client side, at least use In the technical problem for solving how to mitigate server pulse existing for prior art.
In a first aspect, the invention provides it is a kind of mitigate server pulse method, applied to server, including:
The first moment for being likely to occur pulse is estimated, multiple clients of request will be sent at first moment End, and the first duration of the processing pulse;
First duration is sent to multiple clients at the second moment, so that the client is based on described first Duration determines to send the delay value of request, and the delay value that multiple clients determine is incomplete same, when described second Quarter is identical with first moment, or second moment is before first moment;
Multiple clients are received since the 3rd moment to be delayed successively according to the delay value request of transmission, it is described 3rd moment was any time after the second moment.
Optionally, the first moment for being likely to occur pulse is estimated, the more of request will be sent at first moment Individual client, and the first duration of the processing pulse, including:
, will be pre- after the 4th moment if sending the information for meeting preparatory condition to multiple client at the 4th moment If estimated at the time of length to be likely to occur first moment of the pulse;
The multiple client for receiving the information for meeting preparatory condition is estimated for that will be sent at first moment Multiple clients of request;
Using any duration as first duration for handling the pulse.
Optionally, using any duration as first duration for handling the pulse, including:
The load capacity of the server and the quantity of multiple clients are obtained, based on the load capacity and multiple described The quantity of client calculates the second duration;
Using second duration as first duration for handling the pulse.
Second aspect, the invention provides it is a kind of mitigate server pulse method, applied to client, including:
The first duration that the reception server is sent, the server estimate the first moment for being likely to occur pulse, institute State client and estimate one in will sending the multiple client of request at first moment for the server, described the The server a length of for the moment estimates the duration for handling the pulse;
Determine to send the delay value of request based on first duration, the delay value that multiple clients determine is not It is identical;
At the time of triggering sends request, enter line delay according to the delay value;
After delay terminates the request is sent to the server.
Optionally, determine to send the delay value of request based on first duration, including:
First duration is amplified;
The first duration after amplification is calculated using apple mobile device operation system ios random algorithms program, obtained Obtain a random number;
To the random number modulus, the mould of the random number is defined as the delay value.
The third aspect, the invention provides a kind of server, including:
Module is estimated, the first moment of pulse is likely to occur for estimating, will be sent at first moment please The multiple client asked, and the first duration of the processing pulse;
Sending module, for sending first duration to multiple clients at the second moment, so that the client End group determines to send the delay value of request, the incomplete phase of the delay value that multiple clients determine in first duration Together, second moment is identical with first moment, or second moment is before first moment;
Receiving module, it is delayed successively hair according to the delay value for receiving multiple clients since the 3rd moment The request sent, the 3rd moment are any time after the second moment.
Optionally, the module of estimating includes:
Moment estimates module, will if meeting the information of preparatory condition for being sent at the 4th moment to multiple client Estimated after 4th moment at the time of preset length to be likely to occur first moment of the pulse;
Client estimates module, for the multiple client for receiving the information for meeting preparatory condition to be estimated as in institute Multiple clients of request will be sent by stating for the first moment;
Duration estimates module, for using any duration as first duration for handling the pulse.
Optionally, the duration estimates module and is used to obtain the load capacity of the server and the number of multiple clients Amount, the second duration is calculated based on the quantity of the load capacity and multiple clients;Using second duration as processing institute State first duration of pulse.
Fourth aspect, the invention provides a kind of client, including:
Receiving module, the first duration sent for the reception server, the server, which is estimated, is likely to occur pulse The first moment, the client is that the server is estimated and will sent at first moment in the multiple client of request One, a length of server estimates the duration for handling the pulse when described first;
Determining module, for determining to send the delay value of request based on first duration, multiple clients determine The delay value it is incomplete same;
Time delay module, at the time of triggering sends request, entering line delay according to the delay value;
Sending module, for sending the request to the server after delay terminates.
Optionally, the determining module is used to be amplified first duration;Utilize apple mobile device operation system System ios random algorithms program is calculated the first duration after amplification, obtains a random number;, will to the random number modulus The mould of the random number is defined as the delay value.
5th aspect, the invention provides a kind of computer-readable recording medium, is stored thereon with computer program, the journey The step of any one of first aspect methods described is realized when sequence is executed by processor.
6th aspect, the invention provides a kind of computer-readable recording medium, is stored thereon with computer program, the journey The step of any one of second aspect methods described is realized when sequence is executed by processor.
7th aspect, the invention provides a kind of server, including memory, processor and storage are on a memory and can The computer program run on a processor, any one of first aspect methods described is realized during the computing device described program The step of.
Eighth aspect, the invention provides a kind of client, including memory, processor and storage are on a memory and can The computer program run on a processor, any one of second aspect methods described is realized during the computing device described program The step of.
Said one or multiple technical schemes in the embodiment of the present application, at least there is following one or more technology effects Fruit:
In the technical scheme of the embodiment of the present invention, when server estimates out be likely to occur pulse first first Carve, the multiple client of request, and the first duration of the processing pulse will be sent at first moment, then At the second moment before first moment, first duration is sent to the plurality of client in advance, so it is each described Client determines the delay value of transmission request based on first duration, and then each client sends what is asked from triggering At the moment, request is sent according to the respective delay value delay respectively, because the delay value of multiple clients is endless It is exactly the same, then it is also different that multiple clients send request opportunitys, so the server will since the 3rd moment land The request that multiple clients are sent is received in continued access, thus solves the technical problem for how mitigating server pulse, real Show multiple client timesharing and send request, and then pulse caused by scattered multiple client to the server, Thus reduce server load.
Brief description of the drawings
Fig. 1 is the method flow diagram that server side mitigates server pulse in the embodiment of the present invention;
Fig. 2 is a time shaft schematic diagram in the embodiment of the present invention;
Fig. 3 is the method flow diagram that client-side mitigates server pulse in the embodiment of the present invention;
Fig. 4 is a server architecture schematic diagram in the embodiment of the present invention;
Fig. 5 is a client terminal structure schematic diagram in the embodiment of the present invention;
Fig. 6 is another server architecture schematic diagram in the embodiment of the present invention;
Fig. 7 is another client terminal structure schematic diagram in the embodiment of the present invention.
Embodiment
The embodiments of the invention provide a kind of method for mitigating server pulse, server and client side, at least use In the technical problem for solving how to mitigate server pulse existing for prior art.
In order to solve the above-mentioned technical problem, technical scheme general thought provided by the invention is as follows:
In the technical scheme of the embodiment of the present invention, when server estimates out be likely to occur pulse first first Carve, the multiple client of request, and the first duration of the processing pulse will be sent at first moment, then At the second moment before first moment, first duration is sent to the plurality of client in advance, so it is each described Client determines the delay value of transmission request based on first duration, and then each client sends what is asked from triggering At the moment, request is sent according to the respective delay value delay respectively, because the delay value of multiple clients is endless It is exactly the same, then it is also different that multiple clients send request opportunitys, so the server will since the 3rd moment land The request that multiple clients are sent is received in continued access, thus solves the technical problem for how mitigating server pulse, real Show multiple client timesharing and send request, and then pulse caused by scattered multiple client to the server, Thus reduce server load.
Technical solution of the present invention is described in detail below by accompanying drawing and specific embodiment, it should be understood that the application Specific features in embodiment and embodiment are the detailed description to technical scheme, rather than to present techniques The restriction of scheme, in the case where not conflicting, the technical characteristic in the embodiment of the present application and embodiment can be mutually combined.
The terms "and/or", only a kind of incidence relation for describing affiliated partner, expression may have three kinds of passes System, for example, A and/or B, can be represented:Individualism A, while A and B be present, these three situations of individualism B.In addition, herein Middle character "/", it is a kind of relation of "or" to typically represent forward-backward correlation object.
First aspect present invention provides a kind of method for mitigating server pulse, applies in server side.It please join Fig. 1 is examined, is the method flow diagram that server side mitigates server pulse in the embodiment of the present invention.This method includes:
S101:The first moment for being likely to occur pulse is estimated, the multiple of request will be sent at first moment Client, and the first duration of the processing pulse;
S102:First duration is sent to multiple clients at the second moment, so that the client is based on institute State the first duration to determine to send the delay value of request, the delay value that multiple clients determine is incomplete same, described Second moment is identical with first moment, or second moment is before first moment;
S103:Received since the 3rd moment multiple clients according to the delay value be delayed successively transmission please Ask, the 3rd moment is any time after the second moment.
Specifically, before not yet there is pulse, in S101, server is in advance to being likely to occur pulse At the time of, the multiple client for producing pulse and the duration for handling pulse are estimated.Wherein, estimating to go out It is the first moment T1 at the time of existing pulse, estimates when a length of first duration t1 of processing pulse.
Specifically, for estimating the first moment T1 in one embodiment, some special occasion servers can receive A large amount of requests, such as 11 days 00 annual November:00 has a large number of users request purchase commodity, therefore when can pre-set default Carve, and then predetermined time is estimated as the first moment T1 by server.Or in another embodiment, server is to more After individual client issues some information, such as disconnection connects the notice or red packet notice of wheat, server can receive quickly largely please Ask, therefore server can also pre-set the information for meeting preparatory condition, and then if server has issued the default bar of satisfaction The information of part, then at the time of issuing the information or it will issue and be sometime estimated as the first moment T1 after the information moment. During specific implementation, those skilled in the art can be according to actual selection above two embodiment Or other embodiment estimates the first moment T1, the present invention is not particularly limited.
For estimating multiple client, in embodiments of the present invention, there is the client that the possibility of request is sent in T1 It can be estimated as one in multiple client.In one embodiment, can will be objective corresponding to all registered users The multiple client that request may be sent for the T1 moment is estimated at family end, such as in annual 11 days 00 November:00 any registered user Purchase commodity can all be can request that.In another embodiment, when the multiple client for sending pre-request can be estimated as into T1 The multiple client of request may be sent by carving, and pre-request is, for example, to purchase request or reservation request etc. in advance.In another embodiment In, the multiple client for receiving the information for meeting preparatory condition can also be estimated to multiple visitors that request may be sent for the T1 moment Family end, such as the company of reception wheat is disconnected to the visitor that the multiple client notified is estimated as the T1 moment and may send Switch Video stream and ask Family end.During specific implementation, those skilled in the art can be according to the above-mentioned several realities of actual selection Mode or other embodiment are applied to estimate multiple client, the present invention is not particularly limited.
In addition, server also further estimates out the first of the required consumption of request that the complete the plurality of client of processing is sent Duration t1.In one embodiment, the first duration t1 can be default duration, such as 3min.Or in another embodiment party In formula, it can also be estimated according to the actual quantity of multiple client.It is of the art general during specific implementation Logical technical staff can estimate the first duration t1, this hair according to the above-mentioned several embodiments of actual selection or other embodiment It is bright to be not particularly limited.
One specific example, server is at the T1 ' moment to 10 be currently accessed7Individual client, which have sent, disconnects Lian Maitong Know, so estimate the T1 moment after the T1 ' moment this 107Individual client can send request, i.e. server will at the T1 moment Bear 107Secondary request.And the load capacity of server is 106N/s, therefore handle 107It is secondary request with about when 10s.So clothes Business device is estimated will appear from 10 at the T1 moment7Secondary pulse, the client that request is sent at the T1 moment are specially to be currently accessed The 10 of server7Individual client, and estimate processing 107Secondary pulse needs 10s.
Next, in S102, at the second moment at moment T2, sent out to the multiple client that will send request estimated out Send the first duration t1.
Specifically, Fig. 2 is refer to, is a time shaft schematic diagram.T2 is before T1, i.e. server arteries and veins occurs estimating The first duration t1 is sent to client in advance before at the time of stamping press.Or, it is contemplated that actual conditions there may be network At the time of congestion and operation sluggishness etc. cause to actually occur pulse after tl, therefore can also be at the T1 moment to multiple Client sends the first duration t1, i.e. T2=T1 (not shown)s.
Client will determine a delay value t2 after the first duration t1 is received based on the first duration.Optional 0 < t2≤t1.Also, it is in embodiments of the present invention, Decentralized Impulse pressure, the delay value t2 that multiple client is determined is incomplete It is identical.Hereinafter how will determine that delay value t2 describes in detail to client, just repeat no more herein.Then, each Client is delayed according to respective delay value t2 since at the time of triggering sends request, at the end of delay, sent the requests to Server.
Next, in S103, server will receive asking for multiple client transmission successively since the 3rd moment T3 Ask.In embodiments of the present invention, it is any after being T2 at the time of T3 is that server receives the request that first delay is sent Moment.During specific implementation, if the T1 estimated is accurate, then T3=T1.But error in itself be present due to estimating, Therefore T3 may also be before T1, it is also possible to which after tl, the present invention is not particularly limited.
Because the delay value of multiple client is different, thus it is also different at the time of the delay end of each client, and then respectively Individual user end to server send it is also different at the time of request, therefore server at the time of receive the request of each client not yet Together.Asked so multiple client simultaneously or almost simultaneously can't be sent to client, pulse caused by client is just Thus it is spread out, so the pulse that server is subject to just alleviates.
In a kind of optional embodiment, server estimates the first moment, multiple client and first in the following way Duration.Estimated especially by following process:
, will be pre- after the 4th moment if sending the information for meeting preparatory condition to multiple client at the 4th moment If estimated at the time of length to be likely to occur first moment of the pulse;
The multiple client for receiving the information for meeting preparatory condition is estimated for that will be sent at first moment Multiple clients of request;
Using any duration as first duration for handling the pulse.
Specifically, rule of thumb, server soon may be by pulse after some information are sent to client Pressure.Such as server, to watching after certain live client sends and disconnect the even notice of wheat, watching the live client will The notice for connecting wheat based on the disconnection in a short time sends the request of Switch Video stream to server;Or server to some After the infrared notice of pocket transmission of chatting, the multiple client in chat group will be sent based on red packet notice server in a short time Rob the request of red packet.Therefore, in embodiments of the present invention, if server have sent to multiple client meets preparatory condition Information, then the plurality of client may send to server and ask, and then produce pulse.So in the embodiment of the present invention In, will be default after T4 if server have sent the information for meeting preparatory condition in the 4th moment T4 to multiple client T1 at the time of pulse is likely to occur at the time of length.
Specifically, the information for being full of preparatory condition is, for example, that even the notice of wheat, red packet notice or shopping second kill and opened for disconnection Dynamic notice etc., those skilled in the art can be not particularly limited with actual setting, the present invention.
As shown in Fig. 2 T4 is before T1.Due to being likely to form pulse after T4, therefore the embodiment of the present invention will Estimated after T4 at the time of preset duration Δ T as T1.Wherein, Δ T value can be according to being actually configured.For example, if User will send request by user end to server quickly after sending the information for meeting preparatory condition, then can set Δ T It is set to less value, such as 0.5s or 0.3s etc..One specific example, server are sent out to certain live multiple client is watched Send after disconnecting the even notice of wheat, because user only needs to click on " even wheat " key, client will send Switch Video to server The request of stream, therefore it is 0.1s that can set Δ T.Or if meet user's needs one after the information of preparatory condition sending The fixed time can just be sent by user end to server and be asked, then Δ T can be arranged to larger value, such as 2s or 3s Deng.One specific example, after server robs the notice that ticket starts to multiple client transmission, user needs " to rob by clicking on Ticket " key, fills in personal information and connection Third-party payment platform pays client after admission fee etc. operates and can just sent out to server The request of ticket booking is sent, therefore it is 3s that can now set Δ T.During specific implementation, common skill of the art Art personnel can be not particularly limited according to actual setting Δ T, the present invention.
If server have sent the information for meeting preparatory condition in T4 to multiple client, then server, which obtains, to be sent Meet T4 at the time of the information of preparatory condition, Δ T is then added on T4, and then obtain the first moment T1=T4+ Δ T.
Client due to receiving the information for meeting preparatory condition is likely to send to server in the future to ask, and causes Pulse, therefore in embodiments of the present invention, meet that the multiple client of preparatory condition is estimated as that may be produced in T1 by receiving The multiple client of raw pulse.
In addition, it will be appreciated by those skilled in the art that during specific implementation, if server at the T4 moment to multiple Client sends the information for meeting preparatory condition, can first estimate out T1 and estimate multiple client again, also can first estimate client T1 is estimated again, and the present invention is not particularly limited to sequencing.
Further, in embodiments of the present invention, server is using any duration as first required for processing pulse Duration.In one embodiment, server can pre-set a static default duration, such as 3s, and then this is default Duration is estimated as the first duration t1.Or in another embodiment, server can also dynamically be estimated according to actual conditions The first duration t1 is counted, for example, multiple client specifically has 106When individual, t1=1s is estimated, multiple client specifically has 107When individual, T1=10s is estimated, the present invention is not particularly limited.
Found out by above-described embodiment, if the information for meeting preparatory condition is sent to multiple client at the T4 moment, by T4+ Δs T estimates T1, and then meets that the multiple client of the information of preparatory condition sends the first duration in T1 Forward receiving T1, the plurality of client timesharing is set to send request, thus avoid that server sends after the information for meeting preparatory condition will be by To the technique effect of pulse, for example, avoid server notice viewing certain large-scale live spectators disconnect after even wheat by Powerful pulse.
With reference to above-described embodiment, in a kind of optional embodiment, any duration is estimated as the of processing pulse One duration t1, further it can be realized by following process:
The load capacity of the server and the quantity of multiple clients are obtained, based on the load capacity and multiple described The quantity of client calculates the second duration;
Using second duration as first duration for handling the pulse.
Specifically, after the information for meeting preparatory condition is sent to multiple client, the maximum situation of request amount is should Multiple client all sends to server and asked.In other words, the largest request amount that server is likely to be received is equal to multiple The quantity of client.Therefore, in embodiments of the present invention, the duration for handling largest request amount is estimated as the first duration t1.
Specifically, server obtains the quantity of load capacity and multiple client, but based on load capacity and client Quantity calculates the second duration, and the second duration then is estimated as into the first duration.The load capacity M of server represents that server is per second The quantity of request, unit N/s can be handled.The quantity of multiple client is represented with maxRequest, is passed through following equation (1) Calculate the duration of processing largest request amount, i.e. the second duration t3.
T3=maxRequest/M,
Wherein, t3 units are s.
Then, t1=t3 is taken, thus estimates t1.
Seen from the above description, because client is to determine delay value t2 based on t1, and multiple client determines t2 not It is identical, therefore the duration t3 for handling largest request amount is estimated as t1, can maximumlly Decentralized Impulse pressure, and then most Bigization ground reduces the pressure that server is subject to.
Second aspect of the present invention additionally provides a kind of method for mitigating server pulse, applies in client-side.By It is similar in the method performed by each client, therefore be introduced below by taking wherein any one client as an example.It please join Fig. 3 is examined, mitigates the method flow diagram of server pulse for client-side.This method includes:
S201:The first duration that the reception server is sent, when the server estimates be likely to occur pulse first To carve, the client estimates one in will sending the multiple client of request at first moment for the server, A length of server estimates the duration for handling the pulse when described first;
S202:Determine to send the delay value of request based on first duration, multiple the described of clients determination prolong Duration is incomplete same;
S203:At the time of triggering sends request, enter line delay according to the delay value;
S204:After delay terminates the request is sent to the server.
Specifically, in S201, the first duration t1 of client the reception server transmission.
Then, in S202, determine to send the delay value t2 of request based on the first duration t1.Specifically, in the present invention In embodiment, client is particular by decentralized algorithm computation delay value t2.The decentralized algorithm that the application can use includes one As decentralized algorithm, and in general decentralized algorithm has been disclosed in the prior art, therefore this is just no longer described in detail.
During specific implementation, multiple client performs delay value t2 that decentralized algorithm draws by incomplete phase respectively Together.As an example it is assumed that the first duration t1 is 10s, multiple client specifically has 107Individual client, then assuming that wherein 106It is individual The t2=0s that client determines, in addition 106The t2=1s that individual client determines, in addition 106The t2=2s that individual client determines, separately Outer 106The t2=3s that individual client determines, in addition 106The t2=4s that individual client determines, in addition 106The t2 that individual client determines =5s, in addition 106The t2=6s that individual client determines, in addition 106The t2=7s that individual client determines, in addition 106Individual client is true Fixed t2=8s, in addition 106The t2=9s that individual client determines.
Then, in S203, since at the time of triggering sends request, client enters line delay according to delay value.Specifically For, the triggering that multiple client sends request can be unified, such as receive the 1s after disconnecting even wheat notice;It is or every The triggering that individual client sends request can also be independent, such as triggering of specific keys etc. is clicked on by user, the present invention It is not particularly limited.Wherein, first client for sending request, it is the 3rd moment T3 that it, which is sent at the time of request,.
When the triggering of client acquisition transmission request, current main thread function dispatch_get_main_queue is obtained, Then delay value t2 is packaged as a delay time τ using dispatch_time functions, then using dispatch_after Delay time τ is passed to main thread dispatch_get_main_queue by function, is achieved in being delayed.
Finally, in S204, after delay terminates, user end to server sends request.
Continue to use it is above-mentioned in example for, it is assumed that 107The triggering that individual client sends request is unified for T3, then according to each The delay value of individual client, wherein 106Individual client will send to server in T3 and ask, and in addition 106Individual client will be in T3+ 1s sends to server and asked, and in addition 106Individual client will send to server in T3+2s and ask, and in addition 106Individual client will Send and ask to server in T3+3s, in addition 106Individual client will send to server in T3+4s and ask, and in addition 106Individual client End will send to server in T3+5s and ask, and in addition 106Individual client will send to server in T3+6s and ask, and in addition 106It is individual Client will send to server in T3+7s and ask, and in addition 106Individual client will send to server in T3+8s and ask, in addition 106Individual client will send to server in T3+9s and ask.It can be seen that thus just pulse is spread out.
Corresponding, server will receive 10 in T36Secondary request, other 10 are received again in T3+1s6Secondary request, in T3+2s Other 10 are received again6Secondary request, other 10 are received again in T3+3s6Secondary request, other 10 are received again in T3+4s6It is secondary to ask Ask, other 10 are received again in T3+5s6Secondary request, other 10 are received again in T3+6s6Secondary request, received again in addition in T3+7s 106Secondary request, other 10 are received again in T3+8s6Secondary request, other 10 are received again in T3+9s6Secondary request.Due to service The request amount of device reception per second is no more than the load capacity 10 of server6N/s, 10 were received compared to one second in the prior art7Secondary Pulse, it is seen that the pulse that server is subject to is reduced, therefore server is not easy to paralyse, and does not also have increase volume Outer hardware and software.
Further, in order that the delay value t2 of multiple client determination is more uniform, centralization, such as 10 are avoided7Individual visitor 9 × 10 in the end of family6The t2=0s that individual client determines, remaining 106The t2=1s that individual client determines, as a kind of optional real Example is applied, determines that the delay value t2 for sending request can be realized by following process based on the first duration t1:
First duration is amplified;
The first duration after amplification is calculated using apple mobile device operation system ios random algorithms program, obtained Obtain a random number;
To the random number modulus, the mould of the random number is defined as the delay value.
Specifically, because the first duration t1 order of magnitude is the second, therefore t1 is typically less number, is calculated to improve Accuracy, Linear Amplifer is carried out to t1 first.During specific implementation, can by 100 times, 200 times of t1 Linear Amplifers or 150 times etc., the present invention is not particularly limited.Then, apple mobile device operation system ios random algorithm program is called, will T1 after amplification inputs the random algorithm program and calculated, and output obtains a random number.Finally, the random number of output is taken Mould.Due to the property of ios system random algorithms, the mold of random number is any integer in 0 to t1.For example, t1=10, will T1=10 inputs ios system random algorithm programs, to that will obtain 0,1,2,3,4,5,6,7,8 or 9 after the random number modulus of output. Finally, the mould of random number is defined as delay value t2.
Because the random number that ios system random algorithms carry can substantially keep comparing in hundreds of thousands even up to ten million times Impartial distribution, therefore to perform ios systems random algorithm acquisition random number respectively relatively just more balanced when multiple client, therefore And the delay value t2 finally determined is more uniform, centralization is not easy.
Based on the same inventive concept of the method for mitigating server pulse with server side in previous embodiment, this hair The bright third aspect also provides a kind of server, as shown in figure 4, including:
Module 101 is estimated, the first moment of pulse is likely to occur for estimating, will be sent at first moment The multiple client of request, and the first duration of the processing pulse;
Sending module 102, for sending first duration to multiple clients at the second moment, so that the visitor Family end group sends the delay value of request in first duration determination, and the delay value that multiple clients determine is incomplete Identical, second moment is identical with first moment, or second moment is before first moment;
Receiving module 103, prolong successively according to the delay value for receiving multiple clients since the 3rd moment When the request that sends, the 3rd moment is any time after the second moment.
Further, estimating module 101 includes:
Moment estimates module, will if meeting the information of preparatory condition for being sent at the 4th moment to multiple client Estimated after 4th moment at the time of preset length to be likely to occur first moment of the pulse;
Client estimates module, for the multiple client for receiving the information for meeting preparatory condition to be estimated as in institute Multiple clients of request will be sent by stating for the first moment;
Duration estimates module, for using any duration as first duration for handling the pulse.
Further, duration estimates module and is used to obtain the load capacity of the server and the number of multiple clients Amount, the second duration is calculated based on the quantity of the load capacity and multiple clients;Second duration is estimated as processing First duration of the pulse.
Server side in earlier figures 1- Fig. 2 embodiments mitigate the method for server pulse various change mode and Instantiation is equally applicable to the server of the present embodiment, passes through the foregoing method for mitigating server pulse to server side Detailed description, those skilled in the art are clear that the implementation of server in the present embodiment, so in order to say Bright book it is succinct, will not be described in detail herein.
Based on the same inventive concept of the method for mitigating server pulse with client-side in previous embodiment, this hair Bright fourth aspect also provides a kind of client, as shown in figure 5, including:
Receiving module 201, the first duration sent for the reception server, the server, which is estimated, is likely to occur pulse pressure At first moment of power, the client is estimated for the server will send the multiple client of request at first moment In one, a length of server estimates the duration for handling the pulse when described first;
Determining module 202, for determining to send the delay value of request based on first duration, multiple clients are true The fixed delay value is incomplete same;
Time delay module 203, at the time of triggering sends request, entering line delay according to the delay value;
Sending module 204, for sending the request to the server after delay terminates.
Further, determining module 202 is used to be amplified first duration;Utilize apple mobile device operation system Ios random algorithms program is calculated the first duration after amplification, obtains a random number;To the random number modulus, by institute The mould for stating random number is defined as the delay value.
Client-side in the embodiment of earlier figures 3 mitigates the various change mode of the method for server pulse and specific Example is equally applicable to the client of the present embodiment, passes through the detailed of the foregoing method for mitigating server pulse to client-side Thin description, those skilled in the art are clear that the implementation of client in the present embodiment, so for specification It is succinct, will not be described in detail herein.
Based on the same inventive concept of the method for mitigating server pulse with server side in previous embodiment, this hair It is bright that a kind of computer-readable recording medium is also provided, computer program is stored thereon with, the program is realized when being executed by processor Server side described previously mitigates the step of either method of the method for server pulse.
Based on the same inventive concept of the method for mitigating server pulse with client-side in previous embodiment, this hair It is bright that a kind of computer-readable recording medium is also provided, computer program is stored thereon with, the program is realized when being executed by processor Client-side described previously mitigates the step of either method of the method for server pulse.
Based on the same inventive concept of the method for mitigating server pulse with server side in previous embodiment, this hair It is bright that a kind of server is also provided, as shown in fig. 6, including memory 304, processor 302 and being stored on memory 304 and can be The computer program run on processor, the processor 302 realize that server side described previously mitigates when performing described program The step of method either method of server pulse.
Wherein, in figure 6, bus architecture (being represented with bus 300), bus 300 can include any number of interconnection Bus and bridge, bus 300 deposited what the one or more processors including being represented by processor 302 and memory 304 represented The various circuits of reservoir link together.Bus 300 can also will ancillary equipment, voltage-stablizer and management circuit etc. it Various other circuits of class link together, and these are all it is known in the art, therefore, no longer being carried out further to it herein Description.EBI 306 provides interface between bus 300 and receiver 301 and transmitter 303.Receiver 301 and transmitter 303 can be same element, i.e. transceiver, there is provided for the unit to be communicated over a transmission medium with various other devices.
Processor 302 is responsible for bus 300 and common processing, and memory 304 can be used to store processor 302 perform operate when used data.
Server side in earlier figures 1- Fig. 2 embodiments mitigate the method for server pulse various change mode and Instantiation is equally applicable to the server of the present embodiment, passes through the foregoing method for mitigating server pulse to server side Detailed description, those skilled in the art are clear that the implementation of server in the present embodiment, so in order to say Bright book it is succinct, will not be described in detail herein.
Based on the same inventive concept of the method for mitigating server pulse with client-side in previous embodiment, this hair It is bright that a kind of client is also provided, as shown in fig. 7, comprises memory 404, processor 402 and being stored on memory 404 and can be The computer program run on processor, the processor 402 realize that client-side described previously mitigates when performing described program The step of either method of the method for server pulse.
Wherein, in the figure 7, bus architecture (being represented with bus 400), bus 400 can include any number of interconnection Bus and bridge, bus 400 deposited what the one or more processors including being represented by processor 402 and memory 404 represented The various circuits of reservoir link together.Bus 400 can also will ancillary equipment, voltage-stablizer and management circuit etc. it Various other circuits of class link together, and these are all it is known in the art, therefore, no longer being carried out further to it herein Description.EBI 406 provides interface between bus 400 and receiver 401 and transmitter 403.Receiver 401 and transmitter 403 can be same element, i.e. transceiver, there is provided for the unit to be communicated over a transmission medium with various other devices.
Processor 402 is responsible for bus 400 and common processing, and memory 404 can be used to store processor 402 perform operate when used data.
Client-side in the embodiment of earlier figures 3 mitigates the various change mode of the method for server pulse and specific Example is equally applicable to the client of the present embodiment, passes through the detailed of the foregoing method for mitigating server pulse to client-side Thin description, those skilled in the art are clear that the implementation of client in the present embodiment, so for specification It is succinct, will not be described in detail herein.
Said one or multiple technical schemes in the embodiment of the present application, at least there is following one or more technology effects Fruit:
In the technical scheme of the embodiment of the present invention, when server estimates out be likely to occur pulse first first Carve, the multiple client of request, and the first duration of the processing pulse will be sent at first moment, then At the second moment before first moment, first duration is sent to the plurality of client in advance, so it is each described Client determines the delay value of transmission request based on first duration, and then each client sends what is asked from triggering At the moment, request is sent according to the respective delay value delay respectively, because the delay value of multiple clients is endless It is exactly the same, then it is also different that multiple clients send request opportunitys, so the server will since the 3rd moment land The request that multiple clients are sent is received in continued access, thus solves the technical problem for how mitigating server pulse, real Show multiple client timesharing and send request, and then pulse caused by scattered multiple client to the server, Thus reduce server load.
It should be understood by those skilled in the art that, embodiments of the invention can be provided as method, system or computer program Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware Apply the form of example.Moreover, the present invention can use the computer for wherein including computer usable program code in one or more The computer program production that usable storage medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) The form of product.
The present invention is the flow with reference to method according to embodiments of the present invention, equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real The device for the function of being specified in present one flow of flow chart or one square frame of multiple flows and/or block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or The function of being specified in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function of being specified in individual square frame or multiple square frames.
Obviously, those skilled in the art can carry out the essence of various changes and modification without departing from the present invention to the present invention God and scope.So, if these modifications and variations of the present invention belong to the scope of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to comprising including these changes and modification.

Claims (10)

  1. A kind of 1. method for mitigating server pulse, applied to server, it is characterised in that including:
    The first moment for being likely to occur pulse is estimated, the multiple client of request will be sent at first moment, with And the first duration of the processing pulse;
    First duration is sent to multiple clients at the second moment, so that the client is based on first duration It is determined that sending the delay value of request, the delay value that multiple clients determine is incomplete same, second moment with First moment is identical, or second moment is before first moment;
    Receive multiple clients since the 3rd moment to be delayed successively according to the delay value request of transmission, the described 3rd Moment is any time after the second moment.
  2. 2. the method as described in claim 1, it is characterised in that the first moment for being likely to occur pulse is estimated, described First moment will send the multiple client of request, and the first duration of the processing pulse, including:
    If sending the information for meeting preparatory condition to multiple client at the 4th moment, by default length after the 4th moment Estimated at the time of spending to be likely to occur first moment of the pulse;
    The multiple client for receiving the information for meeting preparatory condition is estimated for request will be sent at first moment Multiple clients;
    Using any duration as first duration for handling the pulse.
  3. A kind of 3. method for mitigating server pulse, applied to client, it is characterised in that including:
    The first duration that the reception server is sent, the server estimate the first moment for being likely to occur pulse, the visitor Family end is that the server estimates one in will sending the multiple client of request at first moment, when described first A length of server estimates the duration for handling the pulse;
    Determine to send the delay value of request based on first duration, the delay value that multiple clients determine is incomplete It is identical;
    At the time of triggering sends request, enter line delay according to the delay value;
    After delay terminates the request is sent to the server.
  4. 4. method as claimed in claim 3, it is characterised in that determine to send the delay value of request based on first duration, Including:
    First duration is amplified;
    The first duration after amplification is calculated using apple mobile device operation system ios random algorithms program, obtains one Random number;
    To the random number modulus, the mould of the random number is defined as the delay value.
  5. A kind of 5. server, it is characterised in that including:
    Module is estimated, the first moment of pulse is likely to occur for estimating, request will be sent at first moment Multiple client, and the first duration of the processing pulse;
    Sending module, for sending first duration to multiple clients at the second moment, so that client's end group Determining to send the delay value of request in first duration, the delay value that multiple clients determine is incomplete same, Second moment is identical with first moment, or second moment is before first moment;
    Receiving module, it is delayed successively transmission according to the delay value for receiving multiple clients since the 3rd moment Request, the 3rd moment are any time after the second moment.
  6. A kind of 6. client, it is characterised in that including:
    Receiving module, the first duration sent for the reception server, the server, which is estimated, is likely to occur the of pulse One moment, the client are that the server estimates will be sent at first moment in the multiple client of request one Individual, a length of server estimates the duration for handling the pulse when described first;
    Determining module, for determining to send the delay value of request, the institute that multiple clients determine based on first duration It is incomplete same to state delay value;
    Time delay module, at the time of triggering sends request, entering line delay according to the delay value;
    Sending module, for sending the request to the server after delay terminates.
  7. 7. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that the program is held by processor The step of any one of claim 1 or 2 methods described is realized during row.
  8. 8. a kind of computer-readable recording medium, is stored thereon with computer program, it is characterised in that the program is held by processor The step of any one of claim 3 or 4 methods described is realized during row.
  9. 9. a kind of server, including memory, processor and storage are on a memory and the computer that can run on a processor Program, it is characterised in that the step of any one of claim 1 or 2 methods described is realized during the computing device described program.
  10. 10. a kind of client, including memory, processor and storage are on a memory and the computer that can run on a processor Program, it is characterised in that the step of any one of claim 3 or 4 methods described is realized during the computing device described program.
CN201710697478.8A 2017-08-15 2017-08-15 Method for relieving server pulse pressure, server and client Active CN107612844B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710697478.8A CN107612844B (en) 2017-08-15 2017-08-15 Method for relieving server pulse pressure, server and client

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710697478.8A CN107612844B (en) 2017-08-15 2017-08-15 Method for relieving server pulse pressure, server and client

Publications (2)

Publication Number Publication Date
CN107612844A true CN107612844A (en) 2018-01-19
CN107612844B CN107612844B (en) 2020-08-04

Family

ID=61065463

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710697478.8A Active CN107612844B (en) 2017-08-15 2017-08-15 Method for relieving server pulse pressure, server and client

Country Status (1)

Country Link
CN (1) CN107612844B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111131475A (en) * 2019-12-27 2020-05-08 Oppo广东移动通信有限公司 Data synchronization method and device and terminal equipment
CN111935536A (en) * 2020-07-28 2020-11-13 北京达佳互联信息技术有限公司 Live broadcast room request response method, device, equipment and storage medium
CN113467792A (en) * 2021-06-28 2021-10-01 北京梧桐车联科技有限责任公司 Updating method, device and system of installation package
CN113596126A (en) * 2021-07-20 2021-11-02 中国联合网络通信集团有限公司 Service providing method, server, client and device
CN113660171A (en) * 2021-08-10 2021-11-16 建信金融科技有限责任公司 Flow control method and system for terminal data acquisition, server and client
CN113839809A (en) * 2021-08-26 2021-12-24 上海探寻信息技术有限公司 Method, equipment and system for upgrading server
CN114827281A (en) * 2022-03-10 2022-07-29 北京百度网讯科技有限公司 Method, system and device for sending and receiving network request

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101795224A (en) * 2009-01-20 2010-08-04 株式会社日立制作所 Congestion control system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101795224A (en) * 2009-01-20 2010-08-04 株式会社日立制作所 Congestion control system

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111131475A (en) * 2019-12-27 2020-05-08 Oppo广东移动通信有限公司 Data synchronization method and device and terminal equipment
CN111935536A (en) * 2020-07-28 2020-11-13 北京达佳互联信息技术有限公司 Live broadcast room request response method, device, equipment and storage medium
CN111935536B (en) * 2020-07-28 2022-07-08 北京达佳互联信息技术有限公司 Live broadcast room request response method, device, equipment and storage medium
CN113467792A (en) * 2021-06-28 2021-10-01 北京梧桐车联科技有限责任公司 Updating method, device and system of installation package
CN113596126A (en) * 2021-07-20 2021-11-02 中国联合网络通信集团有限公司 Service providing method, server, client and device
CN113660171A (en) * 2021-08-10 2021-11-16 建信金融科技有限责任公司 Flow control method and system for terminal data acquisition, server and client
CN113660171B (en) * 2021-08-10 2023-05-26 建信金融科技有限责任公司 Flow control method and system for terminal data acquisition, server side and client side
CN113839809A (en) * 2021-08-26 2021-12-24 上海探寻信息技术有限公司 Method, equipment and system for upgrading server
CN114827281A (en) * 2022-03-10 2022-07-29 北京百度网讯科技有限公司 Method, system and device for sending and receiving network request
CN114827281B (en) * 2022-03-10 2023-09-29 北京百度网讯科技有限公司 Method, system and device for sending and receiving network request

Also Published As

Publication number Publication date
CN107612844B (en) 2020-08-04

Similar Documents

Publication Publication Date Title
CN107612844A (en) A kind of method for mitigating server pulse, server and client side
CN106454437B (en) A kind of streaming media service rate prediction method and device
CN106470133A (en) System pressure method of testing and device
CN108595448B (en) Information pushing method and device
CN105303410B (en) Virtual article sharing method and device
US11588890B2 (en) System, method and apparatus having a redundant cluster for processing data
CN112311597B (en) Message pushing method and device
CN105302925A (en) Method and device for pushing voice search data
CN108737486A (en) Information-pushing method and device
CN108174242A (en) Live data multiplexing method, device, storage medium and equipment
CN111475392B (en) Method, device, electronic equipment and computer readable medium for generating prediction information
CN110347973B (en) Method and device for generating information
CN113824689B (en) Edge computing network, data transmission method, device, equipment and storage medium
CN109087107A (en) Method for real-time monitoring, system and electronic equipment based on distributed memory database
CN113490062A (en) Video barrage sorting method and device, server and storage medium
CN112884408A (en) Method and device for delivering articles out of warehouse, electronic equipment and computer readable medium
WO2020078049A1 (en) User information processing method and device, server, and readable medium
Gue et al. Predicting departure times in multi-stage queueing systems
CN111291957A (en) Method and device for generating customer service scheduling information, electronic equipment and storage medium
CN114679596B (en) Interaction method and device based on game live broadcast, electronic equipment and storage medium
CN115589391B (en) Instant messaging processing method, device and equipment based on block chain and storage medium
CN115134639B (en) Video gear determining method, device, server, storage medium and system
CN117131167A (en) Method and device for predicting queuing time of online customer service consultation
CN113392011A (en) Link segmentation performance testing method and device
CN115334321A (en) Method and device for acquiring access heat of video stream, electronic equipment and medium

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