CN112231114A - Event processing method and related equipment - Google Patents

Event processing method and related equipment Download PDF

Info

Publication number
CN112231114A
CN112231114A CN202011001735.8A CN202011001735A CN112231114A CN 112231114 A CN112231114 A CN 112231114A CN 202011001735 A CN202011001735 A CN 202011001735A CN 112231114 A CN112231114 A CN 112231114A
Authority
CN
China
Prior art keywords
processing
target
target event
event
time length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011001735.8A
Other languages
Chinese (zh)
Inventor
兰凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Intellifusion Technologies Co Ltd
Original Assignee
Shenzhen Intellifusion Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Intellifusion Technologies Co Ltd filed Critical Shenzhen Intellifusion Technologies Co Ltd
Priority to CN202011001735.8A priority Critical patent/CN112231114A/en
Publication of CN112231114A publication Critical patent/CN112231114A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses an event processing method and related equipment. The event processing method comprises the following steps: receiving a remote procedure call request sent by a client, wherein the remote procedure call request is used for requesting to process a target event; under the condition that the target processing duration of the target event is not recorded in the duration record table or the target processing duration is recorded in the duration record table and the target duration set comprises the target processing duration, processing the target event by adopting a first event processing strategy; the method comprises the steps that first information is sent to a client in the process that a server processes a target event, the first information is used for indicating that the client is not in a state of waiting for a processing result of the target event, and after the server processes the target event, the server informs the client that the target event is processed in a point-to-point communication mode. By adopting the embodiment of the application, the phenomenon that the client is blocked due to overlong waiting time of the processing result can be avoided.

Description

Event processing method and related equipment
Technical Field
The present application relates to the field of electronic technologies, and in particular, to an event processing method and a related device.
Background
At present, the remote procedure call is mostly that the server side is responsible for monitoring the request from the client side and then providing the requested service for the client side, and the procedure is unidirectional. However, when the client initiates a request with an excessively long processing time to the server, the client may be stuck while waiting for a processing result, and the client cannot serve other threads in a multi-threaded operating environment.
Disclosure of Invention
The embodiment of the application provides an event processing method and related equipment, which are beneficial to avoiding the phenomenon of jamming of a client.
In a first aspect, an embodiment of the present application provides an event processing method, which is applied to a server, and the method includes:
receiving a remote procedure call request, wherein the remote procedure call request is used for requesting to process a target event;
processing the target event by adopting a first event processing strategy under the condition that the target processing time length of the target event is not recorded in a time length record table or the target processing time length is recorded in the time length record table and a target time length set comprises the target processing time length;
and sending first information to the client in the process of processing the target event, wherein the first information is used for indicating that the client is not in a state of waiting for a processing result of the target event, and after the server finishes processing the target event, the server informs the client that the processing of the target event is finished in a point-to-point communication mode.
In a second aspect, an embodiment of the present application provides an event processing apparatus, which is applied to a server, and the apparatus includes:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a remote procedure call sent by a client, and the remote procedure call request is used for requesting to process a target event;
the processing unit is used for processing the target event by adopting a first event processing strategy under the condition that the target processing time length of the target event is not recorded in a time length record table or the target processing time length is recorded in the time length record table and a target time length set comprises the target processing time length;
a sending unit, configured to send first information to the client during processing of the target event, where the first information is used to indicate that the client is not in a state of waiting for a processing result of the target event, and after the server has processed the target event, the server notifies the client in a peer-to-peer communication manner that the processing of the target event is completed.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing steps in the method according to the first aspect of the embodiment of the present application.
In a fourth aspect, an embodiment of the present application provides an event processing method, which is applied to a client, and the method includes:
sending a remote procedure call request, wherein the remote procedure call request is used for requesting to process a target event;
and receiving first information sent by the server, wherein the first information is used for indicating that the client is not in a state of waiting for the processing result of the target event, and after the server finishes processing the target event, the server informs the client that the processing of the target event is finished in a point-to-point communication mode.
In a fifth aspect, an embodiment of the present application provides an event processing apparatus, which is applied to a client, and the apparatus includes:
a sending unit, configured to send a remote procedure call request, where the remote procedure call request is used to request processing of a target event;
a receiving unit, configured to receive first information sent by the server, where the first information is used to indicate that the client is not in a state of waiting for a processing result of the target event, and after the server has processed the target event, the server notifies the client that the processing of the target event is completed in a peer-to-peer communication manner.
In a sixth aspect, the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic data exchange, where the computer program causes a computer to perform some or all of the steps described in the method according to the first aspect or the fourth aspect of the present application.
In a seventh aspect, this application embodiment provides a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, where the computer program is operable to cause a computer to perform some or all of the steps described in the method according to the first aspect or the fourth aspect of this application embodiment. The computer program product may be a software installation package.
It can be seen that, in the embodiment of the present application, a server first receives a remote procedure call request sent by a client, and then, under the condition that a target processing duration of a target event is not recorded in a duration record table, or a target processing duration is recorded in a duration record table and a target duration set includes a target processing duration, processes the target event by using a first event processing policy, and sends first information to the client in the process of processing the target event, where the first information is used to indicate that the client is not in a state of waiting for a processing result of the target event, and after the server has processed the target event, the server notifies the client of the completion of the processing of the target event by using a point-to-point communication manner. Therefore, the first information is sent to the client, so that the phenomenon that the client is stuck due to the fact that the client is always in a state of waiting for the processing result of the target event is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an event processing method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a server according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a client according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an event processing apparatus applied to a server according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an event processing apparatus applied to a client according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The following are detailed below.
The terms "first," "second," "third," and "fourth," etc. in the description and claims of this application and in the accompanying drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The following describes embodiments of the present application in detail.
Referring to fig. 1, fig. 1 is a schematic flow chart of an event processing method according to an embodiment of the present application, including the following steps:
step 101: the client sends a remote procedure call request to the server, wherein the remote procedure call request is used for requesting to process a target event.
Step 102: and the server receives a remote procedure call request sent by the client.
The event may be a function, and the remote procedure call request carries a parameter of the function to be processed.
Step 103: and the server processes the target event by adopting a first event processing strategy under the condition that the target processing time length of the target event is not recorded in the time length record table or the target processing time length is recorded in the time length record table and the target time length set comprises the target processing time length.
Wherein the number of elements in the target duration set is determined based on the number of processing durations recorded in the duration record table.
Step 104: the server sends first information to the client in the process of processing the target event, wherein the first information is used for indicating that the client is not in a state of waiting for a processing result of the target event, and after the server finishes processing the target event, the server informs the client that the processing of the target event is finished in a point-to-point communication mode.
The first information may be represented in the form of a first numerical value, and the first numerical value may be preset or may be specified by a protocol.
Wherein the first information is directly sent as the return information of the target event.
Optionally, the first information may occupy 1 bit, where the value of the 1 bit is 1, and indicates that the client is not in a state of waiting for a processing result of the target event, and the server notifies the client that the target event is processed in a peer-to-peer communication manner after the server processes the target event; or when the value of the 1 bit is 0, indicating that the client is not in a state of waiting for the processing result of the target event, and after the server finishes processing the target event, notifying the client that the processing of the target event is finished by adopting a point-to-point communication mode. Of course, the first information may occupy a plurality of bits, and the indication of the plurality of bits is similar to the indication of the 1 bit, and will not be described herein.
The point-to-point communication mode is that the server side and the client side are directly communicated, and relay equipment does not exist, so that the information forwarding process is avoided, and the time required by data transmission is favorably shortened.
Step 105: and the client receives first information sent by the server and stops waiting for the state of the processing result of the target event according to the received first information.
It can be understood that the client may enter another operation interface to perform another operation after stopping waiting for the processing result of the target event.
In the embodiment of the application, a server firstly receives a remote procedure call request sent by a client, then processes a target event by adopting a first event processing strategy under the condition that a target processing duration of the target event is not recorded in a duration record table or the target processing duration is recorded in the duration record table and a target duration set comprises the target processing duration, and sends first information to the client in the process of processing the target event, wherein the first information is used for indicating that the client is not in a state of waiting for a processing result of the target event, and after the server processes the target event, the server informs the client of the completion of the processing of the target event by adopting a point-to-point communication mode. Therefore, the first information is sent to the client, so that the phenomenon that the client is stuck due to the fact that the client is always in a state of waiting for the processing result of the target event is avoided.
In an implementation manner of the present application, the target duration set is obtained by performing a first process based on the duration record table;
the first process includes the steps of:
determining a first number of processing durations recorded in the duration record table;
determining a second number of target durations included in the set of target durations based on the first ratio and the first number;
and selecting processing time length from the time length record table based on the second quantity and time length selection strategy to obtain the target time length set, wherein the time length selection strategy is selected from the large to the small.
The first ratio may or may not be preset.
If the first ratio is preset, the first ratio may be 20%, or may be other ratios.
Alternatively, the first ratio may be determined based on the first number.
For example, if the first number is greater than 50, the first proportion is 50%, if the first number is 30, the first proportion is 25%, and so on.
Optionally, the determining, based on the first ratio and the first number, a second number of target durations included in the set of target durations includes:
determining a second number of target durations included in the set of target durations based on a first formula, a first ratio, and the first number.
Wherein the first formula is c ═ a ═ b; the a is a first proportion, the b is the number of processing durations recorded in the duration record table, and the c is the number of target durations included in the target duration set.
For example, if the number of processing durations recorded in the duration record table is 20 and the first ratio is 20%, the number of target durations included in the target duration set is 4.
It can be seen that, in the embodiment of the present application, the server determines the target duration set according to the processing duration, based on a phenomenon that the client is favorable to crash because the client is in a wait result state.
In an implementation manner of the present application, the first proportion is determined by performing a second process based on the duration record table;
the second process includes the steps of:
determining a third number of processing durations which are recorded in the duration record table and are greater than or equal to a preset processing duration;
and if the third number is greater than or equal to a preset number, determining the first proportion based on the third number and the first number.
Optionally, the determining the first ratio based on the third number and the first number includes:
determining the first ratio based on the third quantity, the first quantity, and a second formula.
The second formula is D ═ a/B-C, D is a first ratio, a is a third number, B is a fourth number, and C is a preset parameter and can be set according to actual conditions.
For example, if 5 processing time periods (#1, #2, #3, #4, and #5) are recorded in the time period record table, where #1 is 9 minutes, #2 is 8 minutes, #3 is 10 minutes, #4 is 12 minutes, #5 is 5 minutes, the preset processing time period is 6 minutes, and the preset parameter is 0.2, the number of processing time periods greater than the preset processing time period is 4, and thus the first ratio is 60%.
It can be seen that, in the embodiment of the present application, the first ratio is determined by presetting the processing time length, which is beneficial to avoiding the phenomenon that the client is in a waiting result state and crashes due to the fact that the processing time lengths recorded in the time length recording table are all too large.
In one implementation of the present application,
the target duration set is determined by performing third processing based on the duration record table;
the third process includes the steps of:
determining an average processing time length based on the processing time lengths recorded in the time length recording table;
determining the target time length set based on the average processing time length, wherein the processing time length in the target time length set is larger than or equal to the average processing time length.
For example, if 5 processing time periods (#1, #2, #3, #4, and #5) are recorded in the time period record table, where #1 is 5 minutes, #2 is 8 minutes, #3 is 4 minutes, #4 is 1 minute, and #5 is 10 minutes, the average processing time period is 5.6 minutes, and thus the target time period set includes #2 and # 5.
It can be seen that, in the embodiment of the present application, the target duration set is determined by averaging the processing durations, which is beneficial to avoiding the phenomenon that the client is halted due to the duration record table being in a state of waiting for a result.
In an implementation manner of the present application, the first event handling policy includes:
starting a new thread, processing a target event by using the new thread, and recording a first processing starting time and a first processing finishing time of the target event;
determining a first processing duration of the target event based on the first processing start time and the first processing completion time, and recording the target event and the first processing duration into the duration record table in an associated manner;
closing the new thread, and recording the target event and the processing result of the target event into a result record table by adopting the existing first thread, wherein the result record table is used for recording the processing result of event processing.
The opened new thread is only used for processing the target event, and the new thread is closed after the target event is processed.
Wherein the new thread does not exist after the new thread is closed.
If the target event is not recorded in the duration record table, recording the target event and the processing result of the target event in the duration record table in a correlated manner; and if the target event is recorded in the duration record table, recording the target event and the processing result of the target event into the duration record table in a correlation manner, and finishing covering the target event recorded before the duration record table and the processing result of the target event.
It can be seen that, in the embodiment of the present application, the server records the target event and the first processing duration in the duration record table, which is beneficial for determining the event processing policy based on the duration record table when the server processes the target event again.
In an implementation manner of the present application, after the processing the target event by using the first event processing policy, the method further includes:
performing fourth processing on the result record table by adopting an existing second thread;
the fourth process includes the steps of:
traversing the result record table;
under the condition that the result record table is not empty, sending second information to the client in a point-to-point communication mode, wherein the second information is used for indicating that the target event in the result record table is processed;
receiving third information sent by the client in a remote procedure call mode, wherein the third information is used for requesting to send a processing result of the target event;
and sending the processing result of the target event to the client by adopting the remote procedure call mode, and deleting the target event and the processing result of the target event in the result record table.
The first thread and the second thread are not the same thread, and the second thread is only used for performing fourth processing on the result record table.
Wherein the traversal of the result record table is periodic.
It can be seen that, in the embodiment of the present application, after the processing result of the target event is sent to the client, the target event and the processing result of the target event in the result record table are deleted, which is beneficial to relieving the memory pressure of the server.
In an implementation manner of the present application, the method further includes:
and under the condition that the time length record table comprises the target event and the target time length set does not comprise the target processing time length, determining to process the target event by adopting a second event processing strategy.
In an implementation manner of the present application, the second event processing policy includes the following contents:
processing the target event by adopting an existing third thread, and recording a second processing starting time and a second processing finishing time of the target event;
determining a second processing duration of the target event based on the second processing start time and the second processing completion time;
recording the target event and the second processing duration into the duration record table in a correlated manner;
and sending the processing result of the target event in a remote procedure calling mode.
The first thread and the third thread are not the same thread, the first thread and the second thread are not the same thread, and different threads are used for processing different events.
The second processing duration may be longer than the processing duration recorded in the duration record table, may be shorter than the processing duration recorded in the duration record table, and may be equal to the processing duration recorded in the duration record table.
It can be seen that, in the embodiment of the present application, the existing thread is used to process the target event, thereby avoiding the server from allocating the memory for the new thread that is started, and reducing the memory pressure.
Referring to fig. 2 in accordance with the embodiment shown in fig. 1, fig. 2 is a schematic structural diagram of a server according to an embodiment of the present application, and as shown in the drawing, the server includes a processor, a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include instructions for performing the following steps:
receiving a remote procedure call request sent by a client, wherein the remote procedure call request is used for requesting to process a target event;
processing the target event by adopting a first event processing strategy under the condition that the target processing time length of the target event is not recorded in a time length record table or the target processing time length is recorded in the time length record table and a target time length set comprises the target processing time length;
and sending first information to the client in the process of processing the target event, wherein the first information is used for indicating that the client is not in a state of waiting for a processing result of the target event, and after the server finishes processing the target event, the server informs the client that the processing of the target event is finished in a point-to-point communication mode.
In an implementation manner of the present application, the target duration set is obtained by performing a first process based on the duration record table;
the first process includes the steps of:
determining a first number of processing durations recorded in the duration record table;
determining a second number of target durations included in the set of target durations based on the first ratio and the first number;
and selecting processing time length from the time length record table based on the second quantity and time length selection strategy to obtain the target time length set, wherein the time length selection strategy is selected from the large to the small.
In an implementation manner of the present application, the first proportion is determined by performing a second process based on the duration record table;
the second process includes the steps of:
determining a third number of processing durations which are recorded in the duration record table and are greater than or equal to a preset processing duration;
and if the third number is greater than or equal to a preset number, determining the first proportion based on the third number and the first number.
In an implementation manner of the present application, the target duration set is determined by performing a third process based on the duration record table;
the third process includes the steps of:
determining an average processing time length based on the processing time lengths recorded in the time length recording table;
determining the target time length set based on the average processing time length, wherein the processing time length in the target time length set is larger than or equal to the average processing time length.
In an implementation manner of the present application, the first event handling policy includes:
starting a new thread, processing a target event by using the new thread, and recording a first processing starting time and a first processing finishing time of the target event;
determining a first processing duration of the target event based on the first processing start time and the first processing completion time, and recording the target event and the first processing duration into the duration record table in an associated manner;
closing the new thread, and recording the target event and the processing result of the target event into a result record table by adopting the existing first thread, wherein the result record table is used for recording the processing result of event processing.
In an implementation manner of the present application, after the target event is processed by using the first event processing policy, the program includes instructions specifically configured to perform the following steps:
performing fourth processing on the result record table by adopting an existing second thread;
the fourth process includes the steps of:
traversing the result record table;
under the condition that the result record table is not empty, sending second information to the client in a point-to-point communication mode, wherein the second information is used for indicating that the target event in the result record table is processed;
receiving third information sent by the client in a remote procedure call mode, wherein the third information is used for requesting to send a processing result of the target event;
and sending the processing result of the target event to the client by adopting the remote procedure call mode, and deleting the target event and the processing result of the target event in the result record table.
In an implementation manner of the present application, the program includes instructions specifically further configured to perform the following steps:
and under the condition that the time length record table comprises the target event and the target time length set does not comprise the target processing time length, determining to process the target event by adopting a second event processing strategy.
In an implementation manner of the present application, the second event processing policy includes the following contents:
processing the target event by adopting an existing third thread, and recording a second processing starting time and a second processing finishing time of the target event;
determining a second processing duration of the target event based on the second processing start time and the second processing completion time;
recording the target event and the second processing duration into the duration record table in a correlated manner;
and sending the processing result of the target event in a remote procedure calling mode.
It should be noted that, for the specific implementation process of the present embodiment, reference may be made to the specific implementation process described in the above method embodiment, and a description thereof is omitted here.
Referring to fig. 3, in accordance with the embodiment shown in fig. 1, fig. 3 is a schematic structural diagram of a client according to an embodiment of the present application, and as shown in the figure, the client includes a processor, a memory, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the one or more programs include instructions for performing the following steps:
sending a remote procedure call request to a server, wherein the remote procedure call request is used for requesting to process a target event;
and receiving first information sent by the server, wherein the first information is used for indicating that the client is not in a state of waiting for the processing result of the target event, and after the server finishes processing the target event, the server informs the client that the processing of the target event is finished in a point-to-point communication mode.
And stopping waiting for the state of the processing result of the target event according to the received first information.
It can be understood that the client may enter another operation interface to perform another operation after stopping waiting for the processing result of the target event. Therefore, in the embodiment, by receiving the first information sent by the server, the phenomenon that the client is stuck due to the fact that the client is always in a state of waiting for the processing result of the target event can be effectively avoided.
And receiving second information sent by the server in the point-to-point communication mode, wherein the second information is used for indicating that the target event included in the result record table is processed.
And sending third information to the server through the remote process calling mode, wherein the third information is used for requesting to send the processing result of the target event.
And receiving a processing result of the target event sent by the server in the remote procedure call mode.
It should be noted that, for the specific implementation process of the present embodiment, reference may be made to the specific implementation process described in the above method embodiment, and a description thereof is omitted here.
Referring to fig. 4, fig. 4 is a diagram illustrating an event processing apparatus 400 applied to a server according to an embodiment of the present application, where the event processing apparatus 400 includes:
a receiving unit 401, configured to receive a remote procedure call request sent by a client, where the remote procedure call request is used to request processing of a target event;
a processing unit 402, configured to process the target event by using a first event processing policy when a target processing duration of the target event is not recorded in a duration record table, or the target processing duration is recorded in the duration record table and a target duration set includes the target processing duration;
a sending unit 403, configured to send, to the client, first information in a process of processing the target event, where the first information is used to indicate that the client is not in a state of waiting for a processing result of the target event, and after the server has processed the target event, the server notifies the client that the processing of the target event is completed in a peer-to-peer communication manner.
In an implementation manner of the present application, the target duration set is obtained by performing a first process based on the duration record table;
the first process includes the steps of:
determining a first number of processing durations recorded in the duration record table;
determining a second number of target durations included in the set of target durations based on the first ratio and the first number;
and selecting processing time length from the time length record table based on the second quantity and time length selection strategy to obtain the target time length set, wherein the time length selection strategy is selected from the large to the small.
In an implementation manner of the present application, the first proportion is determined by performing a second process based on the duration record table;
the second process includes the steps of:
determining a third number of processing durations which are recorded in the duration record table and are greater than or equal to a preset processing duration;
and if the third number is greater than or equal to a preset number, determining the first proportion based on the third number and the first number.
In an implementation manner of the present application, the target duration set is determined by performing a third process based on the duration record table;
the third process includes the steps of:
determining an average processing time length based on the processing time lengths recorded in the time length recording table;
determining the target time length set based on the average processing time length, wherein the processing time length in the target time length set is larger than or equal to the average processing time length.
In an implementation manner of the present application, the first event handling policy includes:
starting a new thread, processing a target event by using the new thread, and recording a first processing starting time and a first processing finishing time of the target event;
determining a first processing duration of the target event based on the first processing start time and the first processing completion time, and recording the target event and the first processing duration into the duration record table in an associated manner;
closing the new thread, and recording the target event and the processing result of the target event into a result record table by adopting the existing first thread, wherein the result record table is used for recording the processing result of event processing.
In an implementation manner of the present application, after the target event is processed by using the first event processing policy, the processing unit 402 is further specifically configured to execute the following steps:
performing fourth processing on the result record table by adopting an existing second thread;
the fourth process includes the steps of:
traversing the result record table;
under the condition that the result record table is not empty, sending second information to the client in a point-to-point communication mode, wherein the second information is used for indicating that the target event in the result record table is processed;
receiving third information sent by the client in a remote procedure call mode, wherein the third information is used for requesting to send a processing result of the target event;
and sending the processing result of the target event to the client by adopting the remote procedure call mode, and deleting the target event and the processing result of the target event in the result record table.
In an implementation manner of the present application, the processing unit 402 is further specifically configured to execute the following steps:
and under the condition that the time length record table comprises the target event and the target time length set does not comprise the target processing time length, determining to process the target event by adopting a second event processing strategy.
In an implementation manner of the present application, the second event processing policy includes the following contents:
processing the target event by adopting an existing third thread, and recording a second processing starting time and a second processing finishing time of the target event;
determining a second processing duration of the target event based on the second processing start time and the second processing completion time;
recording the target event and the second processing duration into the duration record table in a correlated manner;
and sending the processing result of the target event in a remote procedure calling mode.
It should be noted that the receiving unit 401, the processing unit 402, and the transmitting unit 403 may be implemented by a processor.
Referring to fig. 5, fig. 5 is a diagram illustrating an event processing apparatus 500 applied to a client according to an embodiment of the present application, where the event processing apparatus 500 includes:
a sending unit 501, configured to send a remote procedure call request to a server, where the remote procedure call request is used to request processing of a target event;
a receiving unit 502, configured to receive first information sent by the server, where the first information is used to indicate that the client is not in a state of waiting for a processing result of the target event, and after the server has processed the target event, the server notifies the client that the processing of the target event is completed in a peer-to-peer communication manner;
the processing unit 503 is configured to stop waiting for the state of the processing result of the target event according to the received first information.
It can be understood that the client may enter another operation interface to perform another operation after stopping waiting for the processing result of the target event. Therefore, in the embodiment, by receiving the first information sent by the server, the phenomenon that the client is stuck due to the fact that the client is always in a state of waiting for the processing result of the target event can be effectively avoided.
The receiving unit 502 is further configured to receive second information sent by the server in the peer-to-peer communication manner, where the second information is used to indicate that the processing of the target event included in the result record table is completed.
The sending unit 501 is further configured to send third information to the server through the remote procedure call mode, where the third information is used to request sending of a processing result of the target event.
The receiving unit 502 is further configured to receive a processing result of the target event sent by the server in the remote procedure call manner.
The embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic data exchange, where the computer program makes a computer perform some or all of the steps described in the terminal device in the above method embodiment.
Embodiments of the present application also provide a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform some or all of the steps described in the above method for a terminal device. The computer program product may be a software installation package.
The steps of a method or algorithm described in the embodiments of the present application may be implemented in hardware, or may be implemented by a processor executing software instructions. The software instructions may be comprised of corresponding software modules that may be stored in Random Access Memory (RAM), flash Memory, Read Only Memory (ROM), Erasable Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), registers, a hard disk, a removable disk, a compact disc Read Only Memory (CD-ROM), or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an ASIC. Additionally, the ASIC may reside in an access network device, a target network device, or a core network device. Of course, the processor and the storage medium may reside as discrete components in an access network device, a target network device, or a core network device.
Those skilled in the art will appreciate that in one or more of the examples described above, the functionality described in the embodiments of the present application may be implemented, in whole or in part, by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., Digital Video Disk (DVD)), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the embodiments of the present application in further detail, and it should be understood that the above-mentioned embodiments are only specific embodiments of the present application, and are not intended to limit the scope of the embodiments of the present application, and any modifications, equivalent substitutions, improvements and the like made on the basis of the technical solutions of the embodiments of the present application should be included in the scope of the embodiments of the present application.

Claims (14)

1. An event processing method applied to a server, the method comprising:
receiving a remote procedure call request sent by a client, wherein the remote procedure call request is used for requesting to process a target event;
processing the target event by adopting a first event processing strategy under the condition that the target processing time length of the target event is not recorded in a time length record table or the target processing time length is recorded in the time length record table and a target time length set comprises the target processing time length;
and sending first information to the client in the process of processing the target event, wherein the first information is used for indicating that the client is not in a state of waiting for a processing result of the target event, and after the server finishes processing the target event, the server informs the client that the processing of the target event is finished in a point-to-point communication mode.
2. The method according to claim 1, wherein the target duration set is obtained by performing a first process based on the duration record table;
the first process includes the steps of:
determining a first number of processing durations recorded in the duration record table;
determining a second number of target durations included in the set of target durations based on the first ratio and the first number;
and selecting processing time length from the time length record table based on the second quantity and time length selection strategy to obtain the target time length set, wherein the time length selection strategy is selected from the large to the small.
3. The method according to claim 2, wherein the first proportion is determined by performing a second process based on the duration record table;
the second process includes the steps of:
determining a third number of processing durations which are recorded in the duration record table and are greater than or equal to a preset processing duration;
and if the third number is greater than or equal to a preset number, determining the first proportion based on the third number and the first number.
4. The method of claim 1, wherein the target duration set is determined by a third process based on the duration record table;
the third process includes the steps of:
determining an average processing time length based on the processing time lengths recorded in the time length recording table;
determining the target time length set based on the average processing time length, wherein the processing time length in the target time length set is larger than or equal to the average processing time length.
5. The method of any of claims 1-4, wherein the first event handling policy comprises:
starting a new thread, processing a target event by using the new thread, and recording a first processing starting time and a first processing finishing time of the target event;
determining a first processing duration of the target event based on the first processing start time and the first processing completion time, and recording the target event and the first processing duration into the duration record table in an associated manner;
closing the new thread, and recording the target event and the processing result of the target event into a result record table by adopting the existing first thread, wherein the result record table is used for recording the processing result of event processing.
6. The method of claim 5, wherein after processing the target event with the first event processing policy, the method further comprises:
performing fourth processing on the result record table by adopting an existing second thread;
the fourth process includes the steps of:
traversing the result record table;
under the condition that the result record table is not empty, sending second information to the client in a point-to-point communication mode, wherein the second information is used for indicating that the target event in the result record table is processed;
receiving third information sent by the client in a remote procedure call mode, wherein the third information is used for requesting to send a processing result of the target event;
and sending the processing result of the target event to the client by adopting the remote procedure call mode, and deleting the target event and the processing result of the target event in the result record table.
7. The method of claim 1, further comprising:
and under the condition that the time length record table comprises the target event and the target time length set does not comprise the target processing time length, determining to process the target event by adopting a second event processing strategy.
8. The method of claim 7, wherein the second event handling policy comprises:
processing the target event by adopting an existing third thread, and recording a second processing starting time and a second processing finishing time of the target event;
determining a second processing duration of the target event based on the second processing start time and the second processing completion time;
recording the target event and the second processing duration into the duration record table in a correlated manner;
and sending the processing result of the target event in a remote procedure calling mode.
9. An event processing method applied to a client, the method comprising:
sending a remote procedure call request to a server, wherein the remote procedure call request is used for requesting to process a target event;
and receiving first information sent by the server, wherein the first information is used for indicating that the client is not in a state of waiting for the processing result of the target event, and after the server finishes processing the target event, the server informs the client that the processing of the target event is finished in a point-to-point communication mode.
10. An event processing apparatus, applied to a server, the apparatus comprising:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is used for receiving a remote procedure call request sent by a client, and the remote procedure call request is used for requesting to process a target event;
the processing unit is used for processing the target event by adopting a first event processing strategy under the condition that the target processing time length of the target event is not recorded in a time length record table or the target processing time length is recorded in the time length record table and a target time length set comprises the target processing time length;
a sending unit, configured to send first information to the client during processing of the target event, where the first information is used to indicate that the client is not in a state of waiting for a processing result of the target event, and after the server has processed the target event, the server notifies the client in a peer-to-peer communication manner that the processing of the target event is completed.
11. An event processing apparatus applied to a client, the apparatus comprising:
a sending unit, configured to send a remote procedure call request, where the remote procedure call request is used to request processing of a target event;
a receiving unit, configured to receive first information sent by the server, where the first information is used to indicate that the client is not in a state of waiting for a processing result of the target event, and after the server has processed the target event, the server notifies the client that the processing of the target event is completed in a peer-to-peer communication manner.
12. A server, characterized in that the server comprises a processor, memory, and one or more programs stored in the memory and configured to be executed by the processor, the one or more programs comprising instructions for performing the steps in the method of any of claims 1-8.
13. A client, comprising a processor, memory, and one or more programs stored in the memory and configured to be executed by the processor, the one or more programs including instructions for performing the steps in the method of claim 9.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, wherein the computer program causes a computer to perform the method according to any one of claims 1-9.
CN202011001735.8A 2020-09-22 2020-09-22 Event processing method and related equipment Pending CN112231114A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011001735.8A CN112231114A (en) 2020-09-22 2020-09-22 Event processing method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011001735.8A CN112231114A (en) 2020-09-22 2020-09-22 Event processing method and related equipment

Publications (1)

Publication Number Publication Date
CN112231114A true CN112231114A (en) 2021-01-15

Family

ID=74107375

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011001735.8A Pending CN112231114A (en) 2020-09-22 2020-09-22 Event processing method and related equipment

Country Status (1)

Country Link
CN (1) CN112231114A (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970592A (en) * 2013-01-25 2014-08-06 深圳市金证科技股份有限公司 Single-thread multi-task processing method and server of transaction middleware
CN104268007A (en) * 2014-01-07 2015-01-07 深圳市华傲数据技术有限公司 Distributed event request scheduling method and system
CN107493312A (en) * 2016-06-12 2017-12-19 中国移动通信集团安徽有限公司 A kind of service calling method and device
CN107766129A (en) * 2016-08-17 2018-03-06 北京金山云网络技术有限公司 A kind of task processing method, apparatus and system
CN108733496A (en) * 2017-04-24 2018-11-02 腾讯科技(上海)有限公司 Event-handling method and device
WO2018223800A1 (en) * 2017-06-08 2018-12-13 腾讯科技(深圳)有限公司 Data processing method and device, storage medium, and electronic device
CN109684047A (en) * 2018-08-21 2019-04-26 平安普惠企业管理有限公司 Event-handling method, device, equipment and computer storage medium
CN110502318A (en) * 2019-07-23 2019-11-26 平安科技(深圳)有限公司 Event-handling method, event processing server, storage medium and device
CN110557398A (en) * 2019-09-12 2019-12-10 金蝶软件(中国)有限公司 Service request control method, device, system, computer equipment and storage medium
CN110633133A (en) * 2018-06-21 2019-12-31 中兴通讯股份有限公司 Task processing method and device and computer readable storage medium
WO2020168933A1 (en) * 2019-02-22 2020-08-27 香港乐蜜有限公司 Network request processing method, device, terminal and storage medium
CN111597026A (en) * 2020-05-15 2020-08-28 北京百度网讯科技有限公司 Method and device for acquiring information

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970592A (en) * 2013-01-25 2014-08-06 深圳市金证科技股份有限公司 Single-thread multi-task processing method and server of transaction middleware
CN104268007A (en) * 2014-01-07 2015-01-07 深圳市华傲数据技术有限公司 Distributed event request scheduling method and system
CN107493312A (en) * 2016-06-12 2017-12-19 中国移动通信集团安徽有限公司 A kind of service calling method and device
CN107766129A (en) * 2016-08-17 2018-03-06 北京金山云网络技术有限公司 A kind of task processing method, apparatus and system
CN108733496A (en) * 2017-04-24 2018-11-02 腾讯科技(上海)有限公司 Event-handling method and device
WO2018223800A1 (en) * 2017-06-08 2018-12-13 腾讯科技(深圳)有限公司 Data processing method and device, storage medium, and electronic device
CN110633133A (en) * 2018-06-21 2019-12-31 中兴通讯股份有限公司 Task processing method and device and computer readable storage medium
CN109684047A (en) * 2018-08-21 2019-04-26 平安普惠企业管理有限公司 Event-handling method, device, equipment and computer storage medium
WO2020168933A1 (en) * 2019-02-22 2020-08-27 香港乐蜜有限公司 Network request processing method, device, terminal and storage medium
CN110502318A (en) * 2019-07-23 2019-11-26 平安科技(深圳)有限公司 Event-handling method, event processing server, storage medium and device
CN110557398A (en) * 2019-09-12 2019-12-10 金蝶软件(中国)有限公司 Service request control method, device, system, computer equipment and storage medium
CN111597026A (en) * 2020-05-15 2020-08-28 北京百度网讯科技有限公司 Method and device for acquiring information

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LW-留下的兵: "后台处理请求时间过长导致页面超时", pages 2, Retrieved from the Internet <URL:https://blog.csdn.net/sinat_37356064/article/details/78116116> *

Similar Documents

Publication Publication Date Title
CN110620890A (en) File uploading method and system
CN107172171B (en) Service request processing method and device and computer readable storage medium
CN109743411B (en) Method, device and storage medium for dynamically scheduling IP proxy pool in distributed environment
CN110008041B (en) Message processing method and device
CN112214313A (en) Memory allocation method and related equipment
CN107026879B (en) Data caching method and background application system
CN112837088B (en) Advertisement putting method, advertisement putting device, advertisement putting medium and electronic equipment
CN113687781A (en) Method, device, equipment and medium for pulling up thermal data
CN111282263A (en) Event message processing method and device, electronic equipment and readable storage medium
CN107959890B (en) Detection method, device, terminal and storage medium for reserved recording
CN112653736B (en) Parallel source returning method and device and electronic equipment
US20030097418A1 (en) Portable information communication terminal
CN112231114A (en) Event processing method and related equipment
CN115412609B (en) Service processing method, device, server and storage medium
CN108234658B (en) Method and device for sensing health condition of server cluster and server
CN113691879B (en) Video data processing method, electronic device, and computer-readable storage medium
CN110351334B (en) Service request processing method and device and payment service request processing method and device
CN110113187B (en) Configuration updating method and device, configuration server and configuration system
CN110083482B (en) Method and device for performing erasure code processing on file storage system and electronic equipment
CN110308938B (en) Management method and device for plugging and unplugging peripheral events
CN114089912A (en) Data processing method and device based on message middleware and storage medium
CN112671590A (en) Data transmission method and device, electronic equipment and computer storage medium
CN113703965B (en) Resource processing method, system, equipment and computer readable storage medium
CN114422831B (en) Media playing method and device, electronic equipment and readable storage medium
CN111427507B (en) Disk connection method and device and electronic equipment

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