Invention content
This specification one or more embodiment describes a kind of processing method and processing device of network request, can reduce clothes
The resource overhead of business device.
In a first aspect, a kind of processing method of network request is provided, including:
Server receives the network request of client;
For the network request, corresponding goal task is created;
Task queue is added in the goal task, the task queue includes one or more tasks;
It obtains the quantity of the task in the task queue and executes duration;
According to the quantity and the execution duration, the stand-by period of the goal task is determined;
To the client returning response as a result, and executing the task in the task queue;The response results include
The stand-by period;
Receive the inquiry request that the client is sent according to the stand-by period;The inquiry request is used to indicate described
Server inquires whether the goal task executes completion;
Query result is returned to the client.
Second aspect provides a kind of processing method of network request, including:
User end to server sends network request;
It receives the server and is creating corresponding goal task for the network request, and the goal task is added
Enter the response results returned after task queue;The response results include the stand-by period;The stand-by period is by the service
Device is determined according to the quantity and execution duration of the task in the task queue;
According to the stand-by period, inquiry request is sent;The inquiry request is used to indicate described in the server inquiry
Whether goal task executes completion;
Receive the query result that the server returns.
The third aspect provides a kind of processing method of network request, including:
Server receives the network request of client;
For the network request, corresponding goal task is created;
Task queue is added in the goal task, the task queue includes one or more tasks;
To the client returning response as a result, and executing the task in the task queue;
Receive the inquiry request that the client is sent;
Judge whether the goal task is not carried out;
If be not carried out, judge whether the goal task meets execution condition;
If meeting the execution condition, the goal task is executed;
If the goal task runs succeeded, the implementing result of the goal task is returned to the client.
Fourth aspect provides a kind of processing method of network request, including:
User end to server sends network request;
It receives the server and is creating corresponding goal task for the network request, and the goal task is added
Enter the response results returned after task queue;
Send inquiry request;The inquiry request is used to indicate the server and inquires whether the goal task has executed
At, and be used to indicate the server and execute the target times when the inquiry goal task is not carried out and meets execution condition
Business;
Receive the query result that the server returns.
5th aspect, provides a kind of processing unit of network request, including:
Receiving unit, the network request for receiving client;
Creating unit, the network request for being received for the receiving unit, creates corresponding goal task;
Unit is added, task queue, the task team is added in the goal task for creating the creating unit
Row include one or more tasks;
Acquiring unit, the quantity for obtaining the task in the task queue and execution duration;
Determination unit, the quantity for being obtained according to the acquiring unit and the execution duration, described in determination
The stand-by period of goal task;
Transmission unit is used for the client returning response result;The response results include the stand-by period;
Execution unit, for executing the task in the task queue;
The receiving unit is additionally operable to receive the inquiry request that the client is sent according to the stand-by period;It is described
Inquiry request is used to indicate described device and inquires whether the goal task executes completion;
The transmission unit is additionally operable to return to query result to the client.
6th aspect, provides a kind of processing unit of network request, including:
Transmission unit, for sending network request to server;
Receiving unit is creating corresponding goal task for receiving the server for the network request, and will
The response results returned after task queue are added in the goal task;The response results include the stand-by period;When the waiting
Between be by the server according to the quantity of the task in the task queue and execute duration determine;
The transmission unit is additionally operable to, according to the stand-by period, send inquiry request;The inquiry request is used to indicate
The server inquires whether the goal task executes completion;
The receiving unit is additionally operable to receive the query result that the server returns.
7th aspect, provides a kind of processing unit of network request, including:
Receiving unit, the network request for receiving client;
Creating unit, the network request for being received for the receiving unit, creates corresponding goal task;
Unit is added, task queue, the task team is added in the goal task for creating the creating unit
Row include one or more tasks;
Transmission unit, for the client returning response as a result, and executing the task in the task queue;
The receiving unit is additionally operable to receive the inquiry request that the client is sent;
Judging unit, for judging whether the goal task is not carried out;
The judging unit judges whether the goal task meets execution condition if being additionally operable to be not carried out;
Execution unit executes the goal task if meeting the execution condition for judging unit judgement;
The transmission unit runs succeeded if being additionally operable to the goal task, and the mesh is returned to the client
The implementing result of mark task.
Eighth aspect provides a kind of processing unit of network request, including:
Transmission unit, for sending network request to server;
Receiving unit is creating corresponding goal task for receiving the server for the network request, and will
The response results returned after task queue are added in the goal task;
The transmission unit is additionally operable to send inquiry request;The inquiry request is used to indicate server inquiry institute
It states whether goal task executes completion, and is used to indicate the server and is not carried out in the inquiry goal task and meets execution
The goal task is executed when condition;
The receiving unit is additionally operable to receive the query result that the server returns.
The processing method and processing device for the network request that this specification one or more embodiment provides, server receive client
The network request at end.Corresponding goal task is created for the network request.Task queue is added in goal task.Acquisition task
The quantity and execution duration of task in queue, according to the quantity and execute duration, determine the stand-by period of goal task.
Include the response results of stand-by period to client return, and executes the task in task queue.Client is received according to waiting
What the time sent is used to inquire the inquiry request whether goal task executes completion.Query result is returned to client.As a result, may be used
To reduce the resource overhead of server.
Specific implementation mode
Below in conjunction with the accompanying drawings, the scheme provided this specification is described.
The processing method for the network request that this specification provides can be applied in scene as shown in Figure 1.In Fig. 1, visitor
Family end may include browser or apply (Application, APP), and the browser or APP can send net to server
Network is asked.Server can be directed to the network request received and create corresponding task, and task queue is added in the task of establishment.It
Afterwards, the quantity and execution time that server can be according to the task in task queue, determine the stand-by period of the task.It will be true
The fixed stand-by period returns to client, and executes the task in task queue.To which client is according to waiting time, to clothes
Business device sends inquiry request.Server inquires the executive condition of above-mentioned task, and query result is returned to client.It needs to illustrate
It is that the mode that client sends inquiry request according to the stand-by period can increase server and open to avoid frequent transmission inquiry request
The problem of pin.
It should be noted that the task queue in Fig. 1 can have corresponding state machine.The state machine is used for logger task
The task status of task in queue.Specifically, can be when task queue be added in a certain task, init state machine
In the task task status.Such as, it is initialized as being not carried out (or waiting pending).It, can be with after the completion of above-mentioned task execution
Update the task status of the task in state machine.Such as, the implementing result of the task can be updated to.In addition, the server in Fig. 1
Can be specifically that the task in task queue is executed by execution machine.Such as, execution machine can constantly take preceding N from task queue
A task simultaneously executes.
In addition it is also necessary to illustrate, the task in Fig. 1 in task queue can have the corresponding enqueue time.
Fig. 2 is the process flow figure for the network request that this specification one embodiment provides.The execution of the method
Main body can be the equipment with processing capacity:Server either system or device, e.g., the server in Fig. 1.Such as Fig. 2 institutes
Show, the method can specifically include:
Step 210, server receives the network request of client.
Such as, the network request that server can receive the browser of client or APP is sent.The network request can be
Refer to high concurrent or time-consuming network request.
Step 220, for network request, corresponding goal task is created.
After creating goal task, corresponding task identification can be distributed for it.
Step 230, task queue is added in goal task.
Each task in above-mentioned task queue can have similar characteristic.Such as, the execution time of each task is close.
It should be noted that above-mentioned establishment goal task and the process that goal task is added to task queue are traditional routine techniques,
This is not repeated again.
It, can be with the task status of goal task in init state machine after task queue is added in goal task.Such as,
It is initialized as being not carried out and (waiting pending).
Step 240, it obtains the quantity of the task in task queue and executes duration.
In one implementation, obtaining the process of the execution duration of task can be:It determines and provided duration in the past
The task of (e.g., one day or one week) interior executed, obtains the execution duration of each task in the task of the executed, to
To multiple execution durations.Remove abnormal duration from multiple execution duration.Such as, remove longest execution duration and/or most short
Execution duration.The remaining average value for executing duration is taken, using the average value as above-mentioned execution duration.
It should be noted that in this specification embodiment, when there is multiple tasks in task queue, the execution of each task
Duration is equal, e.g., can take above-mentioned average value.
Certainly, in practical applications, above-mentioned execution duration can also be obtained otherwise, e.g., calculated by clustering
Method, to obtain above-mentioned execution duration, this specification embodiment is not construed as limiting this.
Step 250, according to quantity and execution duration, the stand-by period of goal task is determined.
In one implementation, the stand-by period of goal task can be determined according to following formula:C × t, wherein C
For the quantity of the task in task queue, t is that the execution duration of a task can be e.g. above-mentioned average value.
Server can store the goal task and between the stand-by period after determining the stand-by period of goal task
Correspondence.To which server can judge whether goal task meets execution condition according to waiting time.It is specific to judge
Method subsequently illustrates.
Step 260, to client returning response as a result, and executing the task in task queue.
The response results may include the stand-by period of above-mentioned determination.In addition, above-mentioned response results can also include above-mentioned
Task status after task identification and initialization.
Certainly, in practical applications, above-mentioned response results can also include the implementation progress of goal task, the implementation progress
It can be determined by the quantity and stand-by period of task.For client after receiving the implementation progress, can be shown to user should
Implementation progress.So as to promote user experience.
Can constantly take top n task from task queue by execution machine and execute in step 260.Starting to execute
When some task, the task status of the task in state machine can be updated.In addition, after the completion of some task execution, it can be with
The task is deleted from task queue.
The process of the task status of task can be in above-mentioned update state machine:If the task starts to execute but be not carried out
It completes, then the task status for updating the task in state machine is:In execution.If the task execution is completed and is run succeeded,
The task status of the task is in update state machine:Implementing result.If the task execution is completed and executes failure, shape is updated
The task status of the task is in state machine:Failure information.
To sum up, the task status of state machine may include following four kinds in this specification embodiment:Be not carried out (or wait for
Execute), execute in, implementing result and failure information.
It should be noted that above-mentioned server goal task execute complete before, to client returning response result
Method, the implementing result that client obtains when can lead to request timed out to avoid longer when the execution duration of goal task are inaccurate
True problem.
Step 270, the inquiry request that client is sent according to the stand-by period is received.
Client can send inquiry request according to the task status after initialization.Specifically, response can received
Start timing when as a result, when reaching the stand-by period, inquiry request is sent to client.The inquiry request may include that target is appointed
The task identification of business.
It should be noted that in this specification embodiment, client postpones the stand-by period after receiving response results
The method for sending inquiry request to server, can increase server stress to avoid frequently inquiry request is sent due to client
The problem of.
Server can determine corresponding target after receiving inquiry request according to the task identification of goal task
Task.Later according to the task status of goal task, to judge whether target is not carried out.Specifically, if target in state machine
The task status of task is:It is not carried out (or waiting pending), then judges that goal task is not carried out.
Optionally, when server judges that goal task is not carried out, it can be determined that state whether goal task meets execution item
Part.If meeting execution condition, performance objective task.Execution condition herein may include following one or more:Mesh
The enqueue time of mark task and the time difference of current time meet performance objective more than stand-by period, current idle resource and appoint
The transmission times of resource and inquiry request needed for business is more than predetermined threshold value.
It is understood that after goal task executes completion, the task shape of goal task in state machine can be updated
State is such as updated to:Implementing result or failure information.It can thus be seen that in the present embodiment, the task shape of task in state machine
State automatically updates, to when server receives the inquiry request of client, get the newest task of task
State.
It should be noted that in this specification embodiment, server judges after receiving the inquiry request of client
When goal task is not carried out and meets execution condition, the method for performance objective task can cause to avoid because queue is blocked
The problem of entering the task of task queue afterwards can not execute.
Step 280, query result is returned to client.
It can be according to the task status of goal task, to determine above-mentioned query result.Specifically, if goal task is appointed
Business state is:It is not carried out, then above-mentioned query result may include the information being not carried out for indicating goal task.If target is appointed
The task status of business is:In execution, then above-mentioned query result may include the information being carrying out for indicating goal task.Such as
The task status of fruit goal task is:Implementing result, then above-mentioned query result may include implementing result.If goal task
Task status is:Failure information, then above-mentioned query result may include for indicating that goal task executes the information of failure.
It is understood that above-mentioned steps 270- steps 280 repeat, until goal task executes completion, or
Person is until client gets the implementing result of goal task or for indicating that goal task executes the information of failure.
To sum up, the processing method for the network request that this specification embodiment provides, can be opened not increasing server resource
In the case of pin, effectively network request is handled.
Fig. 3 is the process flow figure for the network request that this specification another embodiment provides.The method is held
Row main body can be the client in Fig. 1.As shown in figure 3, the method can specifically include:
Step 310, user end to server sends network request.
Step 320, it receives server and is creating corresponding goal task for network request, and goal task is added and is appointed
The response results returned after business queue.
The response results may include waiting for the time.Waiting time is by server according to the task in task queue
What quantity and execution duration determined.
Step 330, according to the stand-by period, inquiry request is sent.
Such as, can send inquiry request after postponing the stand-by period.The inquiry request can serve to indicate that server
Whether inquiry goal task executes completion.
Step 340, the query result that institute's server returns is received.
It is understood that above-mentioned steps 330- steps 340 repeat, until goal task executes completion, or
Person is until client gets the implementing result of goal task or for indicating that goal task executes the information of failure.
In the present embodiment, for client when receiving response results, the delay stand-by period sends network request to server
Method, it is possible to reduce the transmission times of inquiry request, so as to reduce server load.
Fig. 4 is the process flow figure for the network request that this specification further embodiment provides.The method is held
Row main body can be the equipment with processing capacity:Server either system or device, e.g., the server in Fig. 1.Such as Fig. 4
Shown, the method can specifically include:
Step 410- steps 430 are identical as step 210- steps 230, do not repeat again herein.
Step 440, to client returning response as a result, and executing the task in task queue.
In one implementation, server can first obtain task queue to before client returning response result
In task quantity and execute duration.Wherein, obtaining the process of the execution duration of task can be:It determines and was provided in the past
The task of duration (e.g., one day or one week) interior executed, obtains the execution duration of each task in the task of the executed, from
And obtain multiple execution durations.Remove abnormal duration from multiple execution duration.Such as, remove longest execution duration and/or
Shortest execution duration.The remaining average value for executing duration is taken, using the average value as above-mentioned execution duration.
In this specification embodiment, when there is multiple tasks in task queue, the execution duration of each task is equal, e.g.,
Above-mentioned average value can be taken.
Certainly, in practical applications, above-mentioned execution duration can also be obtained otherwise, e.g., calculated by clustering
Method, to obtain above-mentioned execution duration, this specification embodiment is not construed as limiting this.
In the quantity of the task in getting task queue and after executing duration, when can be according to quantity and execution
It is long, determine the stand-by period of goal task.In one implementation, can according to following formula come determine goal task etc.
Wait for the time:C × t, wherein C is the quantity of the task in task queue, and t is that the execution duration of a task can be e.g. upper
State average value.
Server can store the goal task and between the stand-by period after determining the stand-by period of goal task
Correspondence.To which server can judge whether goal task meets execution condition according to waiting time.It is specific to judge
Method subsequently illustrates.
When server also determines the stand-by period of goal task, when the waiting that above-mentioned response results can include determining that
Between.In addition, above-mentioned response results can also include the task status after above-mentioned task identification and initialization.
Certainly, in practical applications, above-mentioned response results can also include the implementation progress of goal task, the implementation progress
It can be determined by the quantity and stand-by period of task.For client after receiving the implementation progress, can be shown to user should
Implementation progress.So as to promote user experience.
Can constantly take top n task from task queue by execution machine and execute in step 440.Starting to execute
When some task, the task status of the task in state machine can be updated.In addition, after the completion of some task execution, it can be with
The task is deleted from task queue.
The process of the task status of task can be in above-mentioned update state machine:If the task starts to execute but be not carried out
It completes, then the task status for updating the task in state machine is:In execution.If the task execution is completed and is run succeeded,
The task status of the task is in update state machine:Implementing result.If the task execution is completed and executes failure, shape is updated
The task status of the task is in state machine:Failure information.
To sum up, the task status of state machine may include following four kinds in this specification embodiment:Be not carried out (or wait for
Execute), execute in, implementing result and failure information.
It should be noted that above-mentioned server goal task execute complete before, to client returning response result
Method, the implementing result that client obtains when can lead to request timed out to avoid longer when the execution duration of goal task are inaccurate
True problem.
Step 450, the inquiry request that client is sent is received.
Client can send inquiry request according to the task status after initialization.Specifically, response can received
Start timing when as a result, when reaching the stand-by period, inquiry request is sent to client.The inquiry request may include that target is appointed
The task identification of business.
It should be noted that in this specification embodiment, client postpones the stand-by period after receiving response results
The method for sending inquiry request to server, can increase server stress to avoid frequently inquiry request is sent due to client
The problem of.
Step 460, judge whether goal task is not carried out.
Server can determine corresponding target after receiving inquiry request according to the task identification of goal task
Task.Later according to the task status of goal task, to judge whether target is not carried out.Specifically, if target in state machine
The task status of task is:It is not carried out (or waiting pending), then judges that goal task is not carried out.
Step 470, if be not carried out, judge whether goal task meets execution condition.
It is understood that if in goal task executed completion or execution, directly returns and inquire to client
As a result.Specifically, include the inquiry of implementing result to client return if goal task executed is completed and run succeeded
As a result.Include for indicating that goal task executes to client return if failure is completed and executed in goal task executed
The query result of the information of failure.If including for indicating goal task just to client return during goal task executes
In the query result of the information of execution.
Step 480, if meeting execution condition, performance objective task.
When server judges that goal task is not carried out, it can be determined that state whether goal task meets execution condition.If
Meet execution condition, then performance objective task.Execution condition herein may include following one or more:Goal task
The time difference of enqueue time and current time meets performance objective required by task money more than stand-by period, current idle resource
The transmission times of source and inquiry request is more than predetermined threshold value.
It is understood that after goal task executes completion, the task shape of goal task in state machine can be updated
State is such as updated to:Implementing result or failure information.It can thus be seen that in the present embodiment, the task shape of task in state machine
State automatically updates, to when server receives the inquiry request of client, get the newest task of task
State.
When server judges that goal task is not carried out, and is unsatisfactory for execution condition, it can be returned to client and be used for table
Show the information that goal task is not carried out.
It should be noted that in this specification embodiment, server judges after receiving the inquiry request of client
When goal task is not carried out and meets execution condition, the method for performance objective task can cause to avoid because queue is blocked
The problem of entering the task of task queue afterwards can not execute.
Step 490, if goal task runs succeeded, the implementing result of goal task is returned to client.
It can be according to the task status of goal task, to determine whether goal task runs succeeded.Specifically, if target
The task status of task is:Implementing result, then goal task run succeeded, from can to client return goal task execution
As a result.
And if goal task executes failure, it is returned to client for indicating that goal task executes the information of failure.
It is understood that above-mentioned steps 450- steps 490 repeat, until goal task executes completion, or
Person is until client gets the implementing result of goal task or for indicating that goal task executes the information of failure.
To sum up, the processing method for the network request that this specification embodiment provides, can be opened not increasing server resource
In the case of pin, effectively network request is handled.
Fig. 5 is the process flow figure for the network request that this specification another embodiment provides.The method is held
Row main body can be the client in Fig. 1.As shown in figure 5, the method can specifically include:
Step 510, user end to server sends network request.
Step 520, it receives server and is creating corresponding goal task for network request, and goal task is added and is appointed
The response results returned after business queue.
The response results may include that the stand-by period of inquiry request is sent for controlling client.Waiting time can be with
It is to be determined according to the quantity of the task in task queue and execution duration by server.
Step 530, inquiry request is sent.
Such as, can send the inquiry request after postponing the stand-by period.
The inquiry request can serve to indicate that whether server inquiry goal task executes completion, and be used to indicate server
The performance objective task when inquiry goal task is not carried out and meets execution condition.
Step 540, the query result that server returns is received.
It is understood that above-mentioned steps 530- steps 540 repeat, until goal task executes completion, or
Person is until client gets the implementing result of goal task or for indicating that goal task executes the information of failure.
In the present embodiment, for client when receiving response results, the delay stand-by period sends network request to server
Method, it is possible to reduce the transmission times of inquiry request, so as to reduce server load.
Fig. 6 is the information exchange figure of the processing method for the network request that this specification provides.As shown in fig. 6, this method can
To include the following three stage:It creates task phase, execute task phase and query result stage.Creating task phase can be with
Include the following steps:
Step 610, user end to server sends network request.
Step 620, server is directed to the network request, creates corresponding goal task.
Step 630, task queue is added in goal task by server.
Step 640, the task status of initialized target task.
Specifically, can be the task status of goal task in init state machine.
Step 650, it obtains the quantity of the task in task queue and executes duration.
Step 660, according to quantity and execution duration, the stand-by period T of goal task is determined.
Step 670, task status and stand-by period T after initialization are returned to client.
Task phase is executed to may include steps of:
Step 680, execution machine takes top n task from task queue.
Step 690, the top n task is executed.
Step 6100, implementing result is notified.
Step 6110, the task status of more new task.
Step 6120, task queue is updated.
The task that executed is completed is deleted such as from task queue.
It is understood that executing each step of task phase can repeat, until task queue is that sky is
Only.
The query result stage includes the following steps:
Step 6130, after waiting for T, inquiry request is sent.
Step 6140, judge whether to need to be immediately performed goal task.
Such as can be to judge whether goal task meets execution condition in the case where goal task is not carried out.
Step 6150, execution machine performance objective task is indicated.
In the case where meeting execution condition, performance objective task is indicated.After the completion of goal task executes, more new state
The task status of goal task in machine.
Step 6160, the task status of goal task is returned.
It is understood that each step in query result stage can also be to repeat, until task execution is completed
Until.
Accordingly with the processing method of above-mentioned network request, a kind of network request that this specification one embodiment also provides
Processing unit, as shown in fig. 7, the device may include:
Receiving unit 701, the network request for receiving client.
Creating unit 702, the network request for being received for receiving unit 701, creates corresponding goal task.
Unit 703 is added, task queue is added in the goal task for creating creating unit 702, is wrapped in task queue
Include one or more tasks.
Acquiring unit 704, the quantity for obtaining the task in task queue and execution duration.
Determination unit 705, the quantity for being obtained according to acquiring unit 704 and execution duration, determine goal task
Stand-by period.
Transmission unit 706, for client returning response as a result, the response results may include waiting for the time.
Execution unit 707, for executing the task in task queue.
Receiving unit 701 is additionally operable to receive the inquiry request that client is sent according to the stand-by period, which is used for
Indicate whether device inquiry goal task executes completion.
Transmission unit 706 is additionally operable to return to query result to client.
Optionally, transmission unit 706 specifically can be used for:
Judge whether goal task is not carried out.
When goal task is not carried out, judge whether goal task meets execution condition.
If meeting execution condition, performance objective task.
If goal task runs succeeded, the query result for the implementing result for including goal task is returned to client.
Optionally, the task in task queue has the corresponding enqueue time, and above-mentioned execution condition may include following
It is one or more:
The enqueue time of goal task and the time difference of current time are more than stand-by period, current idle resource satisfaction
The transmission times of performance objective required by task resource and inquiry request is more than predetermined threshold value.
Optionally, which can also include:
Initialization unit 708 is used for the task status of initialized target task.
Updating unit 709 updates the task status of goal task after executing completion in goal task.
Deleting unit 7100, for the delete target task from task queue.
Transmission unit 706 specifically can be used for:According to the task status of goal task, judge whether goal task is not held
Row.
The function of each function module of this specification above-described embodiment device can pass through each step of above method embodiment
Rapid to realize, therefore, the specific work process for the device that this specification one embodiment provides does not repeat again herein.
The processing unit for the network request that this specification one embodiment provides, receiving unit 701 receive the net of client
Network is asked.Creating unit 702 is directed to network request, creates corresponding goal task.Unit 703 is added, goal task is added and appoints
Business queue.Acquiring unit 704 obtains the quantity of the task in task queue and executes duration.Determination unit 705 is according to quantity
And duration is executed, determine the stand-by period of goal task.Transmission unit 706 is to client returning response result.Execution unit
707 execute the task in task queue.Receiving unit 701 receives the inquiry request that client is sent according to the stand-by period.It sends
Unit 706 returns to query result to client.Thus, it is possible to reduce the resource overhead of server.
It should be noted that the processing unit for the network request that this specification embodiment provides can be server in Fig. 1
A module or unit.
Accordingly with the processing method of above-mentioned network request, a kind of network request that this specification one embodiment also provides
Processing unit, as shown in figure 8, the device may include:
Transmission unit 801, for sending network request to server.
Receiving unit 802 is creating corresponding goal task for network request for receiving server, and target is being appointed
The response results returned after task queue are added in business.The response results may include waiting for the time.Waiting time is by servicing
Device is determined according to the quantity and execution duration of the task in task queue.
Transmission unit 801 is additionally operable to, according to the stand-by period, send inquiry request.The inquiry request is used to indicate server
Whether inquiry goal task executes completion.
Optionally, transmission unit 801 specifically can be used for:After postponing the stand-by period, inquiry request is sent.
Receiving unit 802 is additionally operable to receive the query result that server returns.
The function of each function module of this specification above-described embodiment device can pass through each step of above method embodiment
Rapid to realize, therefore, the specific work process for the device that this specification one embodiment provides does not repeat again herein.
It should be noted that the processing unit for the network request that this specification embodiment provides can be client in Fig. 1
A module or unit.
Accordingly with the processing method of above-mentioned network request, a kind of network request that this specification one embodiment also provides
Processing unit, as shown in figure 9, the device may include:
Receiving unit 901, the network request for receiving client.
Creating unit 902, the network request for being received for receiving unit 901, creates corresponding goal task.
Unit 903 is added, task queue is added in the goal task for creating creating unit 902, is wrapped in task queue
Include one or more tasks.
Transmission unit 904, for client returning response as a result, and executing the task in task queue.
Optionally, response results may include that the stand-by period of inquiry request is sent for controlling client.When the waiting
Between be by the device according to the quantity of the task in task queue and execute duration determine.
Receiving unit 901 is additionally operable to receive the inquiry request that client is sent.
Judging unit 905, for judging whether goal task is not carried out.
Judging unit 905 judges whether goal task meets execution condition if being additionally operable to be not carried out.
Execution unit 906, for if it is determined that the judgement of unit 905 meets execution condition, then performance objective task.
Optionally, the task in task queue has the corresponding enqueue time, and above-mentioned execution condition may include following
It is one or more:
The enqueue time of goal task and the time difference of current time are more than stand-by period, current idle resource satisfaction
The transmission times of performance objective required by task resource and inquiry request is more than predetermined threshold value.
Transmission unit 904 runs succeeded if being additionally operable to goal task, and the execution knot of goal task is returned to client
Fruit.
Optionally, which can also include:
Initialization unit 907 is used for the task status of initialized target task.
Updating unit 908 updates the task status of goal task after executing completion in goal task.
Deleting unit 909, for the delete target task from task queue.
Judging unit 905 is specifically used for:According to the task status of goal task, judge whether goal task is not carried out.
The function of each function module of this specification above-described embodiment device can pass through each step of above method embodiment
Rapid to realize, therefore, the specific work process for the device that this specification one embodiment provides does not repeat again herein.
The processing unit for the network request that this specification one embodiment provides, receiving unit 901 receive the net of client
Network is asked.Creating unit 902 is directed to network request, creates corresponding goal task.Unit 903 is added, goal task is added and appoints
Business queue.Transmission unit 904 is to client returning response as a result, and executing the task in task queue.Receiving unit 901 receives
The inquiry request that client is sent.Judging unit 905 judges whether goal task is not carried out.If be not carried out, judging unit 905
Judge whether goal task meets execution condition.If meeting execution condition, 906 performance objective task of execution unit.If mesh
Task execution success is marked, transmission unit 904 returns to the implementing result of goal task to client.Thus, it is possible to reduce server
Resource overhead.
It should be noted that the processing unit for the network request that this specification embodiment provides can be server in Fig. 1
A module or unit.
Accordingly with the processing method of above-mentioned network request, a kind of network request that this specification one embodiment also provides
Processing unit, as shown in Figure 10, which may include:
Transmission unit 1001, for sending network request to server.
Receiving unit 1002 is creating corresponding goal task for receiving server for network request, and by target
The response results returned after task queue are added in task.
Optionally, which may include that the stand-by period of inquiry request is sent for controlling the device.The waiting
Time can be determined according to the quantity of the task in task queue and execution duration by server.
Transmission unit 1001 is additionally operable to send inquiry request.The inquiry request is used to indicate server inquiry goal task
Completion whether is executed, and is used to indicate server performance objective when inquiry goal task is not carried out and meets execution condition and appoints
Business.
Optionally, transmission unit 1001 specifically can be used for:After postponing the stand-by period, inquiry request is sent.
Receiving unit 1002 is additionally operable to receive the query result that server returns.
The function of each function module of this specification above-described embodiment device can pass through each step of above method embodiment
Rapid to realize, therefore, the specific work process for the device that this specification one embodiment provides does not repeat again herein.
It should be noted that the processing unit for the network request that this specification embodiment provides can be client in Fig. 1
A module or unit.
Those skilled in the art are it will be appreciated that in said one or multiple examples, described in this specification
Function can be realized with hardware, software, firmware or their arbitrary combination.It when implemented in software, can be by these work(
Can storage in computer-readable medium or as on computer-readable medium one or more instructions or code passed
It is defeated.
Above-described specific implementation mode has carried out into one the purpose, technical solution and advantageous effect of this specification
Step is described in detail, it should be understood that the foregoing is merely the specific implementation mode of this specification, is not used to limit this
The protection domain of specification, all any modifications on the basis of the technical solution of this specification, made, change equivalent replacement
Into etc., it should all be included within the protection domain of this specification.