The method and device of concurrent processing
Technical field
The present invention relates to Internet technical field, more particularly to a kind of method and device of concurrent processing.
Background technology
It is more and more using the user of internet with the development of Internet technology, therefore server side is frequently necessary to
Concurrent processing is carried out to tens thousand of or even hundreds thousand of requests in certain time, to meet the needs of each user terminal.
The mode of the concurrent processing of server side progress at present is generally:Added in the front end of the background server of processing request
Front-end server, the front-end server is responsible for receiving the request that each terminal is sent, and asks rooting by what is received in certain time
Each background server is transmitted to according to the pressure of current each background server to be handled, to reduce the load pressure of each background server
Power.
A person of good sense has found that prior art at least has problems with:
The mode of above-mentioned concurrent processing can only cause load sharing between each background server, but overall pressure is still
It is constant, once the quantity of the concurrent processing in face of larger number level, it is likely that the collapse of each background server is caused, is reduced
The efficiency of background process.
The content of the invention
In order to solve problem of the prior art, the embodiments of the invention provide a kind of method and device of concurrent processing.Institute
It is as follows to state technical scheme:
On the one hand, there is provided a kind of method of concurrent processing, methods described include:
The request that each terminal is sent is received in preset time period, the terminal of each terminal is comprised at least in the request
Mark;
Inquiry whether there is the terminal iidentification for needing priority treatment in the terminal iidentification of each terminal, and will inquire
The terminal iidentification for needing priority treatment corresponding to request be transmitted to background server;
Judge whether the terminal iidentification of remaining each terminal meets preparatory condition, and the preparatory condition will be met
Request is transmitted to each background server according to predetermined manner corresponding to terminal iidentification.
Optionally, whether the terminal iidentification for judging remaining each terminal meets preparatory condition, including:
Complementation computing is carried out to the terminal iidentification of remaining each terminal;
Remainder after the complementation computing is defined as the terminal iidentification for meeting preparatory condition for the terminal iidentification of designation number.
Optionally, the terminal iidentification to remaining each terminal carries out complementation computing, including:
Ask for Hash code value to the terminal iidentification of remaining each terminal, and by the terminal mark of remaining each terminal
Hash code value corresponding to knowledge carries out complementation budget.
Optionally, after whether the terminal iidentification for judging remaining each terminal meets preparatory condition, the side
Method also includes:
To not meeting that terminal corresponding to the terminal iidentification of the preparatory condition returns to the response message specified.
Optionally, before the request that each terminal is received in preset time period and is sent, methods described also includes:
The priority treatment list that background server is sent is received, the priority treatment list includes needing priority treatment
Terminal iidentification.
On the other hand, there is provided a kind of device of concurrent processing, described device include:
First receiving module, the request sent for receiving each terminal in preset time period, is at least wrapped in the request
Include the terminal iidentification of each terminal;
Enquiry module, for being inquired about in the terminal iidentification of each terminal with the presence or absence of the terminal mark for needing priority treatment
Know;
First forwarding module, for described needing corresponding to the terminal iidentification of priority treatment request to be transmitted to by what is inquired
Background server;
Judge module, for judging whether the terminal iidentification of remaining each terminal meets preparatory condition;
Second forwarding module, for will meet that request turns according to predetermined manner corresponding to the terminal iidentification of the preparatory condition
Issue each background server.
Optionally, the judge module, including:
Complementation arithmetic element, for carrying out complementation computing to the terminal iidentification of remaining each terminal;
Determining unit, for being defined as remainder after the complementation computing for the terminal iidentification of designation number to meet default bar
The terminal iidentification of part.
Optionally, the complementation arithmetic element is used for:
Ask for Hash code value to the terminal iidentification of remaining each terminal, and by the terminal mark of remaining each terminal
Hash code value corresponding to knowledge carries out complementation budget.
Optionally, described device also includes:
Respond module is sent, for not meeting that terminal corresponding to the terminal iidentification of the preparatory condition returns to the sound specified
Answer message.
Optionally, described device also includes:
Second receiving module, for receiving the priority treatment list of background server transmission, in the priority treatment list
Terminal iidentification including needing priority treatment.
The beneficial effect that technical scheme provided in an embodiment of the present invention is brought is:
By the way that the terminal received in preset time period is carried out into Screening Treatment in front-end server, it is preferential to select needs
Request corresponding to the terminal iidentification of processing and the corresponding request of terminal iidentification for meeting preparatory condition, and these requests are sent
To background server.The pressure of the request of background server processing is greatly reduced, improves the processing effect of background server
Rate.
Brief description of the drawings
Technical scheme in order to illustrate the embodiments of the present invention more clearly, make required in being described below to embodiment
Accompanying drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for
For those of ordinary skill in the art, on the premise of not paying creative work, other can also be obtained according to these accompanying drawings
Accompanying drawing.
Fig. 1 is the method flow diagram for the concurrent processing that the embodiment of the present invention one provides;
Fig. 2 is the method flow diagram for the concurrent processing that the embodiment of the present invention two provides;
Fig. 3 is the method flow diagram for the concurrent processing that the embodiment of the present invention three provides;
Fig. 4 is the apparatus structure schematic diagram for the concurrent processing that the embodiment of the present invention four provides.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to embodiment party of the present invention
Formula is described in further detail.
Embodiment one
The embodiments of the invention provide a kind of method of concurrent processing, referring to Fig. 1, method flow includes:
101:The request that each terminal is sent is received in preset time period, the terminal mark of each terminal is comprised at least in request
Know;
102:Inquiry whether there is the terminal iidentification for needing priority treatment in the terminal iidentification of each terminal, and will inquire
Need request corresponding to the terminal iidentification of priority treatment to be transmitted to background server;
103:Judge whether the terminal iidentification of remaining each terminal meets preparatory condition, and the terminal that will meet preparatory condition
Request is transmitted to each background server according to predetermined manner corresponding to mark.
The embodiment of the present invention by front-end server by the terminal received in preset time period carry out Screening Treatment,
Selecting needs request corresponding to the terminal iidentification of priority treatment and meets to ask corresponding to the terminal iidentification of preparatory condition, and will
These requests are sent to background server.The pressure of the request of background server processing is greatly reduced, backstage is improved and takes
The treatment effeciency of business device.
Embodiment two
The embodiments of the invention provide a kind of method of concurrent processing, referring to Fig. 2.
It should be noted that the embodiment of the present invention is applied in front-end server.
Wherein, this method flow includes:
201:The priority treatment list that background server is sent is received, priority treatment list includes needing priority treatment
Terminal iidentification.
Priority treatment list is pre-created in background server, will need not enter and judge that the terminal iidentification of handling process adds
Into the priority treatment list so that front-end server after matching and belonging to the terminal iidentification in the priority treatment list,
Request corresponding to the terminal iidentification that will match to is transmitted directly to background server and handled.
Wherein, the terminal iidentification preserved in priority treatment list can be terminal iidentification corresponding to default priority level;
Can also be the terminal iidentification for meeting certain condition, wherein the condition can be chosen related to the terminal iidentification by predetermined manner
Information, carry out the final terminal iidentification chosen to the condition that meets of calculating of preset algorithm.Priority treatment row are not limited herein
The determination mode of the terminal iidentification preserved in table.The process category of the terminal iidentification in priority treatment list is chosen in background server
In lightweight calculating process, the amount of calculation corresponding to the request of front end server-assignment is handled relative to background server, can be with
Ignore.
Background server can be with the content in the periodic maintenance priority treatment list, and by the preferential place after safeguarding each time
Reason list is periodically sent to front-end server by new information.Front-end server is after the new information is received, renewal
The priority treatment list that itself is preserved.Wherein, the new information can preserve each terminal mark in complete priority treatment list
Know;In addition, the new information can also only preserve the content updated every time and not preserve each in complete priority treatment list
Individual terminal iidentification, bandwidth availability ratio is improved to reduce the capacity of fresh information, such as:Certain terminal iidentification is deleted, increases certain terminal
Mark, changes the information such as certain terminal iidentification.
Further, background server priority treatment can also arrange according to corresponding to different business determines different business
Priority treatment list corresponding to table, wherein different business is made a distinction by mark.
202:The request that each terminal is sent is received in preset time period, the terminal mark of each terminal is comprised at least in request
Know.
Wherein, preset time period be able to can receive using millisecond as chronomere in certain millisecond period server
The request that each terminal of certain amount is sent.Such as:100 milliseconds.
Wherein, terminal iidentification can be Sessionid, i.e. session identification corresponding to each terminal;Can also be
Sessionid+Userid, i.e. session identification and user are identified.Wherein, each terminal can bedding and clothing when first logging into server
Device distribution one be engaged in uniquely in session identification corresponding to the terminal, it is each to be identified in follow-up request by the session identification
Individual terminal.
Optionally, when terminal iidentification is Sessionid mode, Userid can also be integrated with the Sessionid, with
More accurately confirm the identity of each terminal.
203:Inquiry whether there is the terminal iidentification for needing priority treatment in the terminal iidentification of each terminal, and will inquire
Need request corresponding to the terminal iidentification of priority treatment to be transmitted to background server.
Terminal iidentification in the request that each terminal received in preset time period is sent enters in priority treatment list
Row matching, request corresponding to the terminal iidentification matched can be let pass, be transmitted directly to background server and handled.
Optionally, background server is for request corresponding to the terminal iidentification of above-mentioned priority treatment, and without normal
Complex calculating process, and handling process corresponding to priority treatment can be directly performed, reduce the meter of background server
Calculation amount.
204:Judge whether the terminal iidentification of remaining each terminal meets preparatory condition, and the terminal that will meet preparatory condition
Request is transmitted to each background server according to predetermined manner corresponding to mark.
For please corresponding to the terminal iidentification that is not belonging in the terminal iidentification of each terminal in priority treatment list in this step
Ask and screened, most of request is removed, to reduce the pressure of each background server.Front-end server takes to backstage in this step
The request of business device forwarding is, it is necessary to carry out normal calculating process, to determine that the response to each request is handled.
Wherein, for whether meeting that the judgment mode of preparatory condition can be realized by following steps:
2041:Complementation computing is carried out to the terminal iidentification of remaining each terminal.
Wherein, terminal iidentification is subjected to complementation computings to 10, to obtain more than each terminal iidentification carried out after complementation computing
Number.
Optionally, when being not only numeral in the Sessionid or Sessionid+Userid in terminal iidentification, in addition to
When alphabetical, the Hash code value of each terminal iidentification can be tried to achieve by way of carrying out running Hash codes algorithm to terminal iidentification, is led to
A numeral corresponding to each terminal iidentification can be finally given by crossing the algorithm, and carry out complementation to the Hash code value of each terminal iidentification
Computing.
Therefore step 2041 can be specially:
Hash code value is asked for the terminal iidentification of remaining each terminal, and by corresponding to the terminal iidentification of remaining each terminal
Hash code value carries out complementation computing.
2042:Remainder after complementation computing is defined as the terminal mark for meeting preparatory condition for the terminal iidentification of designation number
Know.
Wherein, the quantity of designation number can be one or more, and wherein the quantity can be by configuring front-end server
Modify.The quantity of designation number is bigger, then it represents that the quantity of the request of removal is smaller.
Such as:Designation number is set as 0,5,9 three numerals, then belongs to three digital terminal iidentifications after complementation computing
Corresponding request can be cleared transmission to background server.
Wherein, the quantity of designation number is set as three, then the percentage for the request that can determine to let pass is 30%.Example
Such as:100,000 requests are received, now set the quantity of designation number as three, then has 30,000 requests and is cleared, 70,000
Individual request is rejected.
Accordingly, for meeting that the terminal iidentification of preparatory condition performs step 2043 in step 2042;Do not meet default bar
The terminal iidentification of part performs step 205.
2043:It will meet that request is transmitted to each background service according to predetermined manner corresponding to the terminal iidentification of preparatory condition
Device.
Wherein, predetermined manner the loading condition of each background server can be allocated according to.
205:To not meeting that terminal corresponding to the terminal iidentification of preparatory condition returns to the response message specified.
Wherein, the response message belongs to virtual null response message, you can after pre-setting the content of the response to participate in
Ask not having the content of the response message returned during result to terminal after platform server operation.Such as:You participate in activity not by
Choose.This mode can remove the request that most of terminal is sent, to reduce load pressure overall in background server.
Wherein, step 205 can directly perform after step 2042 is finished, between step 205 and step 2043 simultaneously
The not sequential relationship in limiting time.
The embodiment of the present invention by front-end server by the terminal received in preset time period carry out Screening Treatment,
Selecting needs request corresponding to the terminal iidentification of priority treatment and meets to ask corresponding to the terminal iidentification of preparatory condition, and will
These requests are sent to background server.The pressure of the request of background server processing is greatly reduced, backstage is improved and takes
The treatment effeciency of business device.
Embodiment three
The embodiments of the invention provide a kind of method of concurrent processing, referring to Fig. 3.
The method of concurrent processing is retouched exemplified by activity it should be noted that the embodiment of the present invention is killed by the website second
State.
Wherein, this method includes:
301:Front-end server receives the priority treatment list that background server is sent, and the priority treatment list includes excellent
The terminal iidentification of matter user.
Wherein, the terminal iidentification in priority treatment list can be by choosing high-quality user in user list.Choose
Mode can be the user that login times are more than preset times;Can also be the user that login time is more than preset time.
In this second kills activity, pre-set prize-winning planned number 100, wherein in advance choose 50 high-quality users, i.e., this
The second of 50 high-quality users kills request and directly can let pass by front-end server, and receives high-quality use in background server
The processing that the second kills computing need not be carried out after the request that family is sent, both prize winner can be identified as by terminal iidentification, into neck
Encourage flow.
302:The second that each terminal transmission is received in preset time period kills request, and the terminal of each terminal is comprised at least in request
Mark.
303:Inquiry whether there is the terminal iidentification of high-quality user in the terminal iidentification of each terminal, and excellent by what is inquired
Request is transmitted to background server corresponding to the terminal iidentification of matter user.
304:Complementation computing is carried out to the terminal iidentification of remaining each terminal.
305:The terminal iidentification that remainder after complementation computing is 0,5,9 is defined as the terminal iidentification for meeting preparatory condition.
306:By remainder after complementation computing be 0,5,9 terminal iidentification corresponding to request according to predetermined manner be transmitted to it is each after
Platform server.
307:Remainder is non-zero after to complementation computing, and terminal corresponding to 5,9 terminal iidentification returns to the response do not got the winning number in a bond and disappeared
Breath.
308:Remainder is request corresponding to 0,5,9 terminal iidentification after server receives complementation computing, and to above-mentioned request
Computing is carried out to determine remaining prize-winning planned number.
The embodiment of the present invention is in the website second kills activity, by will be received in front-end server in preset time period
Terminal carries out Screening Treatment, selects request corresponding to the terminal iidentification for the high-quality user for needing priority treatment and meets that complementation is transported
Remainder is non-zero after calculation, is asked corresponding to 5,9 terminal iidentification, and these requests are sent into background server.Greatly reduce
The pressure of the request of background server processing, improve the treatment effeciency of background server.
Example IV
The embodiments of the invention provide a kind of device of concurrent processing, and referring to Fig. 4, the device includes:
First receiving module 401, the request sent for receiving each terminal in preset time period, is comprised at least in request
The terminal iidentification of each terminal;
Enquiry module 402, for being inquired about in the terminal iidentification of each terminal with the presence or absence of the terminal mark for needing priority treatment
Know;
First forwarding module 403, for needing request corresponding to the terminal iidentification of priority treatment to be transmitted to by what is inquired
Background server;
Judge module 404, for judging whether the terminal iidentification of remaining each terminal meets preparatory condition;
Second forwarding module 405, for will meet that request turns according to predetermined manner corresponding to the terminal iidentification of preparatory condition
Issue each background server.
Wherein, judge module 404, including:
Complementation arithmetic element, for carrying out complementation computing to the terminal iidentification of remaining each terminal;
Determining unit, for remainder after complementation computing to be defined as meeting preparatory condition for the terminal iidentification of designation number
Terminal iidentification.
Wherein, complementation arithmetic element is used for:
Hash code value is asked for the terminal iidentification of remaining each terminal, and by corresponding to the terminal iidentification of remaining each terminal
Hash code value carries out complementation budget.
Wherein, device also includes:
Respond module 406 is sent, for not meeting that terminal corresponding to the terminal iidentification of preparatory condition returns to the sound specified
Answer message.
Wherein, device also includes:
Second receiving module 407, for receiving the priority treatment list of background server transmission, wrapped in priority treatment list
Including needs the terminal iidentification of priority treatment.
The embodiment of the present invention by front-end server by the terminal received in preset time period carry out Screening Treatment,
Selecting needs request corresponding to the terminal iidentification of priority treatment and meets to ask corresponding to the terminal iidentification of preparatory condition, and will
These requests are sent to background server.The pressure of the request of background server processing is greatly reduced, backstage is improved and takes
The treatment effeciency of business device.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
One of ordinary skill in the art will appreciate that hardware can be passed through by realizing all or part of step of above-described embodiment
To complete, by program the hardware of correlation can also be instructed to complete, described program can be stored in a kind of computer-readable
In storage medium, storage medium mentioned above can be read-only storage, disk or CD etc..
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc., it should be included in the scope of the protection.