CN108733496A - Event-handling method and device - Google Patents
Event-handling method and device Download PDFInfo
- Publication number
- CN108733496A CN108733496A CN201710273195.0A CN201710273195A CN108733496A CN 108733496 A CN108733496 A CN 108733496A CN 201710273195 A CN201710273195 A CN 201710273195A CN 108733496 A CN108733496 A CN 108733496A
- Authority
- CN
- China
- Prior art keywords
- event
- request
- object event
- proxy server
- threads
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
- G06F9/548—Object oriented; Remote method invocation [RMI]
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The invention discloses a kind of event-handling method and devices.Wherein, this method includes:Obtain the first request, wherein the first request executes first object event for asking, and first object event is the event executed in remote procedure call;In the case where the first request meets the first preset condition, acquisition carries out first object event in proxy server to handle used multi-process, wherein, the number of processes of multi-process is pre-configured with by proxy server, and the number of processes of multi-process is corresponding with first object event;Pass through the corresponding multiple threads first object event of each process in multi-process, wherein the number of threads of multithreading is pre-configured with by proxy server, and the number of threads of multithreading is corresponding with first object event.The present invention solves the low technical problem of the event handling efficiency in the relevant technologies remote procedure call.
Description
Technical field
The present invention relates to internet arenas, in particular to a kind of event-handling method and device.
Background technology
Currently, in the event handling of internet, when in face of a large amount of service development demand, under different scenes,
It is difficult to build the strong backstage remote procedure call frame of high-performance, high concurrent, easy to get started, a robustness.Especially calculating
Under the scenes such as intensive, the network I/O intensive of task, to remote procedure call (Remote Procedure Call, referred to as RPC) frame
Frame has different requirements again.Method used by usually is using the one process service under one process pattern.
Fig. 1 is the schematic diagram according to the event handling under a kind of one process pattern in the related technology.As shown in Figure 1,
Under one process pattern, the object event that client server as needed executes sends user's request, and user request can be
Multiple user's requests, IO thread special disposal network I/Os receive user's request by the IO threads.It is received by IO threads
After user's request, by the multiple tasks (task) in task queue, by user's request by multiple sons in thread pool into
Cheng Jinhang processing, and then complete to ask corresponding object event to handle user.
For above-mentioned technical proposal, the event handling under one process pattern has the following problems:
(1) under one process pattern, collapse (crash) phenomenon is easy tod produce, and restarted again after collapse
Certain time is needed, to cause service a large amount of unusable states within a certain period of time.
(2) for the network frame and business module for event handling, in modification or the business of more new traffic module
After logic, need to compile together with above-mentioned network frame again, to cause the inefficiency of event handling.
(3) for the service of computation-intensive, the time of each user's request is long, and not to task queue
Length controlled, be easy to cause service snowslide.
(4) in the business of exploitation, the concurrent safety problem for considering multithreading is needed.
(5) existing event handling frame can only support the one of which in multithreading or multi-process, cannot meet not
With the demand of service, to cause the event handling efficiency in the relevant technologies remote procedure call low.
For the low problem of the event handling efficiency in above-mentioned the relevant technologies remote procedure call, not yet propose have at present
The solution of effect.
Invention content
An embodiment of the present invention provides a kind of event-handling method and devices, at least to solve the relevant technologies remote process tune
The low technical problem of event handling efficiency in.
One side according to the ... of the embodiment of the present invention provides a kind of event-handling method.The event-handling method includes:
Obtain the first request, wherein the first request executes first object event for asking, and first object event is in remote process tune
With the event of middle execution;In the case where the first request meets the first preset condition, obtain in proxy server to the first mesh
Mark event carries out handling used multi-process, wherein the number of processes of multi-process is pre-configured with by proxy server, and mostly into
The number of processes of journey is corresponding with first object event;Pass through the corresponding multiple threads of each process in multi-process first
Object event, wherein the number of threads of multithreading is pre-configured with by proxy server, and the number of threads of multithreading and the first mesh
Mark event is corresponding.
Another aspect according to the ... of the embodiment of the present invention additionally provides a kind of event processing apparatus.The event processing apparatus packet
It includes:First acquisition unit, for obtaining the first request, wherein the first request executes first object event, the first mesh for asking
Mark event is the event executed in remote procedure call;Second acquisition unit, for meeting the first default item in the first request
In the case of part, acquisition carries out first object event in proxy server to handle used multi-process, wherein multi-process
Number of processes be pre-configured with by proxy server, and the number of processes of multi-process is corresponding with first object event;At first
Unit is managed, for passing through the corresponding multiple threads first object event of each process in multi-process, wherein multithreading
Number of threads is pre-configured with by proxy server, and the number of threads of multithreading is corresponding with first object event.
In embodiments of the present invention, using the first request of acquisition, wherein the first request is for asking execution first object thing
Part, first object event are the event executed in remote procedure call;The case where the first request meets the first preset condition
Under, acquisition carries out first object event in proxy server to handle used multi-process, wherein multi-process into number of passes
Amount is pre-configured with by proxy server, and the number of processes of multi-process is corresponding with first object event;By every in multi-process
The corresponding multiple threads first object event of a process, wherein the number of threads of multithreading is advance by proxy server
Configuration, and the number of threads of multithreading is corresponding with first object event.Due to using multi-process and multiple threads thing simultaneously
Part disclosure satisfy that miscellaneous event handling demand, to realize the event handling efficiency improved in remote procedure call
Technique effect, and then solve the low technical problem of the event handling efficiency in the relevant technologies remote procedure call.
Description of the drawings
Attached drawing described herein is used to provide further understanding of the present invention, and is constituted part of this application, this hair
Bright illustrative embodiments and their description are not constituted improper limitations of the present invention for explaining the present invention.In the accompanying drawings:
Fig. 1 is the schematic diagram according to the event handling under a kind of one process pattern in the related technology;
Fig. 2 is a kind of schematic diagram of the hardware environment of event-handling method according to the ... of the embodiment of the present invention;
Fig. 3 is a kind of flow chart of event-handling method according to the ... of the embodiment of the present invention;
Fig. 4 is the flow chart of another event-handling method according to the ... of the embodiment of the present invention;
Fig. 5 is that a kind of acquisition according to the ... of the embodiment of the present invention carries out processing institute in proxy server to first object event
The flow chart of the method for the multi-process used;
Fig. 6 is the flow chart of another event-handling method according to the ... of the embodiment of the present invention;
Fig. 7 is the flow chart of another event-handling method according to the ... of the embodiment of the present invention;
Fig. 8 is according to the ... of the embodiment of the present invention a kind of by the corresponding multiple threads of each process in multi-process the
The flow chart of the method for one object event;
Fig. 9 is that another obtain according to the ... of the embodiment of the present invention is handled first object event in proxy server
The flow chart of the method for used multi-process;
Figure 10 is a kind of schematic diagram of multi-process model according to the ... of the embodiment of the present invention;
Figure 11 is a kind of schematic diagram of the multithreading model of remote procedure call according to the ... of the embodiment of the present invention;
Figure 12 is a kind of schematic diagram of dynamic RPC processing model according to the ... of the embodiment of the present invention;
Figure 13 is a kind of schematic diagram of event processing apparatus according to the ... of the embodiment of the present invention;
Figure 14 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention;
Figure 15 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention;
Figure 16 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention;
Figure 17 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention;
Figure 18 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention;And
Figure 19 is a kind of structure diagram of terminal according to the ... of the embodiment of the present invention.
Specific implementation mode
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention
Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
The embodiment of a part of the invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill people
The every other embodiment that member is obtained without making creative work should all belong to the model that the present invention protects
It encloses.
It should be noted that term " first " in description and claims of this specification and above-mentioned attached drawing, "
Two " etc. be for distinguishing similar object, without being used to describe specific sequence or precedence.It should be appreciated that using in this way
Data can be interchanged in the appropriate case, so as to the embodiment of the present invention described herein can in addition to illustrating herein or
Sequence other than those of description is implemented.In addition, term " comprising " and " having " and their any deformation, it is intended that cover
It includes to be not necessarily limited to for example, containing the process of series of steps or unit, method, system, product or equipment to cover non-exclusive
Those of clearly list step or unit, but may include not listing clearly or for these processes, method, product
Or the other steps or unit that equipment is intrinsic.
Embodiment 1
According to embodiments of the present invention, a kind of embodiment of event-handling method is provided.
Optionally, in the present embodiment, above-mentioned event-handling method can be applied to as shown in Figure 2 by server 202
In the hardware environment constituted with terminal 204.Fig. 2 is a kind of hardware environment of event-handling method according to the ... of the embodiment of the present invention
Schematic diagram.As shown in Fig. 2, server 202 is attached by network and terminal 204, above-mentioned network includes but not limited to:Extensively
Domain net, Metropolitan Area Network (MAN) or LAN, terminal 204 are not limited to PC, mobile phone, tablet computer etc..At the event of the embodiment of the present invention
Reason method can be executed by server 202, can also be executed, be can also be by server 202 and terminal by terminal 204
204 common execution.Wherein, the event-handling method that terminal 204 executes the embodiment of the present invention can also be by mounted thereto
Client executes.
Fig. 3 is a kind of flow chart of event-handling method according to the ... of the embodiment of the present invention.As shown in figure 3, this method can be with
Include the following steps:
Step S302 obtains the first request.
In the technical solution that the application above-mentioned steps S302 is provided, the first request is obtained, wherein the first request is for asking
It asks and executes first object event, first object event is the event executed in remote procedure call.
The embodiment is transformed exploitation based on Nginx agency service source codes, wherein Nginx is one high performance super
Text transfer protocol (HyperText Transfer Protocol, referred to as HTTP) and Reverse Proxy.Remote process
Server can be sent to by the request that client is sent by calling, and can send and receive response on the net.Due to passing through
Network asks service from remote computer program, without understanding underlying network technology so that exploitation includes network distribution
Application program including formula multiprogram is more prone to.
Client sends different users for different events and asks, wherein event is to be serviced under RPC frames
The event of exploitation.Optionally, the first request for asking execution first object event that client is sent is received, wherein the
One object event is the event executed under RPC frames, the first request can be for ask to service robustness require compared with
User's request of first object event is executed in the case of height, that is, the first request can be other than for code requirement
The request of first object event is executed in the case that the processing capacity of input condition is more demanding, or needing for asking
The request that first object event is executed in the case of wanting a large amount of proceeding internal memories to read and write, it is various each so as to make event handling meet
The exploitation demand of sample service.
Optionally, the quantity for counting the currently transmitted request to come of client, the quantity of request is stored to task queue
In, the length of the task queue is configurable.When the quantity of request is more than preset length, the quantity that transmission is used to indicate request is super
The prompt message for crossing preset length, the case where server snowslide caused by be effectively prevented request overflow, occur.
Step S304, acquisition carry out first object event in proxy server to handle used multi-process.
In the technical solution that the application above-mentioned steps S304 is provided, the case where the first request meets the first preset condition
Under, acquisition carries out first object event in proxy server to handle used multi-process, wherein multi-process into number of passes
Amount is pre-configured with by proxy server, and the number of processes of multi-process is corresponding with first object event.
First preset condition is the condition being used to determine whether using multi-process, for example, the first preset condition is for obtaining
Take in proxy server to first object event handled used in multi-process condition.Optionally, strong to servicing
In the case of strong property is more demanding, the first request meets the first preset condition.The case where the first request meets the first preset condition
Under, acquisition carries out first object event in proxy server to handle used multi-process.Wherein, process is that program is being counted
Primary execution activity on calculation machine, the number of processes of multi-process is pre-configured with by proxy server, and the number of processes of multi-process
It is corresponding with first object event, that is, the number of processes for the multi-process that different events uses is different, it can be by acting on behalf of
Server is pre-configured with according to the case where event.
Optionally, using multi-process model primary Nginx, while meeting the robustness and server crash of multi-process
(crash) characteristic of second pull-up reduces the not available problem of service caused by server crash to the maximum extent.In multi-process
Under pattern, without the concurrent safety for considering multithreading, to improve the safety of event handling.
Step S306 passes through the corresponding multiple threads first object event of each process in multi-process.
It is corresponding more by each process in multi-process in the technical solution that the application above-mentioned steps S306 is provided
Thread process first object event, wherein the number of threads of multithreading is pre-configured with by proxy server, and the thread of multithreading
Quantity is corresponding with first object event.
Thread is Lightweight Process, is the minimum unit in program execution stream, is a single sequential control in program
Flow.The thread of one standard is made of Thread Id, current instruction pointer, set of registers and storehouse.In addition, thread is process
In an entity, be the base unit independently dispatched and assigned by system, thread only possesses essential money in operation
Source, but it can share whole resources that process is possessed with the other threads for belonging to a process.One thread can be with
Another thread is created and cancelled, can concurrently be executed between multiple threads in same process.The same luck in single program
For the multiple threads of row to complete different work, multiple thread is known as multithreading.
Obtain in proxy server first object event is handled used in after multi-process, acquisition mostly into
The corresponding multithreading of each process in journey, passes through multiple threads first object event.The number of threads of the multithreading is by acting on behalf of
Server is pre-configured with, and the number of threads of multithreading is corresponding with first object event.
In this embodiment, the quantity of multi-process and the quantity of multithreading can configure, the quantity and multithreading of multi-process
The ratio of quantity can also configure.When the quantity of process is 1, and the quantity of the thread in the process is multiple, then at this time
It is considered as multithreading;When the quantity of process is multiple, the quantity of the corresponding thread of each process is 1 in multiple processes, then
It is considered as multi-process.Under multi-process pattern, the safety of the concurrent processing without considering multithreading.
Optionally, which supports multi-process and multithreading simultaneously, can be to servicing the more demanding situation of robustness
Lower selection multi-process;It is needing a large amount of proceeding internal memory read-writes to select multithreading, disclosure satisfy that service development of all kinds
Demand, to improve the event handling efficiency in remote procedure call.
S302 to step S306 through the above steps is asked using obtaining first, wherein the first request is executed for asking
First object event, first object event are the event executed in remote procedure call;It is default to meet first in the first request
In the case of condition, acquisition first object event is carried out in proxy server to handle used multi-process, wherein mostly into
The number of processes of journey is pre-configured with by proxy server, and the number of processes of multi-process is corresponding with first object event;Pass through
The corresponding multiple threads first object event of each process in multi-process, wherein the number of threads of multithreading is by acting on behalf of
Server is pre-configured with, and the number of threads of multithreading is corresponding with first object event.Due to simultaneously using multi-process and more
Thread process event disclosure satisfy that miscellaneous event handling demand, to realize the thing improved in remote procedure call
The technique effect of part treatment effeciency, and then solve the low technology of the event handling efficiency in the relevant technologies remote procedure call
Problem.
As an alternative embodiment, being made obtaining to handle first object event in proxy server
After multi-process, the quantity of the request of current record is more than preset quantity in the corresponding default queue of each process
In the case of, sent to client be used to indicate request quantity be more than preset quantity prompt message, in default queue when
It is corresponding multi-thread by each process in multi-process in the case that the quantity of the request of preceding record is less than preset quantity
Journey handles first object event.
Fig. 4 is the flow chart of another event-handling method according to the ... of the embodiment of the present invention.As shown in figure 4, this method is also
Include the following steps:
Step S401, when the quantity of the request of current record in the corresponding default queue of at least one each process is super
When crossing preset quantity, is sent to client and be used to indicate prompt message of the quantity of request more than preset quantity.
In the technical solution that the application above-mentioned steps S401 is provided, when at least one each process is corresponding default
When the quantity of the request of current record is more than preset quantity in queue, it is more than pre- to be sent to client and be used to indicate the quantity of request
If the prompt message of quantity, wherein request includes the first request.
Each process in multiple processes in proxy server has default queue, which can be that queue is long
Spend controllable task queue, wherein queue length can be the quantity for multiple requests that client is sent, multiple request bag
Include the first request.
Optionally, when the quantity of the request of current record at least one default queue is more than preset quantity, to client
End, which is sent, is used to indicate prompt message of the quantity of request more than preset quantity, which can be to be pre-configured in agency
Number of requests in server.
When the quantity of the request of current record at least one default queue is more than preset quantity, then client is sent out at this time
The request brought is excessive.In the case where asking excess, it is be easy to cause server snowslide, is sent at this time to client for referring to
Show that the quantity of request is more than the prompt message of preset quantity.
Step S402, when the quantity of the request of current record in default queue is less than preset quantity, by mostly into
The corresponding multiple threads first object event of each process in journey.
In the technical solution that the application above-mentioned steps S402 is provided, when the quantity of the request of current record in default queue
When being less than preset quantity, pass through the corresponding multiple threads first object event of each process in multi-process.
In the case that the quantity of the request of current record is less than preset quantity in default queue, normal through multi-thread
Journey handles first object event.
The embodiment handles used multi-process by being carried out to first object event in proxy server in acquisition
Later, when the quantity of the request of current record in the corresponding default queue of at least one each process is more than preset quantity
When, it is sent to client and is used to indicate prompt message of the quantity of request more than preset quantity, when current record in default queue
The quantity of request when being less than preset quantity, pass through corresponding the first mesh of multiple threads of each process in multi-process
Mark event, to realize the technique effect for improving the event handling efficiency in remote procedure call.
As an alternative embodiment, step S304, obtains and is carried out to first object event in proxy server
Handling used multi-process includes:The parent process in multi-process is determined according to default process model;By parent process to configuration
File is initialized;Multiple subprocess in multi-process are determined according to the configuration file after initialization.
Fig. 5 is that a kind of acquisition according to the ... of the embodiment of the present invention carries out processing institute in proxy server to first object event
The flow chart of the method for the multi-process used.As shown in figure 5, this approach includes the following steps:
Step S501 determines the parent process in multi-process according to default process model.
In the technical solution that the application above-mentioned steps S501 is provided, the father in multi-process is determined according to default process model
Process.
After obtaining the first request, the parent process in multi-process is determined according to default process model.Optionally, preset into
Journey model is father and son's process model of the more subprocess of parent process-.
Step S502 initializes configuration file by parent process.
In the technical solution that the application above-mentioned steps S502 is provided, configuration file is initialized by parent process.
After determining the parent process in multi-process according to default process model, configuration file is read by parent process, it is right
Configuration file is initialized, and the configuration file is for configuring required processing ginseng during handling first object event
Number.
Step S503 determines multiple subprocess in multi-process according to the configuration file after initialization.
In the technical solution that the application above-mentioned steps S503 is provided, multi-process is determined according to the configuration file after initialization
In multiple subprocess, wherein multiple subprocess be used for first request handle.
Multiple subprocess in multi-process are determined according to the configuration file after initialization, that is, multiple sub- parent processes are read
Complete configuration file and initialize finish the subprocess recalled later, receive and handle by multiple subprocess first ask.Father
Process and multiple subprocess carry out message communicating, for example, transmitted between parent process and multiple subprocess initiation command (start),
It ceases and desist order (stop), loading command (reload) etc..Optionally, parent process by the modes such as pipeline easily with it is multiple son into
Cheng Jinhang message communicatings.
The embodiment according to default process model by determining the parent process in multi-process;By parent process to configuration file
It is initialized, wherein configuration file is for configuring required processing parameter during handling first object event;Root
Multiple subprocess in multi-process are determined according to the configuration file after initialization, wherein multiple subprocess be used for first ask into
Row processing, realize obtain in proxy server to first object event handled used in multi-process purpose, into
And by the corresponding multiple threads first object event of each process in multi-process, to realize raising remote process
The technique effect of event handling efficiency in calling.
As an alternative embodiment, in determining multi-process according to the configuration file after initialization it is multiple son into
After journey, in the case where first object event reports an error, the second request is received by multiple subprocess, wherein the second request is used
The second object event is executed in request, the second object event is the event after restoring to the first object event to report an error;Root
The second object event is handled according to the second request.
Fig. 6 is the flow chart of another event-handling method according to the ... of the embodiment of the present invention.As shown in fig. 6, this method is also
Include the following steps:
Step S601 receives the second request by multiple subprocess.
In the technical solution that the application above-mentioned steps S601 is provided, in the case where first object event reports an error, pass through
Multiple subprocess receive the second request, wherein the second request executes the second object event for asking, and the second object event is pair
The first object event to report an error restored after event.
After multiple subprocess in determining multi-process according to the configuration file after initialization, first object event report
Mistake, that is, server is occasionally existing unexpected for business on line and collapse (Crash) occurs, it can asking at least one process
The quantity asked is more than the preset length of configuration, or executes first object event timeout, and first object event reports an error, to client
The error information for being used to indicate server crash is sent, for example, error information is the HTTP503 returned.Client is receiving
After error information, the second request is sent.Second request executes the second object event for asking, and the second object event is to report
Wrong first object event restored after event, pass through multiple subprocess and receive the second request.
Step S602 handles the second object event according to the second request.
In the technical solution that the application above-mentioned steps S602 is provided, the second target is handled according to the second request.
After receiving the second request by multiple subprocess, the second object event is handled according to the second request, to logical
Crossing this multi-process model can effectively prevent on line business occasionally existing unexpected, and pull-up again can temporary fast quick-recovery business.
After the embodiment is by multiple subprocess in determining multi-process according to the configuration file after initialization,
In the case that one object event reports an error, passes through multiple subprocess and receive the second request, wherein the second request executes for asking
Two object events, the second object event are the event after restoring to the first object event to report an error;At the second request
The second object event is managed, to effectively restore that unexpected event occurs, to realize the thing improved in remote procedure call
The technique effect of part treatment effeciency.
As an alternative embodiment, in determining multi-process according to the configuration file after initialization it is multiple son into
After journey, proxy server is upgraded according to the upgrade command upgraded to proxy server is used to indicate.
Fig. 7 is the flow chart of another event-handling method according to the ... of the embodiment of the present invention.As shown in fig. 7, this method is also
Include the following steps:
Step S701, reception are used to indicate the upgrade command upgraded to proxy server.
In the technical solution that the application above-mentioned steps S701 is provided, according to the configuration file after initialization determine mostly into
After multiple subprocess in journey, reception is used to indicate the upgrade command upgraded to proxy server.
In order to meet the execution demand for executing different event, proxy server can be upgraded to adapt to different event
Execution.After multiple subprocess in determining multi-process according to the configuration file after initialization, reception was used to indicate to generation
The upgrade command that reason server is upgraded, the order which is supported by Nginx.
Step S702 upgrades proxy server according to upgrade command.
In the technical solution that the application above-mentioned steps S702 is provided, proxy server is risen according to upgrade command
Grade.
After reception is used to indicate the upgrade command upgraded to proxy server, agency is taken according to upgrade command
Business device is upgraded, and upgrades continual purpose to reach smooth service.
After the embodiment is by multiple subprocess in determining multi-process according to the configuration file after initialization, receive
It is used to indicate the upgrade command upgraded to proxy server;Proxy server is upgraded according to upgrade command, in turn
Improve the technique effect of the event handling efficiency in remote procedure call.
As an alternative embodiment, step S306, passes through the corresponding multithreading of each process in multi-process
Handling first object event includes:It obtains and executes by multithreading and meet the multiple of the second preset condition in first object event
Task events;After having executed multiple tasks event, obtain third request, and to client transmission be used to indicate executed it is more
First response results of a task events.
Fig. 8 is according to the ... of the embodiment of the present invention a kind of by the corresponding multiple threads of each process in multi-process the
The flow chart of the method for one object event.As shown in figure 8, this method is further comprising the steps of:
Step S801 is obtained by multithreading and is executed the multiple tasks for meeting the second preset condition in first object event
Event.
In the technical solution that the application above-mentioned steps S801 is provided, is obtained by multithreading and execute first object event
In meet the multiple tasks event of the second preset condition.
First object event includes multiple tasks event, and the multiple tasks event for meeting the second preset condition can be to calculate
Intensive time-consuming task, the cycle of intensive time-consuming task meeting obstructing event.After obtaining the first request, obtained by multithreading
It takes and executes the multiple tasks event for meeting the second preset condition in first object event.Optionally, using the multithreading of Nginx
Model, the multithreading model include and thread pool (Thread_pool), task queue (Queue+notify), notice feedback
(Notify_callback) the relevant operation such as.
Step S802 obtains third request, and is used to indicate to client transmission and has executed the first of multiple tasks event
Response results.
In the technical solution that the application above-mentioned steps S802 is provided, after having executed multiple tasks event, acquisition the
Three requests, and sent to client and be used to indicate the first response results for having executed multiple tasks event, wherein third request is used
Third object event is executed in request, third object event is the event executed in remote procedure call.
Client sends multiple for asking the user of execution event to ask.It, can after having executed multiple tasks event
It notifies to carry out event loop processing to write by pipeline.Third request is obtained, third request is sent out when being event loop processing
The next request sent.Notify_callback is called, is sent to client and is used to indicate executed multiple tasks event the
One response results (Send respose), to realize the transmission response logic of proxy server.
Optionally, it is encapsulated in dynamic link library for executing the operation of event.After obtaining third request, Ke Yigen
The uniform resource identifier (Uniform Resource Identifier, referred to as URI) carried according to third request is in dynamic chain
Connect operation of the selection for executing third object event in library.After operation of the selection for executing third object event, into
Row is joined the team (Task push), executes third object event by multiple subprocess in thread pool, wherein URL is for identifying certain
The character string of one Internet resources title allows user to pass through specific agreement to the resource of any (including local and internet)
Interact operation.
The embodiment is obtained by multithreading and executes the multiple tasks for meeting the second preset condition in first object event
Event;After having executed multiple tasks event, third request is obtained, and be used to indicate to client transmission and executed multiple
First response results of business event, wherein third request executes third object event for asking, and third object event is remote
The event executed in the journey invocation of procedure is realized through the corresponding multiple threads first object of each process in multi-process
The purpose of event, to realize the technique effect for improving the event handling efficiency in remote procedure call.
As an alternative embodiment, being made obtaining to handle first object event in proxy server
Before multi-process, load dynamic link library for executing first object event, wherein dynamic link library be packaged with mostly into
Operation in journey for executing first object event.
The process part of remote procedure call can continue to use the mode being packaged to multi-process.Optionally, pass through data
Library description language google::The service service of protobuf carries out service registration.By service registration to agency service
The target that during device, can combine " business, frame zero couple ", is realized by dynamic load dynamic link library.It needs
The operation (Handlers) of execution event needs is infused in dynamic link library.Wherein, operation can be in following operation
It is one or more kinds of:Newly-built Service operations, (_ NGX_RPC_NewService), global initialization operation (_ NGX_RPC_
ServiceGlobalInit), global destructed operation (NGX_RPC_ServiceGlobalRelease), thread initialization operation
(_NGX_RPC_ServiceThreadInit)。
The embodiment utilizes the dynamic load principle of dynamic link library, writes dynamic remote invocation of procedure module, and dynamic carries
Enter dynamic link library, disassociation service and frame.In more new business, it is only necessary to recompilate dynamic link library, improve
Event handling efficiency in remote procedure call.
As an alternative embodiment, step S304, obtains and is carried out to first object event in proxy server
Handling used multi-process includes:Obtain the uniform resource identifier that the first request carries;According to uniform resource identifier from
Preset memory locations obtain multi-process.
Fig. 9 is that another obtain according to the ... of the embodiment of the present invention is handled first object event in proxy server
The flow chart of the method for used multi-process.As shown in figure 9, this approach includes the following steps:
Step S901 obtains the uniform resource identifier that the first request carries.
In the technical solution that the application above-mentioned steps S901 is provided, the uniform resource identifier that the first request carries is obtained
Symbol, wherein uniform resource identifier is for identifying multi-process.
When the first request that client is sent reaches, the task of remote procedure call can obtain the system of the first request carrying
One resource identifier, uniform resource identifier are used to identify the character string of a certain Internet resources title, allow user to any
The resource of (including local and internet) interacts operation by specific agreement.
Step S902 obtains multi-process according to uniform resource identifier from preset memory locations.
In the technical solution that the application above-mentioned steps S902 is provided, according to uniform resource identifier from preset memory locations
Obtain multi-process, wherein preset memory locations store multiple processes including multi-process.
Preset memory locations store multiple processes including multi-process, which can be Hash table
(Hash Table).After obtaining the uniform resource identifier that the first request carries, according to uniform resource identifier from Hash
Corresponding multi-process is found in table, so that it is determined that the operation (Service& for executing first object event
MethodDescriptor).The processing of agreement unserializing further is done to backpack body, to ensure data in continuous memory just
Often transmission.By calling Service->CallMethod () will call the operation logic encapsulated in dynamic link library, finally
Unserializing processing is carried out again, and notice Nginx major cycles call Notify_Callback to send response results, visitor to client
Family end can determine that server is finished to first object event after receiving the response results.Server can prepare
Next request is received to handle event, realizes the dynamic processing intent of remote procedure call.
The uniform resource identifier that the embodiment is carried by obtaining the first request, wherein uniform resource identifier is used for
Identify multi-process;Multi-process is obtained from preset memory locations, wherein preset memory locations are stored according to uniform resource identifier
Multiple processes including multi-process, realize acquisition in proxy server to first object event handled used in it is more
The purpose of process is carried by the corresponding multiple threads first object event of each process in multi-process to realize
The technique effect of event handling efficiency in the high-altitude invocation of procedure.
Embodiment 2
Technical scheme of the present invention is illustrated with reference to preferred embodiment.It is with proxy server specifically
Nginx is described.
The remote procedure call of the embodiment includes that multi-process model, multithreading model, dynamic RPC processing model are explained respectively
It states.
The multi-process model in remote procedure call is introduced below.
Figure 10 is a kind of schematic diagram of multi-process model according to the ... of the embodiment of the present invention.As shown in Figure 10, Nginx is used
Father and son's process model of the more worker of master-, multiple subprocess are to have read configuration file by parent process and carried out initial
Change the multiple subprocess for recalling (fork) after completing, then receives and handle multiple client by recalling multiple subprocess
(Client) the user's request sended over, wherein each subprocess can receive user's request of multiple client transmission.Father
Process easily carries out message communicating by modes such as pipelines with subprocess, for example, transmitting initiation command by modes such as pipelines
(start), it ceases and desist order (stop), loading command (reload).
The multi-process model of the embodiment can effectively prevent on line business occasionally existing unexpected, can pull-up business again, temporarily
When fast quick-recovery business, and can reach smooth service easily under the order that Nginx is supported and upgrade continual mesh
, and then improve the event handling efficiency under remote procedure call.
The multithreading model in remote procedure call is introduced below.
Figure 11 is a kind of schematic diagram of the multithreading model of remote procedure call according to the ... of the embodiment of the present invention.Such as Figure 11 institutes
Show, the task under the remote procedure call of the embodiment is all computation-intensive consuming task, and computation-intensive time-consuming task can hinder
Fill in Epoll event loops, wherein Epoll is that linux kernel has done improved function for processing high-volume filec descriptor.
Optionally, using multithreading model ready-made Nginx, which includes thread pool (thread_pool)+task queue
(task_queue)+notice calls (notify_callback).The request (reading http body) of reading client, in dynamic
In chained library, it is directed to the operation of object event according to path URI decisions, can carry out selecting the operation from Hash table, into
And construct task operating.After constructing task operating, task operating is joined the team (Task push) to thread pool model.Pass through
Constantly initiate remote procedure call under multitask (post rpc task), multitask complete (Done Handler) it
Epoll event loops are notified by more subprocess, wherein multitask and more subprocess belong to thread in such a way that pipeline is write afterwards
Pool model.Then Notify_callback is called to realize that the send response that Nginx is sent to client (send and ring
Answer) logic, the event-handling method under multithreading model to realize remote procedure call.
Under multi-process model, without considering the concurrent safety of multithreading, a large amount of proceeding internal memory read-writes are being needed
Multithreading is selected, to meet the needs of server exploitation of all kinds, improves the event handling efficiency of remote procedure call.
Dynamic RPC processing models are introduced below:
Figure 12 is a kind of schematic diagram of dynamic RPC processing model according to the ... of the embodiment of the present invention.As shown in figure 12, at RPC
The part of reason can pass through google along the packaged type of multi-process::protobuf:Service carries out service registration, leads to
Cross libapi_dso.so New Protobuf::Service, with dlopen functions from Hash_table under specified pattern
It is middle to open specified dynamic link library file.
Optionally, in conjunction with the target of " business, frame zero couple ", dynamic load dynamic link library.It needs in dynamic link
The required operation (Handlers) of execution event is infused in library.Optionally, the operation injected in dynamic link library includes
Following one or more:
_ NGX_RPC_NewService//newly-built Service;
_ NGX_RPC_ServiceGlobalInit//overall situation initialization;
_ NGX_RPC_ServiceGlobalRelease//overall situation is destructed;
_ NGX_RPC_ServiceThreadInit//thread initialization.
When the request (request) that client is sent reaches, remote procedure call (RPC task) meeting basis is asked
The URI of carrying is asked to find corresponding Service&Method Descriptor from Hash_table, wherein Hash table will
Key (Key) is mapped to corresponding value (Value).Protobuf agreement unserializings further are done to backpack body, call Service->
CallMethod () will call the operation for performance objective event packaged in dynamic link library to patrol at this time
Volume.Last to carry out unserializing processing again, notice Nginx major cycles call Notify_callback to send response.
By test, the network frame for performance objective event of the embodiment is in the user company in face of per second ten thousand or more
When connecing, efficiency is not less than network frame in the prior art;The network frame has stronger robustness, configurability simultaneously,
Dynamic link library dynamic load, task queue length control, not will produce avalanche effect, easy for computation-intensive service development
It in left-hand seat and maintenance, has been widely popularized and has used in the background at present, the efficiency of event handling is greatly improved.
It should be noted that for each method embodiment above-mentioned, for simple description, therefore it is all expressed as a series of
Combination of actions, but those skilled in the art should understand that, the present invention is not limited by the described action sequence because
According to the present invention, certain steps can be performed in other orders or simultaneously.Secondly, those skilled in the art should also know
It knows, embodiment described in this description belongs to preferred embodiment, and involved action and module are not necessarily of the invention
It is necessary.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation
The method of example can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but it is very much
In the case of the former be more preferably embodiment.Based on this understanding, technical scheme of the present invention is substantially in other words to existing
The part that technology contributes can be expressed in the form of software products, which is stored in a storage
In medium (such as ROM/RAM, magnetic disc, CD), including some instructions are used so that a station terminal equipment (can be mobile phone, calculate
Machine, server or network equipment etc.) execute method described in each embodiment of the present invention.
Embodiment 3
According to embodiments of the present invention, a kind of event processing apparatus for implementing above-mentioned event-handling method is additionally provided.
Figure 13 is a kind of schematic diagram of event processing apparatus according to the ... of the embodiment of the present invention.As shown in figure 13, which can
To include:First acquisition unit 10, second acquisition unit 20 and first processing units 30.
First acquisition unit 10, for obtaining the first request, wherein the first request executes first object thing for asking
Part, first object event are the event executed in remote procedure call.
Second acquisition unit 20, in the case where the first request meets the first preset condition, obtaining in agency service
First object event is carried out in device to handle used multi-process, wherein the number of processes of multi-process is pre- by proxy server
It first configures, and the number of processes of multi-process is corresponding with first object event.
First processing units 30, for passing through the corresponding multiple threads first object thing of each process in multi-process
Part, wherein the number of threads of multithreading is pre-configured with by proxy server, and the number of threads of multithreading and first object event
It is corresponding.
Figure 14 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention.As shown in figure 14, the event
Processing unit may include:First acquisition unit 10, second acquisition unit 20 and first processing units 30.Wherein, the device is also
Including:Transmission unit 40.Wherein, first processing units 30 include first processing module 31.
It should be noted that the first acquisition unit 10 of the embodiment, second acquisition unit 20 and first processing units 30
Identical as the effect in the event processing apparatus of embodiment illustrated in fig. 13, details are not described herein again.
Transmission unit 40, for working as the request of current record in the corresponding default queue of at least one each process
When quantity is more than preset quantity, is sent to client and is used to indicate prompt message of the quantity of request more than preset quantity, wherein
Request includes the first request.
First processing units 30 include first processing module 31, for the quantity when the request of current record in default queue
When being less than preset quantity, pass through the corresponding multiple threads first object event of each process in multi-process.
Figure 15 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention.As shown in figure 15, the event
Processing unit may include:First acquisition unit 10, second acquisition unit 20 and first processing units 30.Wherein, it second obtains
Unit 20 includes:First determining module 21, initialization module 22 and the second determining module 23.
It should be noted that the first acquisition unit 10 of the embodiment, second acquisition unit 20 and first processing units 30
Identical as the effect in the event processing apparatus of embodiment illustrated in fig. 13, details are not described herein again.
First determining module 21, for determining the parent process in multi-process according to default process model.
Initialization module 22 initializes configuration file for passing through parent process, wherein configuration file is for configuring
Required processing parameter during handling first object event.
Second determining module 23, for determining multiple subprocess in multi-process according to the configuration file after initialization,
In, multiple subprocess are used to handle the first request.
Figure 16 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention.As shown in figure 16, the event
Processing unit may include:First acquisition unit 10, second acquisition unit 20 and first processing units 30.Wherein, it second obtains
Unit 20 includes:First determining module 21, initialization module 22 and the second determining module 23.The device further includes:First receives
Unit 50 and second processing unit 60.
It should be noted that the first acquisition unit 10 of the embodiment, second acquisition unit 20 and first processing units 30,
First determining module 21 and the second determining module 22 are identical as the effect in the event processing apparatus of embodiment illustrated in fig. 15, herein
It repeats no more.
First receiving unit 50, for multiple subprocess in determining multi-process according to the configuration file after initialization it
Afterwards, in the case where first object event reports an error, the second request is received by multiple subprocess, wherein the second request is for asking
It asks and executes the second object event, the second object event is the event after restoring to the first object event to report an error.
Second processing unit 60, for handling the second object event according to the second request.
Figure 17 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention.As shown in figure 17, the event
Processing unit may include:First acquisition unit 10, second acquisition unit 20 and first processing units 30.Wherein, it second obtains
Unit 20 includes:First determining module 21, initialization module 22 and the second determining module 23.Wherein, which further includes:Second
Receiving unit 70 and upgrade unit 80.
It should be noted that the first acquisition unit 10 of the embodiment, second acquisition unit 20 and first processing units 30,
First determining module 21 and the second determining module 22 are identical as the effect in the event processing apparatus of embodiment illustrated in fig. 15, herein
It repeats no more.
Second receiving unit 70, for multiple subprocess in determining multi-process according to the configuration file after initialization it
Afterwards, it receives and is used to indicate the upgrade command upgraded to proxy server.
Upgrade unit 80, for being upgraded to proxy server according to upgrade command.
Figure 18 is the schematic diagram of another event processing apparatus according to the ... of the embodiment of the present invention.As shown in figure 18, the event
Processing unit may include:First acquisition unit 10, second acquisition unit 20 and first processing units 30.The first processing units
30 include:Second processing module 31 and execution module 32.
It should be noted that the first acquisition unit 10 of the embodiment, second acquisition unit 20 and first processing units 30
Identical as the effect in the event processing apparatus of embodiment illustrated in fig. 13, details are not described herein again.
Second processing module 31 meets the second preset condition for obtaining and executing by multithreading in first object event
Multiple tasks event.
Execution module 32 for after having executed multiple tasks event, obtaining third request, and sends to client and uses
The first response results of multiple tasks event have been executed in instruction, wherein third request executes third object event for asking,
Third object event is the event executed in remote procedure call.
It should be noted that the first acquisition unit 10 in the embodiment can be used for executing in the embodiment of the present application 1
Step S302, the second acquisition unit 20 in the embodiment can be used for executing the step S304 in the embodiment of the present application 1, the reality
The first processing units 30 in example are applied to can be used for executing the step S306 in the embodiment of the present application 1.
The embodiment obtains the first request by first acquisition unit 10, wherein the first request executes first for asking
Object event, first object event are the event executed in remote procedure call, are asked first by second acquisition unit 20
Ask in the case of meeting the first preset condition, obtain in proxy server to first object event handled used in it is more
Process, wherein the number of processes of multi-process is pre-configured with by proxy server, and the number of processes of multi-process and first object thing
Part is corresponding, passes through the corresponding multiple threads first object thing of each process in multi-process by first processing units 30
Part, wherein the number of threads of multithreading is pre-configured with by proxy server, and the number of threads of multithreading and first object event
It is corresponding, due to using multi-process and multiple threads event, disclosure satisfy that miscellaneous event handling demand simultaneously, to
The technique effect for improving the event handling efficiency in remote procedure call is realized, and then solves the relevant technologies remote process tune
The low technical problem of event handling efficiency in.
Herein it should be noted that example and application scenarios phase that said units and module and corresponding step are realized
Together, but it is not limited to the above embodiments 1 disclosure of that.It should be noted that above-mentioned module can be with as a part for device
It operates in hardware environment as shown in Figure 2, can also pass through hardware realization, wherein hardware environment by software realization
Including network environment.
Embodiment 4
According to embodiments of the present invention, a kind of server or terminal for implementing above-mentioned event-handling method is additionally provided.
Figure 19 is a kind of structure diagram of terminal according to the ... of the embodiment of the present invention.As shown in figure 19, which may include:
One or more (one is only shown in figure) processors 191, memory 193 and transmitting device 195.As shown in figure 19, the end
End can also include input-output equipment 197.
Wherein, memory 193 can be used for storing software program and module, such as the event handling side in the embodiment of the present invention
Method and the corresponding program instruction/module of device, processor 191 by operation be stored in software program in memory 193 and
Module realizes above-mentioned event-handling method to perform various functions application and data processing.Memory 193 can wrap
Include high speed random access memory, can also include nonvolatile memory, as one or more magnetic storage device, flash memory or
Other non-volatile solid state memories of person.In some instances, memory 193 can further comprise remote relative to processor 191
The memory of journey setting, these remote memories can pass through network connection to terminal.The example of above-mentioned network includes but unlimited
In internet, intranet, LAN, mobile radio communication and combinations thereof.
Above-mentioned transmitting device 195 is used to receive via network or transmission data, can be also used for processor with
Data transmission between memory.Above-mentioned network specific example may include cable network and wireless network.In an example,
Transmitting device 195 includes a network adapter (Network Interface Controller, NIC), can pass through cable
It is connected with other network equipments with router so as to be communicated with internet or LAN.In an example, transmission dress
It is radio frequency (Radio Frequency, RF) module to set 195, is used to wirelessly be communicated with internet.
Wherein, specifically, memory 193 is for storing application program.
Processor 191 can call the application program that memory 193 stores by transmitting device 195, to execute following steps
Suddenly:
Obtain the first request, wherein the first request executes first object event for asking, and first object event is remote
The event executed in the journey invocation of procedure;
First request meet the first preset condition in the case of, obtain in proxy server to first object event into
Multi-process used in row processing, wherein the number of processes of multi-process is pre-configured with by proxy server, and the process of multi-process
Quantity is corresponding with first object event;
Pass through the corresponding multiple threads first object event of each process in multi-process, wherein the line of multithreading
Number of passes amount is pre-configured with by proxy server, and the number of threads of multithreading is corresponding with first object event.
Processor 191 is additionally operable to execute following step:When in the corresponding default queue of at least one each process when
When the quantity of the request of preceding record is more than preset quantity, it is more than preset quantity to be sent to client and be used to indicate the quantity of request
Prompt message, wherein request includes the first request, when the quantity of the request of current record in default queue is less than present count
When amount, pass through the corresponding multiple threads first object event of each process in multi-process.
Processor 191 is additionally operable to execute following step:The parent process in multi-process is determined according to default process model;Pass through
Parent process initializes configuration file, wherein configuration file is for configuring in processing first object event during institute
The processing parameter needed;Multiple subprocess in multi-process are determined according to the configuration file after initialization, wherein multiple subprocess
For handling the first request.
Processor 191 is additionally operable to execute following step:It is more in determining multi-process according to the configuration file after initialization
After a subprocess, in the case where first object event reports an error, the second request is received by multiple subprocess, wherein second
Request executes the second object event for asking, and the second object event is the thing after restoring to the first object event to report an error
Part;The second object event is handled according to the second request.
Processor 191 is additionally operable to execute following step:It is more in determining multi-process according to the configuration file after initialization
After a subprocess, reception is used to indicate the upgrade command upgraded to proxy server;Agency is taken according to upgrade command
Business device is upgraded.
Processor 191 is additionally operable to execute following step:It is obtained and is executed by multithreading and meet in first object event
The multiple tasks event of two preset conditions;After having executed multiple tasks event, third request is obtained, and send to client
It is used to indicate the first response results for having executed multiple tasks event, wherein third request executes third target thing for asking
Part, third object event are the event executed in remote procedure call.
Processor 191 is additionally operable to execute following step:Obtain in proxy server to first object event at
Before multi-process used in reason, the dynamic link library for executing first object event is loaded, wherein dynamic link library encapsulates
There is the operation for executing first object event in multi-process.
Processor 191 is additionally operable to execute following step:Obtain the uniform resource identifier that the first request carries, wherein system
One resource identifier is for identifying multi-process;Multi-process is obtained from preset memory locations, wherein pre- according to uniform resource identifier
If storage location stores multiple processes including multi-process.
Using the embodiment of the present invention, a kind of scheme of event handling is provided.It is asked by using obtaining first, wherein
First request executes first object event for asking, and first object event is the event executed in remote procedure call;?
In the case that first request meets the first preset condition, acquisition, which is handled first object event in proxy server, to be made
Multi-process, wherein the number of processes of multi-process is pre-configured with by proxy server, and the number of processes of multi-process and first
Object event is corresponding;Pass through the corresponding multiple threads first object event of each process in multi-process, wherein multi-thread
The number of threads of journey is pre-configured with by proxy server, and the number of threads of multithreading is corresponding with first object event.Due to
Multi-process and multiple threads event are used simultaneously, disclosure satisfy that miscellaneous event handling demand, are improved to realize
The technique effect of event handling efficiency in remote procedure call, and then solve the event in the relevant technologies remote procedure call
The low technical problem for the treatment of effeciency.
Optionally, the specific example in the present embodiment can refer to the example described in above-described embodiment, the present embodiment
Details are not described herein.
It will appreciated by the skilled person that structure shown in Figure 19 is only to illustrate, terminal can be smart mobile phone
(such as Android phone, iOS mobile phones), tablet computer, palm PC and mobile internet device (Mobile Internet
Devices, MID), the terminal devices such as PAD.Figure 19 it does not cause to limit to the structure of above-mentioned electronic device.For example, terminal is also
It may include more either less components (such as network interface, display device) than shown in Figure 19 or have and Figure 19 institutes
Show different configurations.
One of ordinary skill in the art will appreciate that all or part of step in the various methods of above-described embodiment is can
To be completed come command terminal device-dependent hardware by program, which can be stored in a computer readable storage medium
In, storage medium may include:Flash disk, read-only memory (Read-Only Memory, ROM), random access device (Random
Access Memory, RAM), disk or CD etc..
Embodiment 5
The embodiments of the present invention also provide a kind of storage mediums.Optionally, in the present embodiment, above-mentioned storage medium is deposited
Storage can be used for executing the program code of event-handling method.
Optionally, in the present embodiment, above-mentioned storage medium can be located at multiple in network shown in above-described embodiment
On at least one of network equipment network equipment.
Optionally, in the present embodiment, storage medium is arranged to store the program code for executing following steps:
Obtain the first request, wherein the first request executes first object event for asking, and first object event is remote
The event executed in the journey invocation of procedure;
First request meet the first preset condition in the case of, obtain in proxy server to first object event into
Multi-process used in row processing, wherein the number of processes of multi-process is pre-configured with by proxy server, and the process of multi-process
Quantity is corresponding with first object event;
Pass through the corresponding multiple threads first object event of each process in multi-process, wherein the line of multithreading
Number of passes amount is pre-configured with by proxy server, and the number of threads of multithreading is corresponding with first object event.
Optionally, storage medium is also configured to store the program code for executing following steps:When at least one every
When the quantity of the request of current record is more than preset quantity in the corresponding default queue of a process, it is used for client transmission
Indicate that the quantity of request is more than the prompt message of preset quantity, wherein request includes the first request, is currently remembered when in default queue
When the quantity of the request of record is less than preset quantity, pass through the corresponding multiple threads of each process in multi-process first
Object event.
Optionally, storage medium is also configured to store the program code for executing following steps:According to default process
Model determines the parent process in multi-process;Configuration file is initialized by parent process, wherein configuration file is for configuring
Required processing parameter during handling first object event;It is determined in multi-process according to the configuration file after initialization
Multiple subprocess, wherein multiple subprocess be used for first request handle.
Optionally, storage medium is also configured to store the program code for executing following steps:According to initialization
After configuration file afterwards determines multiple subprocess in multi-process, in the case where first object event reports an error, by multiple
Subprocess receives the second request, wherein the second request executes the second object event for asking, and the second object event is to reporting an error
First object event restored after event;The second object event is handled according to the second request.
Optionally, storage medium is also configured to store the program code for executing following steps:According to initialization
After configuration file afterwards determines multiple subprocess in multi-process, reception is used to indicate the liter upgraded to proxy server
Grade instruction;Proxy server is upgraded according to upgrade command.
Optionally, storage medium is also configured to store the program code for executing following steps:It is obtained by multithreading
It takes and executes the multiple tasks event for meeting the second preset condition in first object event;Executed multiple tasks event it
Afterwards, third request is obtained, and is sent to client and is used to indicate the first response results for having executed multiple tasks event, wherein
Third request executes third object event for asking, and third object event is the event executed in remote procedure call.
Optionally, storage medium is also configured to store the program code for executing following steps:It is being acted on behalf of obtaining
In server to first object event handled used in before multi-process, load for executing the dynamic of first object event
State chained library, wherein dynamic link library is packaged with the operation for executing first object event in multi-process.
Optionally, storage medium is also configured to store the program code for executing following steps:Obtain the first request
The uniform resource identifier of carrying, wherein uniform resource identifier is for identifying multi-process;According to uniform resource identifier from pre-
If storage location obtains multi-process, wherein preset memory locations store multiple processes including multi-process.
Optionally, the specific example in the present embodiment can refer to the example described in above-described embodiment, the present embodiment
Details are not described herein.
Optionally, in the present embodiment, above-mentioned storage medium can include but is not limited to:USB flash disk, read-only memory (ROM,
Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disc or
The various media that can store program code such as CD.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
If the integrated unit in above-described embodiment is realized in the form of SFU software functional unit and as independent product
Sale in use, can be stored in the storage medium that above computer can be read.Based on this understanding, skill of the invention
Substantially all or part of the part that contributes to existing technology or the technical solution can be with soft in other words for art scheme
The form of part product embodies, which is stored in a storage medium, including some instructions are used so that one
Platform or multiple stage computers equipment (can be personal computer, server or network equipment etc.) execute each embodiment institute of the present invention
State all or part of step of method.
In the above embodiment of the present invention, all emphasizes particularly on different fields to the description of each embodiment, do not have in some embodiment
The part of detailed description may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed client, it can be by others side
Formula is realized.Wherein, the apparatus embodiments described above are merely exemplary, for example, the unit division, only one
Kind of division of logic function, formula that in actual implementation, there may be another division manner, such as multiple units or component can combine or
It is desirably integrated into another system, or some features can be ignored or not executed.Another point, it is shown or discussed it is mutual it
Between coupling, direct-coupling or communication connection can be INDIRECT COUPLING or communication link by some interfaces, unit or module
It connects, can be electrical or other forms.
The unit illustrated as separating component may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, you can be located at a place, or may be distributed over multiple
In network element.Some or all of unit therein can be selected according to the actual needs to realize the mesh of this embodiment scheme
's.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also
It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.Above-mentioned integrated list
The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.
Claims (14)
1. a kind of event-handling method, which is characterized in that including:
Obtain the first request, wherein first request executes first object event for asking, and the first object event is
The event executed in remote procedure call;
In the case where first request meets the first preset condition, obtain in proxy server to the first object thing
Part carries out handling used multi-process, wherein and the number of processes of the multi-process is pre-configured with by the proxy server, and
The number of processes of the multi-process is corresponding with the first object event;
Pass through first object event described in each corresponding multiple threads of process in the multi-process, wherein described more
The number of threads of thread is pre-configured with by the proxy server, and the number of threads of the multithreading and the first object thing
Part is corresponding.
2. according to the method described in claim 1, it is characterized in that, obtaining in the proxy server to first mesh
Mark event handled used in after multi-process, the method further includes:
When the quantity of the request of current record in the corresponding default queue of at least one each process is more than preset quantity,
It is sent to client and is used to indicate prompt message of the quantity of the request more than the preset quantity, wherein the request bag
First request is included,
Wherein, include by first object event described in each corresponding multiple threads of process in the multi-process:When
When the quantity of the request of current record is less than the preset quantity in the default queue, by the multi-process
First object event described in the corresponding multiple threads of each process.
3. according to the method described in claim 1, it is characterized in that, obtaining in the proxy server to the first object
Event handled used in multi-process include:
The parent process in the multi-process is determined according to default process model;
Configuration file is initialized by the parent process, wherein the configuration file is handling described for configuring
Required execution parameter during one object event;
Multiple subprocess in the multi-process are determined according to the configuration file after initialization, wherein it is the multiple son into
Journey is used to handle first request.
4. according to the method described in claim 3, it is characterized in that, described in being determined according to the configuration file after initialization
After multiple subprocess in multi-process, the method further includes:
In the case where the first object event reports an error, passes through the multiple subprocess and receive the second request, wherein described the
Two requests execute the second object event for asking, and second object event is to be carried out to the first object event to report an error
Event after recovery;
Second object event is handled according to second request.
5. according to the method described in claim 3, it is characterized in that, described in being determined according to the configuration file after initialization
After multiple subprocess in multi-process, the method further includes:
Reception is used to indicate the upgrade command upgraded to the proxy server;
The proxy server is upgraded according to the upgrade command.
6. according to the method described in claim 1, it is characterized in that, corresponding more by each process in the multi-process
First object event described in thread process includes:
It is obtained by the multithreading and executes the multiple tasks event for meeting the second preset condition in the first object event;
After having executed the multiple task events, third request is obtained, and be used to indicate to client transmission and executed institute
State the first response results of multiple tasks event, wherein third request is for asking to execute third object event, and described the
Three object events are the event executed in remote procedure call.
7. method as claimed in any of claims 1 to 6, which is characterized in that obtaining in the proxy server
In to the first object event handled used in before multi-process, the method further includes:
Load the dynamic link library for executing the first object event, wherein the dynamic link library is packaged with described more
Operation in process for executing the first object event.
8. the method according to the description of claim 7 is characterized in that obtaining in the proxy server to the first object
Event handled used in multi-process include:
Obtain the uniform resource identifier that first request carries, wherein the uniform resource identifier is described for identifying
Multi-process;
The multi-process is obtained from preset memory locations, wherein the preset memory locations according to the uniform resource identifier
Store multiple processes including the multi-process.
9. a kind of event processing apparatus, which is characterized in that including:
First acquisition unit, for obtaining the first request, wherein first request executes first object event for asking,
The first object event is the event executed in remote procedure call;
Second acquisition unit, in the case where first request meets the first preset condition, obtaining in proxy server
In the first object event is carried out handling used multi-process, wherein the number of processes of the multi-process is by the generation
Reason server is pre-configured with, and the number of processes of the multi-process is corresponding with the first object event;
First processing units, for passing through first object described in each corresponding multiple threads of process in the multi-process
Event, wherein the number of threads of the multithreading is pre-configured with by the proxy server, and the number of threads of the multithreading
It is corresponding with the first object event.
10. device according to claim 9, which is characterized in that described device further includes:
Transmission unit, the quantity for working as the request of current record in the corresponding default queue of at least one each process are super
When crossing preset quantity, is sent to client and is used to indicate prompt message of the quantity of the request more than the preset quantity,
In, the request includes first request,
Wherein, first processing units include first processing module, for the request when current record in the default queue
Quantity when being less than the preset quantity, described in each corresponding multiple threads of process in the multi-process
First object event.
11. device according to claim 9, which is characterized in that the second acquisition unit includes:
First determining module, for determining the parent process in the multi-process according to default process model;
Initialization module, for being initialized to configuration file by the parent process, wherein the configuration file is for matching
Set required execution parameter during handling the first object event;
Second determining module, for determining multiple subprocess in the multi-process according to the configuration file after initialization,
Wherein, the multiple subprocess is used to handle first request.
12. according to the devices described in claim 11, which is characterized in that described device further includes:
First receiving unit, for multiple subprocess in determining the multi-process according to the configuration file after initialization
Later, in the case where the first object event reports an error, the second request is received by the multiple subprocess, wherein described
Second request for asking to execute the second object event, second object event be to the first object event that reports an error into
Event after row recovery;
Second processing unit, for handling second object event according to second request.
13. according to the devices described in claim 11, which is characterized in that described device further includes:
Second receiving unit, for multiple subprocess in determining the multi-process according to the configuration file after initialization
Later, it receives and is used to indicate the upgrade command upgraded to the proxy server;
Upgrade unit, for being upgraded to the proxy server according to the upgrade command.
14. device according to claim 9, which is characterized in that the first processing units include:
Second processing module meets the second default item for obtaining and executing by the multithreading in the first object event
The multiple tasks event of part;
Execution module is used for for after having executed the multiple task events, obtaining third request, and to client transmission
Instruction has executed the first response results of the multiple task events, wherein the third request executes third mesh for asking
Mark event, the third object event are the event executed in remote procedure call.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710273195.0A CN108733496B (en) | 2017-04-24 | 2017-04-24 | Event processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710273195.0A CN108733496B (en) | 2017-04-24 | 2017-04-24 | Event processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108733496A true CN108733496A (en) | 2018-11-02 |
CN108733496B CN108733496B (en) | 2023-07-14 |
Family
ID=63934533
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710273195.0A Active CN108733496B (en) | 2017-04-24 | 2017-04-24 | Event processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108733496B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109922141A (en) * | 2019-02-21 | 2019-06-21 | 北京宝兰德软件股份有限公司 | The real time acquiring method and device of activity request list in Java application server |
CN110147269A (en) * | 2019-05-09 | 2019-08-20 | 腾讯科技(上海)有限公司 | A kind of event-handling method, device, equipment and storage medium |
CN110569112A (en) * | 2019-09-12 | 2019-12-13 | 华云超融合科技有限公司 | Log data writing method and object storage daemon device |
CN111770123A (en) * | 2019-04-02 | 2020-10-13 | 华为技术有限公司 | Communication method, apparatus and storage medium |
CN112114976A (en) * | 2020-08-19 | 2020-12-22 | 浙江大搜车融资租赁有限公司 | Service processing method, device, equipment and storage medium |
CN112231114A (en) * | 2020-09-22 | 2021-01-15 | 深圳云天励飞技术股份有限公司 | Event processing method and related equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040123299A1 (en) * | 2002-12-18 | 2004-06-24 | Microsoft Corporation | Unified network thread management |
US20040236989A1 (en) * | 2003-05-09 | 2004-11-25 | Greg Pavlik | Distributed transaction state management through application server clustering |
CN101127685A (en) * | 2007-09-20 | 2008-02-20 | 中兴通讯股份有限公司 | An inter-process communication device and inter-process communication method |
CN105808428A (en) * | 2016-03-03 | 2016-07-27 | 南京大学 | Method for performing unified performance test on distributed file system |
CN106293670A (en) * | 2015-06-03 | 2017-01-04 | 阿里巴巴集团控股有限公司 | A kind of event-handling method, equipment and a kind of server |
-
2017
- 2017-04-24 CN CN201710273195.0A patent/CN108733496B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040123299A1 (en) * | 2002-12-18 | 2004-06-24 | Microsoft Corporation | Unified network thread management |
US20040236989A1 (en) * | 2003-05-09 | 2004-11-25 | Greg Pavlik | Distributed transaction state management through application server clustering |
CN101127685A (en) * | 2007-09-20 | 2008-02-20 | 中兴通讯股份有限公司 | An inter-process communication device and inter-process communication method |
CN106293670A (en) * | 2015-06-03 | 2017-01-04 | 阿里巴巴集团控股有限公司 | A kind of event-handling method, equipment and a kind of server |
CN105808428A (en) * | 2016-03-03 | 2016-07-27 | 南京大学 | Method for performing unified performance test on distributed file system |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109922141A (en) * | 2019-02-21 | 2019-06-21 | 北京宝兰德软件股份有限公司 | The real time acquiring method and device of activity request list in Java application server |
CN111770123A (en) * | 2019-04-02 | 2020-10-13 | 华为技术有限公司 | Communication method, apparatus and storage medium |
CN111770123B (en) * | 2019-04-02 | 2022-01-11 | 华为技术有限公司 | Communication method, apparatus and storage medium |
CN110147269A (en) * | 2019-05-09 | 2019-08-20 | 腾讯科技(上海)有限公司 | A kind of event-handling method, device, equipment and storage medium |
CN110147269B (en) * | 2019-05-09 | 2023-06-13 | 腾讯科技(上海)有限公司 | Event processing method, device, equipment and storage medium |
CN110569112A (en) * | 2019-09-12 | 2019-12-13 | 华云超融合科技有限公司 | Log data writing method and object storage daemon device |
CN112114976A (en) * | 2020-08-19 | 2020-12-22 | 浙江大搜车融资租赁有限公司 | Service processing method, device, equipment and storage medium |
CN112114976B (en) * | 2020-08-19 | 2024-03-22 | 浙江大搜车融资租赁有限公司 | Service processing method, device, equipment and storage medium |
CN112231114A (en) * | 2020-09-22 | 2021-01-15 | 深圳云天励飞技术股份有限公司 | Event processing method and related equipment |
Also Published As
Publication number | Publication date |
---|---|
CN108733496B (en) | 2023-07-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108733496A (en) | Event-handling method and device | |
US10445142B2 (en) | Edge computing platform | |
US9658895B2 (en) | System and method for configuring boot-time parameters of nodes of a cloud computing system | |
CN105765578B (en) | Parallel access of data in a distributed file system | |
CN109478134A (en) | With the on-demand network code of across account nickname execution | |
CN109582466A (en) | A kind of timed task executes method, distributed server cluster and electronic equipment | |
CN109471710A (en) | Processing method, device, processor, terminal and the server of task requests | |
KR20150043377A (en) | System and method for tuning a cloud computing system | |
CN106797670A (en) | Initialized using the physical switches for characterizing state transfer service | |
US20210203714A1 (en) | System and method for identifying capabilities and limitations of an orchestration based application integration | |
CN105847332A (en) | Desktop virtualization method, client device and server-side device | |
CN110287009A (en) | A kind of working node selection method, device, storage medium and server | |
CN111431730B (en) | Service processing method, system, computer equipment and readable medium | |
CN108255585A (en) | SDK exception controls and application program operation method, device and its equipment | |
CN109376163A (en) | A kind of method, apparatus, terminal and the storage medium of data double-way binding | |
WO2014078020A1 (en) | A network-independent programming model for online processing in distributed systems | |
CN107846449B (en) | Method, apparatus, readable storage medium storing program for executing and the equipment of calling system tool | |
CN113867600A (en) | Development method and device for processing streaming data and computer equipment | |
CN107092507A (en) | Skin change method, the apparatus and system of application program | |
Krainyk et al. | Internet-of-Things Device Set Configuration for Connection to Wireless Local Area Network. | |
US6813629B1 (en) | Method and apparatus for facilitating object communication across a network | |
CN107180525A (en) | Bluetooth control method, device, system and the relevant device of a kind of physical equipment | |
CN105068791B (en) | A kind of method and device for realizing bottom library | |
CN110222019A (en) | The method of adjustment and device that file system is taken up space | |
CN111294250B (en) | Pressure testing method, device and system |
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 |