CN108733496B - Event processing method and device - Google Patents
Event processing method and device Download PDFInfo
- Publication number
- CN108733496B CN108733496B CN201710273195.0A CN201710273195A CN108733496B CN 108733496 B CN108733496 B CN 108733496B CN 201710273195 A CN201710273195 A CN 201710273195A CN 108733496 B CN108733496 B CN 108733496B
- Authority
- CN
- China
- Prior art keywords
- target event
- request
- event
- processes
- processing
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; 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
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Computer And Data Communications (AREA)
Abstract
Description
技术领域technical field
本发明涉及互联网领域,具体而言,涉及一种事件处理方法和装置。The present invention relates to the Internet field, in particular, to an event processing method and device.
背景技术Background technique
目前,在互联网的事件处理中,在面对大量的服务开发需求时,在不同的场景下,难以构建一个高性能、高并发、易上手、健壮性强的后台远程过程调用框架。特别是在计算任务密集、网络IO密集等场景下,对远程过程调用(Remote Procedure Call,简称为RPC)框架又有不同的要求。通常所采用的方法为采用单进程模式下的单进程服务。At present, in the event processing of the Internet, in the face of a large number of service development needs, it is difficult to build a high-performance, high-concurrency, easy-to-use, and robust background remote procedure call framework in different scenarios. Especially in scenarios such as intensive computing tasks and intensive network IO, there are different requirements for the Remote Procedure Call (Remote Procedure Call, RPC for short) framework. The usual method is to use a single-process service in a single-process mode.
图1是根据相关技术中的一种单进程模式下的事件处理的示意图。如图1所示,在单进程模式下,客户端根据需要服务器执行的目标事件发送用户请求,该用户请求可以为多个用户请求,IO线程专门处理网络IO,通过该IO线程接收用户请求。在通过IO线程接收到用户请求之后,通过任务队列中的多个任务(task),将用户请求通过线程池中的多个子进程进行处理,进而完成对用户请求对应的目标事件进行处理。Fig. 1 is a schematic diagram of event processing in a single process mode according to the related art. As shown in Figure 1, in the single-process mode, the client sends a user request according to the target event that needs to be executed by the server. The user request can be multiple user requests. The IO thread is dedicated to network IO, and the user request is received through the IO thread. After the user request is received through the IO thread, the user request is processed through multiple sub-processes in the thread pool through multiple tasks in the task queue, and then the target event corresponding to the user request is processed.
对于上述技术方案,单进程模式下的事件处理存在以下问题:For the above technical solution, the event processing in the single-process mode has the following problems:
(1)在单进程模式下,容易产生崩溃(crash)现象,并且在崩溃之后再重新启动也需要一定时间,从而造成服务在一定时间内大量不可用的状态。(1) In the single-process mode, crashes are prone to occur, and it takes a certain amount of time to restart after a crash, resulting in a large number of unavailable services within a certain period of time.
(2)对于用于事件处理的网络框架和业务模块,在修改或者更新业务模块的业务逻辑之后,需要重新跟上述网络框架一起编译,从而造成事件处理的效率低下。(2) For the network framework and business module used for event processing, after modifying or updating the business logic of the business module, it needs to be recompiled together with the above network framework, resulting in low efficiency of event processing.
(3)对于计算密集型的服务,每个用户请求的时间都比较长,并且没有对任务队列的长度进行控制,容易造成服务雪崩。(3) For computing-intensive services, each user's request time is relatively long, and the length of the task queue is not controlled, which is likely to cause a service avalanche.
(4)在开发业务时,需要考虑多线程的并发安全问题。(4) When developing business, it is necessary to consider the concurrent security issues of multi-threading.
(5)现有的事件处理框架只能支持多线程或者多进程中的其中一种,不能满足不同服务的需求,从而造成相关技术远程过程调用中的事件处理效率低下。(5) The existing event processing framework can only support one of multi-thread or multi-process, and cannot meet the requirements of different services, resulting in low efficiency of event processing in the remote procedure call of the related technology.
针对上述相关技术远程过程调用中的事件处理效率低下的问题,目前尚未提出有效的解决方案。For the problem of low event processing efficiency in the remote procedure call of the above-mentioned related technology, no effective solution has been proposed yet.
发明内容Contents of the invention
本发明实施例提供了一种事件处理方法和装置,以至少解决相关技术远程过程调用中的事件处理效率低下的技术问题。Embodiments of the present invention provide an event processing method and device to at least solve the technical problem of low event processing efficiency in remote procedure calls in the related art.
根据本发明实施例的一个方面,提供了一种事件处理方法。该事件处理方法包括:获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件;在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应;通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。According to an aspect of the embodiments of the present invention, an event processing method is provided. The event processing method includes: obtaining a first request, wherein the first request is used to request the execution of a first target event, and the first target event is an event executed in a remote procedure call; when the first request meets the first preset condition In this case, obtain the multi-process used to process the first target event in the proxy server, wherein the number of processes in the multi-process is pre-configured by the proxy server, and the number of processes in the multi-process corresponds to the first target event; The multi-thread corresponding to each process in the process processes the first target event, wherein the number of multi-thread threads is pre-configured by the proxy server, and the number of multi-thread threads corresponds to the first target event.
根据本发明实施例的另一方面,还提供了一种事件处理装置。该事件处理装置包括:第一获取单元,用于获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件;第二获取单元,用于在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应;第一处理单元,用于通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。According to another aspect of the embodiments of the present invention, an event processing device is also provided. The event processing device includes: a first obtaining unit, configured to obtain a first request, wherein the first request is used to request execution of a first target event, and the first target event is an event executed in a remote procedure call; a second obtaining unit , used to obtain the multi-process used to process the first target event in the proxy server when the first request meets the first preset condition, wherein the number of multi-process processes is pre-configured by the proxy server, and the multi-process The number of processes of the process corresponds to the first target event; the first processing unit is configured to process the first target event through multi-threads corresponding to each process in the multi-processes, wherein the number of multi-threaded threads is pre-configured by the proxy server, And the number of threads of the multi-thread corresponds to the first target event.
在本发明实施例中,采用获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件;在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应;通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。由于同时采用多进程和多线程处理事件,能够满足各式各样的事件处理需求,从而实现了提高远程过程调用中的事件处理效率的技术效果,进而解决了相关技术远程过程调用中的事件处理效率低下的技术问题。In the embodiment of the present invention, the first request is obtained, wherein the first request is used to request the execution of the first target event, and the first target event is an event executed in a remote procedure call; when the first request conforms to the first preset In the case of a condition, obtain the multi-process used for processing the first target event in the proxy server, wherein the number of processes in the multi-process is pre-configured by the proxy server, and the number of processes in the multi-process corresponds to the first target event; The first target event is processed through multi-threads corresponding to each process in the multi-processes, wherein the number of threads of the multi-threads is pre-configured by the proxy server, and the number of threads of the multi-threads corresponds to the first target event. Due to the use of multi-process and multi-thread processing events at the same time, it can meet various event processing requirements, thereby achieving the technical effect of improving the event processing efficiency in remote procedure calls, and then solving the event processing in related technology remote procedure calls Inefficient technical issues.
附图说明Description of drawings
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The accompanying drawings described here are used to provide a further understanding of the present invention and constitute a part of the application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations to the present invention. In the attached picture:
图1是根据相关技术中的一种单进程模式下的事件处理的示意图;FIG. 1 is a schematic diagram of event processing in a single-process mode according to the related art;
图2是根据本发明实施例的一种事件处理方法的硬件环境的示意图;FIG. 2 is a schematic diagram of a hardware environment of an event processing method according to an embodiment of the present invention;
图3是根据本发明实施例的一种事件处理方法的流程图;Fig. 3 is a flowchart of an event processing method according to an embodiment of the present invention;
图4是根据本发明实施例的另一种事件处理方法的流程图;FIG. 4 is a flowchart of another event processing method according to an embodiment of the present invention;
图5是根据本发明实施例的一种获取在代理服务器中对第一目标事件进行处理所使用的多进程的方法的流程图;Fig. 5 is a flow chart of a method for obtaining the multi-process used for processing the first target event in the proxy server according to an embodiment of the present invention;
图6是根据本发明实施例的另一种事件处理方法的流程图;Fig. 6 is a flowchart of another event processing method according to an embodiment of the present invention;
图7是根据本发明实施例的另一种事件处理方法的流程图;FIG. 7 is a flowchart of another event processing method according to an embodiment of the present invention;
图8是根据本发明实施例的一种通过多进程中每个进程分别对应的多线程处理第一目标事件的方法的流程图;FIG. 8 is a flow chart of a method for processing a first target event through multi-threads corresponding to each process in the multi-processes according to an embodiment of the present invention;
图9是根据本发明实施例的另一种获取在代理服务器中对第一目标事件进行处理所使用的多进程的方法的流程图;FIG. 9 is a flow chart of another method for acquiring the multi-process used to process the first target event in the proxy server according to an embodiment of the present invention;
图10是根据本发明实施例的一种多进程模型的示意图;Fig. 10 is a schematic diagram of a multi-process model according to an embodiment of the present invention;
图11是根据本发明实施例的一种远程过程调用的多线程模型的示意图;Fig. 11 is a schematic diagram of a multi-thread model of a remote procedure call according to an embodiment of the present invention;
图12是根据本发明实施例的一种动态RPC处理模型的示意图;Fig. 12 is a schematic diagram of a dynamic RPC processing model according to an embodiment of the present invention;
图13是根据本发明实施例的一种事件处理装置的示意图;Fig. 13 is a schematic diagram of an event processing device according to an embodiment of the present invention;
图14是根据本发明实施例的另一种事件处理装置的示意图;Fig. 14 is a schematic diagram of another event processing device according to an embodiment of the present invention;
图15是根据本发明实施例的另一种事件处理装置的示意图;Fig. 15 is a schematic diagram of another event processing device according to an embodiment of the present invention;
图16是根据本发明实施例的另一种事件处理装置的示意图;Fig. 16 is a schematic diagram of another event processing device according to an embodiment of the present invention;
图17是根据本发明实施例的另一种事件处理装置的示意图;Fig. 17 is a schematic diagram of another event processing device according to an embodiment of the present invention;
图18是根据本发明实施例的另一种事件处理装置的示意图;以及18 is a schematic diagram of another event processing device according to an embodiment of the present invention; and
图19是根据本发明实施例的一种终端的结构框图。Fig. 19 is a structural block diagram of a terminal according to an embodiment of the present invention.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only It is an embodiment of a part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts shall fall within the protection scope of the present invention.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first" and "second" in the description and claims of the present invention and the above drawings are used to distinguish similar objects, but not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used are interchangeable under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", as well as any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product or device comprising a sequence of steps or elements is not necessarily limited to the expressly listed instead, may include other steps or elements not explicitly listed or inherent to the process, method, product or apparatus.
实施例1Example 1
根据本发明实施例,提供了一种事件处理方法的实施例。According to an embodiment of the present invention, an embodiment of an event processing method is provided.
可选地,在本实施例中,上述事件处理方法可以应用于如图2所示的由服务器202和终端204所构成的硬件环境中。图2是根据本发明实施例的一种事件处理方法的硬件环境的示意图。如图2所示,服务器202通过网络与终端204进行连接,上述网络包括但不限于:广域网、城域网或局域网,终端204并不限定于PC、手机、平板电脑等。本发明实施例的事件处理方法可以由服务器202来执行,也可以由终端204来执行,还可以是由服务器202和终端204共同执行。其中,终端204执行本发明实施例的事件处理方法也可以是由安装在其上的客户端来执行。Optionally, in this embodiment, the above event processing method may be applied to a hardware environment composed of a
图3是根据本发明实施例的一种事件处理方法的流程图。如图3所示,该方法可以包括以下步骤:Fig. 3 is a flowchart of an event processing method according to an embodiment of the present invention. As shown in Figure 3, the method may include the following steps:
步骤S302,获取第一请求。Step S302, acquiring a first request.
在本申请上述步骤S302提供的技术方案中,获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件。In the technical solution provided in step S302 of the present application, a first request is obtained, wherein the first request is used to request execution of a first target event, and the first target event is an event executed in a remote procedure call.
该实施例基于Nginx代理服务源码进行改造开发,其中,Nginx是一个高性能的超文本传输协议(HyperText Transfer Protocol,简称为HTTP)和反向代理服务器。远程过程调用可以将客户端发送的请求传送至服务器,并且可以在网上发送和接收响应。由于通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术,使得开发包括网络分布式多程序在内的应用程序更加容易。This embodiment is modified and developed based on the Nginx proxy service source code, wherein Nginx is a high-performance HyperText Transfer Protocol (HyperText Transfer Protocol, referred to as HTTP) and a reverse proxy server. Remote procedure calls can transfer requests sent by clients to servers, and can send and receive responses over the wire. Since services are requested from remote computer programs over the network without knowledge of the underlying network technology, it is easier to develop applications including network distributed multiprogramming.
客户端对于不同的事件发送不同的用户请求,其中,事件为在RPC框架下进行服务开发的事件。可选地,接收客户端发送的用于请求执行第一目标事件的第一请求,其中,第一目标事件为在RPC框架下执行的事件,第一请求可以为用于请求在对服务健壮性要求较高的情况下执行第一目标事件的用户请求,也即,第一请求可以为在对于规范要求以外的输入情况的处理能力要求较高的情况下执行第一目标事件的请求,也可以为用于请求在需要大量进程内存读写的情况下执行第一目标事件的请求,从而能够使事件处理满足各式各样服务的开发需求。The client sends different user requests for different events, where the event is an event for service development under the RPC framework. Optionally, receiving the first request sent by the client for requesting the execution of the first target event, wherein the first target event is an event executed under the RPC framework, and the first request may be a request for the robustness of the service The user request to execute the first target event in the case of higher requirements, that is, the first request may be a request to execute the first target event in the case of a higher processing capability requirement for input situations other than specification requirements, or it may It is used to request the execution of the first target event when a large amount of process memory reading and writing is required, so that the event processing can meet the development requirements of various services.
可选地,统计客户端当前发送过来的请求的数量,将请求的数量存储至任务队列中,该任务队列的长度可配置。当请求的数量超过预设长度时,发送用于指示请求的数量超过预设长度的提示信息,从而有效地防止过量请求造成的服务器雪崩的情况发生。Optionally, the number of requests currently sent by the client is counted, and the number of requests is stored in a task queue, the length of which is configurable. When the number of requests exceeds the preset length, a prompt message indicating that the number of requests exceeds the preset length is sent, thereby effectively preventing the occurrence of server avalanche caused by excessive requests.
步骤S304,获取在代理服务器中对第一目标事件进行处理所使用的多进程。Step S304, acquiring the multi-process used for processing the first target event in the proxy server.
在本申请上述步骤S304提供的技术方案中,在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应。In the technical solution provided by the above step S304 of this application, if the first request meets the first preset condition, the multi-process used to process the first target event in the proxy server is acquired, wherein the multi-process process The number is pre-configured by the proxy server, and the number of processes of the multi-process corresponds to the first target event.
第一预设条件为用于确定是否使用多进程的条件,比如,第一预设条件为用于获取在代理服务器中对第一目标事件进行处理所使用的多进程的条件。可选地,在对服务健壮性要求较高情况下,第一请求符合第一预设条件。在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程。其中,进程是程序在计算机上的一次执行活动,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应,也即,不同的事件使用的多进程的进程数量是不同的,可以由代理服务器根据事件的情况进行预先配置。The first preset condition is a condition for determining whether to use multi-process, for example, the first preset condition is a condition for obtaining the multi-process used for processing the first target event in the proxy server. Optionally, in a case where the robustness of the service is highly required, the first request meets the first preset condition. When the first request meets the first preset condition, the multi-process used for processing the first target event in the proxy server is acquired. Wherein, a process is an execution activity of a program on a computer, and the number of multi-process processes is pre-configured by the proxy server, and the number of multi-process processes corresponds to the first target event, that is, the multi-process processes used by different events The number varies and can be pre-configured by the proxy server depending on the circumstances of the event.
可选地,利用Nginx原生的多进程模型,同时满足多进程的健壮性和服务器崩溃(crash)秒拉起的特性,最大限度地降低服务器崩溃所带来的服务不可用的问题。在多进程模式下,也无需考虑多线程的并发安全,从而提高了事件处理的安全性。Optionally, use Nginx's native multi-process model to simultaneously satisfy the robustness of multi-process and the characteristics of pulling up within seconds of a server crash, so as to minimize the problem of service unavailability caused by server crash. In the multi-process mode, there is no need to consider the concurrent safety of multi-threading, thereby improving the safety of event processing.
步骤S306,通过多进程中每个进程分别对应的多线程处理第一目标事件。Step S306, processing the first target event through the multi-threads corresponding to each process in the multi-processes.
在本申请上述步骤S306提供的技术方案中,通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。In the technical solution provided by the above step S306 of the present application, the first target event is processed through the multi-threads corresponding to each process in the multi-processes, wherein the number of multi-threaded threads is pre-configured by the proxy server, and the number of multi-threaded threads is the same as Corresponds to the first target event.
线程为轻量级进程,是程序执行流中的最小单元,是程序中一个单一的顺序控制流程。一个标准的线程由线程ID、当前指令指针、寄存器集合和堆栈组成。另外,线程是进程中的一个实体,是被系统独立调度和分派的基本单位,线程只拥有在运行中必不可少的资源,但是它可以与同属于一个进程的其它线程共享进程所拥有的全部资源。一个线程可以创建和撤消另一个线程,同一进程中的多个线程之间可以并发执行。在单个程序中同时运行多个线程从而完成不同的工作,该多个线程称为多线程。A thread is a lightweight process, the smallest unit in a program's execution flow, and a single sequential control flow in a program. A standard thread consists of thread ID, current instruction pointer, register set and stack. In addition, a thread is an entity in a process, and is the basic unit independently scheduled and dispatched by the system. A thread only owns essential resources during operation, but it can share all the resources owned by the process with other threads belonging to the same process. resource. One thread can create and cancel another thread, and multiple threads in the same process can execute concurrently. Multiple threads running simultaneously in a single program to accomplish different tasks are called multithreading.
在获取在代理服务器中对第一目标事件进行处理所使用的多进程之后,获取多进程中每个进程对应的多线程,通过多线程处理第一目标事件。该多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。After obtaining the multi-process used for processing the first target event in the proxy server, obtain the multi-thread corresponding to each process in the multi-process, and process the first target event through the multi-thread. The number of threads of the multi-thread is preconfigured by the proxy server, and the number of threads of the multi-thread corresponds to the first target event.
在该实施例中,多进程的数量和多线程的数量可以配置,多进程的数量与多线程的数量的比例也可以配置。当进程的数量为1,而该进程中的线程的数量为多个时,则此时可以看作为多线程;当进程的数量为多个,多个进程中每个进程对应的线程的数量为1,则可以看作为多进程。多进程模式下,无需考虑多线程的并发处理的安全性。In this embodiment, the number of multi-processes and the number of multi-threads can be configured, and the ratio of the number of multi-processes to the number of multi-threads can also be configured. When the number of processes is 1, and the number of threads in the process is multiple, it can be regarded as multi-threading at this time; when the number of processes is multiple, the number of threads corresponding to each process in multiple processes is 1, it can be regarded as multi-process. In multi-process mode, there is no need to consider the security of multi-threaded concurrent processing.
可选地,该实施例同时支持多进程和多线程,可以在对服务健壮性要求较高情况下选用多进程;在需要大量进程内存读写情况下选用多线程,能够满足各式各样服务开发的需求,从而提高了远程过程调用中的事件处理效率。Optionally, this embodiment supports multi-process and multi-thread at the same time, and multi-process can be selected when the robustness of the service is required; multi-thread can be selected when a large amount of process memory is read and written, which can satisfy various services. Development needs, thereby improving the efficiency of event handling in remote procedure calls.
通过上述步骤S302至步骤S306,采用获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件;在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应;通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。由于同时采用多进程和多线程处理事件,能够满足各式各样的事件处理需求,从而实现了提高远程过程调用中的事件处理效率的技术效果,进而解决了相关技术远程过程调用中的事件处理效率低下的技术问题。Through the above steps S302 to S306, the acquisition of the first request is adopted, wherein the first request is used to request the execution of the first target event, and the first target event is an event executed in the remote procedure call; when the first request meets the first predetermined In the case of setting conditions, obtain the multi-process used for processing the first target event in the proxy server, wherein the number of processes in the multi-process is pre-configured by the proxy server, and the number of processes in the multi-process corresponds to the first target event ; Process the first target event through the multi-threads corresponding to each process in the multi-processes, wherein the number of threads of the multi-threads is pre-configured by the proxy server, and the number of threads of the multi-threads corresponds to the first target event. Due to the use of multi-process and multi-thread processing events at the same time, it can meet various event processing requirements, thereby achieving the technical effect of improving the event processing efficiency in remote procedure calls, and then solving the event processing in related technology remote procedure calls Inefficient technical issues.
作为一种可选的实施方式,在获取在代理服务器中对第一目标事件进行处理所使用的多进程之后,在每个进程分别对应的预设队列中当前记录的请求的数量超过预设数量的情况下,向客户端发送用于指示请求的数量超过预设数量的提示信息,在预设队列中当前记录的请求的数量均未超过预设数量的情况下,通过多进程中每个进程分别对应的多线程处理第一目标事件。As an optional implementation manner, after acquiring the multi-processes used to process the first target event in the proxy server, the number of requests currently recorded in the preset queue corresponding to each process exceeds the preset number In the case of , send a prompt message to the client indicating that the number of requests exceeds the preset number. When the number of requests currently recorded in the preset queue does not exceed the preset number, each process in the multi-process Corresponding multi-threads respectively process the first target event.
图4是根据本发明实施例的另一种事件处理方法的流程图。如图4所示,该方法还包括以下步骤:Fig. 4 is a flowchart of another event processing method according to an embodiment of the present invention. As shown in Figure 4, the method also includes the following steps:
步骤S401,当至少一个每个进程分别对应的预设队列中当前记录的请求的数量超过预设数量时,向客户端发送用于指示请求的数量超过预设数量的提示信息。Step S401, when the number of currently recorded requests in at least one preset queue corresponding to each process exceeds the preset number, send prompt information to the client indicating that the number of requests exceeds the preset number.
在本申请上述步骤S401提供的技术方案中,当至少一个每个进程分别对应的预设队列中当前记录的请求的数量超过预设数量时,向客户端发送用于指示请求的数量超过预设数量的提示信息,其中,请求包括第一请求。In the technical solution provided in the above step S401 of this application, when the number of currently recorded requests in at least one preset queue corresponding to each process exceeds the preset number, a message indicating that the number of requests exceeds the preset number is sent to the client. The number of prompt information, where the request includes the first request.
代理服务器中的多个进程中的每个进程具有预设队列,该预设队列可以为队列长度可控制的任务队列,其中,队列长度可以为客户端发送的多个请求的数量,该多个请求包括第一请求。Each process in the plurality of processes in the proxy server has a preset queue, and the preset queue can be a task queue with a controllable queue length, wherein the queue length can be the number of multiple requests sent by the client, and the multiple The requests include a first request.
可选地,当至少一个预设队列中当前记录的请求的数量超过预设数量时,向客户端发送用于指示请求的数量超过预设数量的提示信息,该预设数量可以为预先配置在代理服务器中的请求数量。Optionally, when the number of requests currently recorded in at least one preset queue exceeds the preset number, a prompt message indicating that the number of requests exceeds the preset number is sent to the client, and the preset number can be preconfigured in The number of requests in the proxy server.
当至少一个预设队列中当前记录的请求的数量超过预设数量时,则此时客户端发送过来的请求过量。在请求过量的情况下,容易造成服务器雪崩,此时向客户端发送用于指示请求的数量超过预设数量的提示信息。When the number of currently recorded requests in at least one preset queue exceeds the preset number, the requests sent by the client are excessive. In the case of excessive requests, it is easy to cause an avalanche of the server, and at this time, a prompt message indicating that the number of requests exceeds the preset number is sent to the client.
步骤S402,当预设队列中当前记录的请求的数量均未超过预设数量时,通过多进程中每个进程分别对应的多线程处理第一目标事件。Step S402, when the number of requests currently recorded in the preset queue does not exceed the preset number, process the first target event through the multi-thread corresponding to each process in the multi-processes.
在本申请上述步骤S402提供的技术方案中,当预设队列中当前记录的请求的数量均未超过预设数量时,通过多进程中每个进程分别对应的多线程处理第一目标事件。In the technical solution provided in the above step S402 of the present application, when the number of requests currently recorded in the preset queue does not exceed the preset number, the first target event is processed through multi-threads corresponding to each process in the multi-processes.
在预设队列中当前记录的请求的数量均未超过预设数量的情况下,正常通过多线程处理第一目标事件。In the case that the number of requests currently recorded in the preset queue does not exceed the preset number, the first target event is normally processed through multithreading.
该实施例通过在获取在代理服务器中对第一目标事件进行处理所使用的多进程之后,当至少一个每个进程分别对应的预设队列中当前记录的请求的数量超过预设数量时,向客户端发送用于指示请求的数量超过预设数量的提示信息,当预设队列中当前记录的请求的数量均未超过预设数量时,通过多进程中每个进程分别对应的多线程处理第一目标事件,从而实现了提高远程过程调用中的事件处理效率的技术效果。In this embodiment, after acquiring the multi-processes used to process the first target event in the proxy server, when the number of currently recorded requests in at least one preset queue corresponding to each process exceeds the preset number, send The client sends a prompt message indicating that the number of requests exceeds the preset number. When the number of requests currently recorded in the preset queue does not exceed the preset number, the multi-thread processing corresponding to each process in the multi-process A target event, thereby realizing the technical effect of improving the event processing efficiency in the remote procedure call.
作为一种可选的实施方式,步骤S304,获取在代理服务器中对第一目标事件进行处理所使用的多进程包括:根据预设进程模型确定多进程中的父进程;通过父进程对配置文件进行初始化;根据初始化后的配置文件确定多进程中的多个子进程。As an optional implementation manner, in step S304, obtaining the multi-process used for processing the first target event in the proxy server includes: determining the parent process in the multi-process according to the preset process model; configuring the configuration file through the parent process Perform initialization; determine multiple child processes in the multi-process according to the initialized configuration file.
图5是根据本发明实施例的一种获取在代理服务器中对第一目标事件进行处理所使用的多进程的方法的流程图。如图5所示,该方法包括以下步骤:Fig. 5 is a flow chart of a method for acquiring multiple processes used for processing a first target event in a proxy server according to an embodiment of the present invention. As shown in Figure 5, the method includes the following steps:
步骤S501,根据预设进程模型确定多进程中的父进程。Step S501, determine the parent process in the multi-process according to the preset process model.
在本申请上述步骤S501提供的技术方案中,根据预设进程模型确定多进程中的父进程。In the technical solution provided in step S501 of the present application, the parent process in the multi-process is determined according to the preset process model.
在获取第一请求之后,根据预设进程模型确定多进程中的父进程。可选地,预设进程模型为父进程-多子进程的父子进程模型。After obtaining the first request, determine the parent process in the multi-process according to the preset process model. Optionally, the preset process model is a parent-child process model of parent process-multiple child processes.
步骤S502,通过父进程对配置文件进行初始化。Step S502, initialize the configuration file through the parent process.
在本申请上述步骤S502提供的技术方案中,通过父进程对配置文件进行初始化。In the technical solution provided in the above step S502 of the present application, the configuration file is initialized through the parent process.
在根据预设进程模型确定多进程中的父进程之后,通过父进程读取配置文件,对配置文件进行初始化,该配置文件用于配置在处理第一目标事件的过程中所需要的处理参数。After the parent process in the multi-process is determined according to the preset process model, the configuration file is read by the parent process and initialized. The configuration file is used to configure processing parameters required in the process of processing the first target event.
步骤S503,根据初始化后的配置文件确定多进程中的多个子进程。Step S503, determine multiple sub-processes in the multi-process according to the initialized configuration file.
在本申请上述步骤S503提供的技术方案中,根据初始化后的配置文件确定多进程中的多个子进程,其中,多个子进程用于对第一请求进行处理。In the technical solution provided in step S503 of the present application, multiple sub-processes in the multi-process are determined according to the initialized configuration file, wherein the multiple sub-processes are used to process the first request.
根据初始化后的配置文件确定多进程中的多个子进程,也即,多个子父进程读取完配置文件并且初始化完毕之后调出的子进程,通过多个子进程接收和处理第一请求。父进程和多个子进程进行消息通信,比如,父进程和多个子进程之间传输开始命令(start)、停止命令(stop)、加载命令(reload)等。可选地,父进程通过管道等方式方便地与多个子进程进行消息通信。Multiple sub-processes in the multi-process are determined according to the initialized configuration file, that is, the sub-processes called out after the multiple sub-parent processes read the configuration file and are initialized, and receive and process the first request through the multiple sub-processes. The parent process communicates with multiple child processes, for example, a start command (start), a stop command (stop), a load command (reload), etc. are transmitted between the parent process and multiple child processes. Optionally, the parent process conveniently performs message communication with multiple child processes through a pipeline or the like.
该实施例通过根据预设进程模型确定多进程中的父进程;通过父进程对配置文件进行初始化,其中,配置文件用于配置在处理第一目标事件的过程中所需要的处理参数;根据初始化后的配置文件确定多进程中的多个子进程,其中,多个子进程用于对第一请求进行处理,实现了获取在代理服务器中对第一目标事件进行处理所使用的多进程的目的,进而通过多进程中每个进程分别对应的多线程处理第一目标事件,从而实现了提高远程过程调用中的事件处理效率的技术效果。In this embodiment, the parent process in the multi-process is determined according to the preset process model; the configuration file is initialized through the parent process, wherein the configuration file is used to configure the processing parameters required in the process of processing the first target event; according to the initialization The final configuration file determines multiple sub-processes in the multi-process, wherein the multiple sub-processes are used to process the first request, achieving the purpose of obtaining the multi-process used to process the first target event in the proxy server, and then The first target event is processed by the multi-thread corresponding to each process in the multi-process, thereby realizing the technical effect of improving the event processing efficiency in the remote procedure call.
作为一种可选的实施方式,在根据初始化后的配置文件确定多进程中的多个子进程之后,在第一目标事件报错的情况下,通过多个子进程接收第二请求,其中,第二请求用于请求执行第二目标事件,第二目标事件为对报错的第一目标事件进行恢复后的事件;根据第二请求处理第二目标事件。As an optional implementation, after determining the multiple sub-processes in the multi-process according to the initialized configuration file, in the case of an error in the first target event, the multiple sub-processes receive the second request, wherein the second request It is used to request to execute the second target event, and the second target event is an event after recovering the first target event that reported an error; process the second target event according to the second request.
图6是根据本发明实施例的另一种事件处理方法的流程图。如图6所示,该方法还包括以下步骤:Fig. 6 is a flowchart of another event processing method according to an embodiment of the present invention. As shown in Figure 6, the method also includes the following steps:
步骤S601,通过多个子进程接收第二请求。Step S601, receiving a second request through multiple sub-processes.
在本申请上述步骤S601提供的技术方案中,在第一目标事件报错的情况下,通过多个子进程接收第二请求,其中,第二请求用于请求执行第二目标事件,第二目标事件为对报错的第一目标事件进行恢复后的事件。In the technical solution provided in the above step S601 of this application, in the case of an error in the first target event, the second request is received through multiple sub-processes, wherein the second request is used to request the execution of the second target event, and the second target event is The event after recovering the first target event that reported an error.
在根据初始化后的配置文件确定多进程中的多个子进程之后,第一目标事件报错,也即,服务器对于线上业务偶现意外而发生崩溃(Crash),可以在至少一个进程中的请求的数量超过配置的预设长度,或者执行第一目标事件超时,第一目标事件报错,向客户端发送用于指示服务器崩溃的报错信息,比如,报错信息为返回的HTTP503。客户端在接收到报错信息之后,发送第二请求。第二请求用于请求执行第二目标事件,第二目标事件为对报错的第一目标事件进行恢复后的事件,通过多个子进程接收第二请求。After determining multiple sub-processes in the multi-process according to the initialized configuration file, the first target event reports an error, that is, the server crashes (Crash) due to an accidental occurrence of online business, and the request in at least one process can If the number exceeds the configured preset length, or the execution of the first target event times out, the first target event reports an error, and sends an error message to the client indicating that the server has crashed. For example, the error message is HTTP503 returned. After receiving the error message, the client sends a second request. The second request is used to request the execution of the second target event. The second target event is an event after recovering the error-reported first target event. The second request is received through multiple sub-processes.
步骤S602,根据第二请求处理第二目标事件。Step S602, process the second target event according to the second request.
在本申请上述步骤S602提供的技术方案中,根据第二请求处理第二目标。In the technical solution provided in step S602 of the present application, the second object is processed according to the second request.
在通过多个子进程接收第二请求之后,根据第二请求处理第二目标事件,从而通过这种多进程模型可以有效防止线上业务偶现意外,重新拉起可以暂时快速恢复业务。After the second request is received through multiple sub-processes, the second target event is processed according to the second request, so that this multi-process model can effectively prevent accidental online business accidents, and restarting can temporarily restore the business quickly.
该实施例通过在根据初始化后的配置文件确定多进程中的多个子进程之后,在第一目标事件报错的情况下,通过多个子进程接收第二请求,其中,第二请求用于请求执行第二目标事件,第二目标事件为对报错的第一目标事件进行恢复后的事件;根据第二请求处理第二目标事件,从而有效地恢复发生意外的事件,从而实现了提高远程过程调用中的事件处理效率的技术效果。In this embodiment, after the multiple sub-processes in the multi-process are determined according to the initialized configuration file, in the case of an error in the first target event, the multiple sub-processes receive the second request, wherein the second request is used to request execution of the first target event. Two target events, the second target event is an event after recovering the first target event that reported an error; the second target event is processed according to the second request, thereby effectively recovering the unexpected event, thereby realizing the improvement of the remote procedure call. Technical Effects of Event Processing Efficiency.
作为一种可选的实施方式,在根据初始化后的配置文件确定多进程中的多个子进程之后,根据用于指示对代理服务器进行升级的升级指令对代理服务器进行升级。As an optional implementation manner, after multiple sub-processes in the multi-process are determined according to the initialized configuration file, the proxy server is upgraded according to an upgrade instruction for instructing the proxy server to be upgraded.
图7是根据本发明实施例的另一种事件处理方法的流程图。如图7所示,该方法还包括以下步骤:Fig. 7 is a flowchart of another event processing method according to an embodiment of the present invention. As shown in Figure 7, the method also includes the following steps:
步骤S701,接收用于指示对代理服务器进行升级的升级指令。Step S701, receiving an upgrade instruction for instructing to upgrade the proxy server.
在本申请上述步骤S701提供的技术方案中,在根据初始化后的配置文件确定多进程中的多个子进程之后,接收用于指示对代理服务器进行升级的升级指令。In the technical solution provided in step S701 of the present application, after multiple sub-processes in the multi-process are determined according to the initialized configuration file, an upgrade instruction for instructing the proxy server to be upgraded is received.
为了满足执行不同事件的执行需求,可以对代理服务器进行升级以适应不同事件的执行。在根据初始化后的配置文件确定多进程中的多个子进程之后,接收用于指示对代理服务器进行升级的升级指令,该升级指令为Nginx所支持的命令。In order to meet the execution requirements of executing different events, the proxy server can be upgraded to adapt to the execution of different events. After determining multiple sub-processes in the multi-process according to the initialized configuration file, an upgrade instruction for instructing the proxy server to be upgraded is received, and the upgrade instruction is a command supported by Nginx.
步骤S702,根据升级指令对代理服务器进行升级。Step S702, upgrade the proxy server according to the upgrade instruction.
在本申请上述步骤S702提供的技术方案中,根据升级指令对代理服务器进行升级。In the technical solution provided in step S702 of the present application, the proxy server is upgraded according to the upgrade instruction.
在接收用于指示对代理服务器进行升级的升级指令之后,根据升级指令对代理服务器进行升级,从而达到了服务平滑升级不间断的目的。After receiving the upgrade instruction for instructing the proxy server to be upgraded, the proxy server is upgraded according to the upgrade instruction, thereby achieving the purpose of smooth and uninterrupted service upgrade.
该实施例通过在根据初始化后的配置文件确定多进程中的多个子进程之后,接收用于指示对代理服务器进行升级的升级指令;根据升级指令对代理服务器进行升级,进而提高了远程过程调用中的事件处理效率的技术效果。In this embodiment, after a plurality of child processes in the multi-process are determined according to the initialized configuration file, an upgrade instruction for instructing the proxy server to be upgraded is received; the proxy server is upgraded according to the upgrade instruction, thereby improving the performance of the remote procedure call. The technical effect of event processing efficiency.
作为一种可选的实施方式,步骤S306,通过多进程中每个进程分别对应的多线程处理第一目标事件包括:通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件;在执行完多个任务事件之后,获取第三请求,并向客户端发送用于指示执行完多个任务事件的第一响应结果。As an optional implementation manner, in step S306, processing the first target event through multi-threads corresponding to each process in the multi-processes includes: obtaining and executing the multi-threaded event that meets the second preset condition in the first target event through multi-threads. task events; after executing multiple task events, obtain the third request, and send the first response result indicating that multiple task events are executed to the client.
图8是根据本发明实施例的一种通过多进程中每个进程分别对应的多线程处理第一目标事件的方法的流程图。如图8所示,该方法还包括以下步骤:Fig. 8 is a flow chart of a method for processing a first target event through multi-threads corresponding to each process in the multi-processes according to an embodiment of the present invention. As shown in Figure 8, the method also includes the following steps:
步骤S801,通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件。Step S801, acquire and execute a plurality of task events meeting the second preset condition in the first target event through multi-threading.
在本申请上述步骤S801提供的技术方案中,通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件。In the technical solution provided in step S801 of the present application, multiple task events meeting the second preset condition in the first target event are obtained and executed through multithreading.
第一目标事件包括多个任务事件,符合第二预设条件的多个任务事件可以为计算密集耗时的任务,密集耗时的任务会阻塞事件的循环。在获取第一请求之后,通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件。可选地,采用Nginx的多线程模型,该多线程模型包括与线程池(Thread_pool),任务队列(Queue+notify),通知反馈(Notify_callback)等相关的操作。The first target event includes a plurality of task events, and the plurality of task events meeting the second preset condition may be computation-intensive and time-consuming tasks, and the intensive and time-consuming tasks will block the cycle of events. After acquiring the first request, acquire and execute multiple task events in the first target event that meet the second preset condition through multithreading. Optionally, the multithreading model of Nginx is adopted, and the multithreading model includes operations related to thread pool (Thread_pool), task queue (Queue+notify), notification feedback (Notify_callback) and the like.
步骤S802,获取第三请求,并向客户端发送用于指示执行完多个任务事件的第一响应结果。Step S802, acquire the third request, and send to the client a first response result indicating that multiple tasks have been executed.
在本申请上述步骤S802提供的技术方案中,在执行完多个任务事件之后,获取第三请求,并向客户端发送用于指示执行完多个任务事件的第一响应结果,其中,第三请求用于请求执行第三目标事件,第三目标事件为在远程过程调用中执行的事件。In the technical solution provided in the above step S802 of this application, after multiple task events are executed, the third request is obtained, and a first response result indicating that multiple task events are executed is sent to the client, wherein the third The request is used to request to execute the third target event, and the third target event is an event executed in the remote procedure call.
客户端发送多个用于请求执行事件的用户请求。在执行完多个任务事件之后,可以通过管道写来通知进行事件循环处理。获取第三请求,该第三请求为事件循环处理时发送的下一个请求。调用Notify_callback,向客户端发送用于指示执行完多个任务事件的第一响应结果(Send respose),从而实现了代理服务器的发送响应逻辑。The client sends multiple user requests for execution events. After executing multiple task events, you can write through the pipeline to notify the event loop processing. Obtain the third request, which is the next request sent during event loop processing. Call Notify_callback to send the first response result (Send respose) to the client to indicate that multiple tasks have been executed, thereby realizing the sending response logic of the proxy server.
可选地,用于执行事件的操作封装在动态链接库中。在获取第三请求之后,可以根据第三请求携带的统一资源标识符(Uniform Resource Identifier,简称为URI)在动态链接库中选择用于执行第三目标事件的操作。在选择用于执行第三目标事件的操作之后,进行入队(Task push),通过线程池中的多个子进程执行第三目标事件,其中,URL用于标识某一互联网资源名称的字符串,允许用户对任何(包括本地和互联网)的资源通过特定的协议进行交互操作。Optionally, operations for executing events are encapsulated in a dynamic link library. After obtaining the third request, an operation for executing the third target event may be selected in the dynamic link library according to a uniform resource identifier (Uniform Resource Identifier, URI for short) carried in the third request. After selecting to be used to carry out the operation of the 3rd target event, carry out enqueue (Task push), carry out the 3rd target event by a plurality of subprocesses in the thread pool, wherein, URL is used to identify the character string of certain Internet resource name, Allow users to interact with any (including local and Internet) resources through specific protocols.
该实施例通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件;在执行完多个任务事件之后,获取第三请求,并向客户端发送用于指示执行完多个任务事件的第一响应结果,其中,第三请求用于请求执行第三目标事件,第三目标事件为在远程过程调用中执行的事件,实现了通过多进程中每个进程分别对应的多线程处理第一目标事件的目的,从而实现了提高远程过程调用中的事件处理效率的技术效果。This embodiment acquires and executes multiple task events that meet the second preset condition in the first target event through multithreading; after executing multiple task events, obtains the third request, and sends a message indicating that the execution is completed to the client The first response result of multiple task events, wherein the third request is used to request the execution of the third target event, and the third target event is an event executed in a remote procedure call, which realizes that each process in the multi-process corresponds to The purpose of multi-thread processing the first target event is achieved, thereby realizing the technical effect of improving the event processing efficiency in the remote procedure call.
作为一种可选的实施方式,在获取在代理服务器中对第一目标事件进行处理所使用的多进程之前,加载用于执行第一目标事件的动态链接库,其中,动态链接库封装有多进程中用于执行第一目标事件的操作。As an optional implementation manner, before obtaining the multi-process used to process the first target event in the proxy server, load a dynamic link library for executing the first target event, wherein the dynamic link library encapsulates multiple The action used in the process to execute the first target event.
远程过程调用的处理部分可以沿用对多进程进行封装的方式。可选地,通过数据库描述语言google::protobuf的服务service来进行服务注册。在将服务注册到代理服务器的过程中,可以结合“业务、框架零耦合”的目标,通过动态加载动态链接库来实现。需要在动态链接库中注入在执行事件需要的操作(Handlers)。其中,操作可以为以下操作中的一种或者多种:新建Service操作,(_NGX_RPC_NewService),全局初始化操作(_NGX_RPC_ServiceGlobalInit),全局析构操作(NGX_RPC_ServiceGlobalRelease),线程初始化操作(_NGX_RPC_ServiceThreadInit)。The processing part of the remote procedure call can follow the method of encapsulating multiple processes. Optionally, the service registration is performed through the service service of the database description language google::protobuf. In the process of registering the service to the proxy server, it can be achieved by dynamically loading the dynamic link library in combination with the goal of "zero coupling between business and framework". The operations (Handlers) needed to execute the event need to be injected into the dynamic link library. Among them, the operation can be one or more of the following operations: new service operation (_NGX_RPC_NewService), global initialization operation (_NGX_RPC_ServiceGlobalInit), global destruction operation (NGX_RPC_ServiceGlobalRelease), thread initialization operation (_NGX_RPC_ServiceThreadInit).
该实施例利用动态链接库的动态加载原理,编写动态远程过程调用模块,动态载入动态链接库,分离业务和框架。在更新业务时,只需要重新编译动态链接库即可,提高了远程过程调用中的事件处理效率。This embodiment utilizes the dynamic loading principle of the dynamic link library, writes the dynamic remote procedure call module, loads the dynamic link library dynamically, and separates the service and the framework. When updating the service, it only needs to recompile the dynamic link library, which improves the event processing efficiency in the remote procedure call.
作为一种可选的实施方式,步骤S304,获取在代理服务器中对第一目标事件进行处理所使用的多进程包括:获取第一请求携带的统一资源标识符;根据统一资源标识符从预设存储位置获取多进程。As an optional implementation manner, in step S304, obtaining the multi-process used for processing the first target event in the proxy server includes: obtaining the uniform resource identifier carried in the first request; Storage location gets multiprocess.
图9是根据本发明实施例的另一种获取在代理服务器中对第一目标事件进行处理所使用的多进程的方法的流程图。如图9所示,该方法包括以下步骤:Fig. 9 is a flow chart of another method for obtaining the multi-process used for processing the first target event in the proxy server according to an embodiment of the present invention. As shown in Figure 9, the method includes the following steps:
步骤S901,获取第一请求携带的统一资源标识符。Step S901, acquiring the uniform resource identifier carried in the first request.
在本申请上述步骤S901提供的技术方案中,获取第一请求携带的统一资源标识符,其中,统一资源标识符用于标识多进程。In the technical solution provided in step S901 of the present application, the uniform resource identifier carried in the first request is obtained, where the uniform resource identifier is used to identify multiple processes.
当客户端发送的第一请求到达时,远程过程调用的任务会获取第一请求携带的统一资源标识符,统一资源标识符用于标识某一互联网资源名称的字符串,允许用户对任何(包括本地和互联网)的资源通过特定的协议进行交互操作。When the first request sent by the client arrives, the task of the RPC will obtain the Uniform Resource Identifier carried in the first request. The Uniform Resource Identifier is used to identify a character string of an Internet resource name, allowing the user to call any (including Local and Internet) resources interact through specific protocols.
步骤S902,根据统一资源标识符从预设存储位置获取多进程。Step S902, acquiring multiple processes from a preset storage location according to the uniform resource identifier.
在本申请上述步骤S902提供的技术方案中,根据统一资源标识符从预设存储位置获取多进程,其中,预设存储位置存储了包括多进程的多个进程。In the technical solution provided in step S902 of the present application, the multi-process is obtained from a preset storage location according to the uniform resource identifier, wherein the preset storage location stores multiple processes including the multi-process.
预设存储位置存储了包括多进程的多个进程,该预设存储位置可以为哈希表(Hash Table)。在获取第一请求携带的统一资源标识符之后,根据统一资源标识符从哈希表中找到对应的多进程,从而确定用于执行第一目标事件的操作(Service&MethodDescriptor)。进一步对包体做协议反序列化处理,从而保证数据在连续的内存中正常传输。通过调用Service->CallMethod()就会调用动态链接库中封装的操作逻辑,最后再进行反序列化处理,通知Nginx主循环调用Notify_Callback向客户端发送响应结果,客户端在接收到该响应结果之后可以确定服务器对第一目标事件执行完毕。服务器可以准备接收下一个请求来处理事件,实现了远程过程调用的动态处理目的。The preset storage location stores multiple processes including multiple processes, and the preset storage location may be a hash table (Hash Table). After the uniform resource identifier carried in the first request is obtained, the corresponding multi-process is found from the hash table according to the uniform resource identifier, so as to determine the operation (Service&MethodDescriptor) for executing the first target event. Further perform protocol deserialization processing on the package body, so as to ensure the normal transmission of data in continuous memory. By calling Service->CallMethod(), the operation logic encapsulated in the dynamic link library will be called, and finally the deserialization process will be performed to notify the Nginx main loop to call Notify_Callback to send the response result to the client. After the client receives the response result It may be determined that the server finishes executing the first target event. The server can prepare to receive the next request to process the event, realizing the dynamic processing purpose of the remote procedure call.
该实施例通过获取第一请求携带的统一资源标识符,其中,统一资源标识符用于标识多进程;根据统一资源标识符从预设存储位置获取多进程,其中,预设存储位置存储了包括多进程的多个进程,实现了获取在代理服务器中对第一目标事件进行处理所使用的多进程的目的,通过多进程中每个进程分别对应的多线程处理第一目标事件,从而实现了提高远程过程调用中的事件处理效率的技术效果。In this embodiment, the uniform resource identifier carried by the first request is obtained, wherein the uniform resource identifier is used to identify a multi-process; and the multi-process is obtained from a preset storage location according to the uniform resource identifier, wherein the preset storage location stores information including Multiple processes of multiple processes achieve the purpose of obtaining the multiple processes used to process the first target event in the proxy server, and process the first target event through the multi-threads corresponding to each process in the multiple processes, thereby realizing A technical effect of improving the efficiency of event handling in remote procedure calls.
实施例2Example 2
下面结合优选的实施例对本发明的技术方案进行说明。具体以代理服务器为Nginx进行描述。The technical solutions of the present invention will be described below in conjunction with preferred embodiments. Specifically, the proxy server is Nginx for description.
该实施例的远程过程调用包括多进程模型、多线程模型、动态RPC处理模型分别阐述。The remote procedure call in this embodiment includes a multi-process model, a multi-thread model, and a dynamic RPC processing model, respectively.
下面对远程过程调用中的多进程模型进行介绍。The multi-process model in the remote procedure call is introduced below.
图10是根据本发明实施例的一种多进程模型的示意图。如图10所示,Nginx采用master-多worker的父子进程模型,多个子进程是通过父进程读取完配置文件并进行初始化完成之后调出(fork)的多个子进程,然后通过调出多个子进程接收和处理多个客户端(Client)发送过来的用户请求,其中,每个子进程可以接收多个客户端发送的用户请求。父进程通过管道等方式方便地与子进程进行消息通信,比如,通过管道等方式传输开始命令(start)、停止命令(stop)、加载命令(reload)。Fig. 10 is a schematic diagram of a multi-process model according to an embodiment of the present invention. As shown in Figure 10, Nginx adopts the master-multi-worker parent-child process model. Multiple child processes are multiple child processes that are called out (fork) after the parent process reads the configuration file and initializes, and then calls out multiple child processes. The process receives and processes user requests sent by multiple clients (Clients), wherein each sub-process can receive user requests sent by multiple clients. The parent process conveniently performs message communication with the child process through a pipeline or other means, for example, transmits a start command (start), a stop command (stop), and a loading command (reload) through a pipeline or other means.
该实施例的多进程模型可以有效防止线上业务偶现意外,可以重新拉起业务,暂时快速恢复业务,并且能够方便地在Nginx所支持的命令下,达到服务平滑升级不间断的目的,进而提高了远程过程调用下的事件处理效率。The multi-process model of this embodiment can effectively prevent accidental online business accidents, can restart the business, temporarily restore the business quickly, and can easily achieve the purpose of smooth service upgrade and uninterrupted service under the commands supported by Nginx, and then Improved event handling efficiency under remote procedure calls.
下面对远程过程调用中的多线程模型进行介绍。The multithreading model in the remote procedure call is introduced below.
图11是根据本发明实施例的一种远程过程调用的多线程模型的示意图。如图11所示,该实施例的远程过程调用下的任务都是计算密集耗时任务,计算密集耗时的任务会阻塞Epoll事件循环,其中,Epoll是Linux内核为处理大批量文件描述符而做了改进的函数。可选地,采用Nginx现成的多线程模型,该多线程模型包括线程池(thread_pool)+任务队列(task_queue)+通知调用(notify_callback)。读取客户端的请求(读取http body),在动态链接库中,根据路径URI决策针对于目标事件的操作,可以从哈希表中进行选择该操作,进而构造任务操作。在构造任务操作之后,将任务操作向线程池模型入队(Task push)。通过不断地发起远程过程调用下的多任务(post rpc task),在多任务完成(Done Handler)之后以管道写的方式通过多子进程来通知Epoll事件循环,其中,多任务和多子进程属于线程池模型。然后调用Notify_callback来实现Nginx向客户端发送的send response(发送响应)逻辑,从而实现了远程过程调用的多线程模型下的事件处理方法。Fig. 11 is a schematic diagram of a multi-thread model of a remote procedure call according to an embodiment of the present invention. As shown in Figure 11, the tasks under the remote procedure call of this embodiment are all calculation-intensive and time-consuming tasks, and the calculation-intensive and time-consuming tasks will block the Epoll event loop, where Epoll is the Linux kernel for processing a large number of file descriptors. Made an improved function. Optionally, adopt the ready-made multithreading model of Nginx, which multithreading model includes thread pool (thread_pool)+task queue (task_queue)+notify call (notify_callback). Read the client's request (read http body). In the dynamic link library, the operation for the target event is determined according to the path URI, and the operation can be selected from the hash table to construct a task operation. After constructing the task operation, enqueue the task operation to the thread pool model (Task push). By continuously initiating the multi-task (post rpc task) under the remote procedure call, after the completion of the multi-task (Done Handler), the Epoll event loop is notified through the multi-sub-process in the form of pipeline writing, among which multi-task and multi-sub-process belong to Thread pool model. Then call Notify_callback to realize the send response (send response) logic sent by Nginx to the client, thereby realizing the event processing method under the multi-threaded model of the remote procedure call.
在多进程模型下,无需考虑多线程的并发安全,在需要大量进程内存读写情况下选用多线程,从而满足各式各样服务器开发的需求,提高了远程过程调用的事件处理效率。Under the multi-process model, there is no need to consider the concurrency safety of multi-threading. When a large amount of process memory reading and writing is required, multi-threading is used to meet the needs of various server development and improve the event processing efficiency of remote procedure calls.
下面对动态RPC处理模型进行介绍:The dynamic RPC processing model is introduced below:
图12是根据本发明实施例的一种动态RPC处理模型的示意图。如图12所示,RPC处理的部分沿多进程的封装方式,可以通过google::protobuf:Service来进行服务注册,通过libapi_dso.so New Protobuf::Service,以dlopen函数在指定的模式下从Hash_table中打开指定的动态链接库文件。Fig. 12 is a schematic diagram of a dynamic RPC processing model according to an embodiment of the present invention. As shown in Figure 12, the RPC processing part follows the multi-process encapsulation method, and the service registration can be performed through google::protobuf:Service, and through libapi_dso.so New Protobuf::Service, use the dlopen function in the specified mode from the Hash_table Open the specified dynamic link library file in .
可选地,结合“业务、框架零耦合”的目标,动态加载动态链接库。需要在动态链接库中注入在执行事件所需要的操作(Handlers)。可选地,在动态链接库中注入的操作包括以下一种或者多种:Optionally, in combination with the goal of "zero coupling between business and framework", dynamically load the dynamic link library. The operations (Handlers) needed to execute the event need to be injected into the dynamic link library. Optionally, the operations injected into the dynamic link library include one or more of the following:
_NGX_RPC_NewService//新建Service;_NGX_RPC_NewService//New Service;
_NGX_RPC_ServiceGlobalInit//全局初始化;_NGX_RPC_ServiceGlobalInit//Global initialization;
_NGX_RPC_ServiceGlobalRelease//全局析构;_NGX_RPC_ServiceGlobalRelease//Global destruction;
_NGX_RPC_ServiceThreadInit//线程初始化。_NGX_RPC_ServiceThreadInit//Thread initialization.
当客户端发送的一个请求(request)到达时,远程过程调用(RPC task)会根据请求中携带的URI从Hash_table中找到对应的Service&Method Descriptor,其中,哈希表将键(Key)映射到相应的值(Value)。进一步对包体做Protobuf协议反序列化,调用Service->CallMethod(),此时就会调用到动态链接库中已经封装好的用于执行目标事件的操作逻辑。最后再进行反序列化处理,通知Nginx主循环调用Notify_callback发送响应。When a request (request) sent by the client arrives, the remote procedure call (RPC task) will find the corresponding Service&Method Descriptor from the Hash_table according to the URI carried in the request, where the hash table maps the key (Key) to the corresponding Value. Further perform Protobuf protocol deserialization on the package body, call Service->CallMethod(), and then call the operation logic encapsulated in the dynamic link library to execute the target event. Finally, the deserialization process is performed, and the Nginx main loop is notified to call Notify_callback to send a response.
经过测试,该实施例的用于执行目标事件的网络框架在面对每秒万以上的用户连接时,效率不低于现有技术中的网络框架;同时该网络框架具有更强的健壮性、可配置性,动态链接库动态加载,任务队列长度控制,不会产生雪崩效应,对于计算密集型服务开发易于上手和维护,目前在后台中已经广泛推广和使用,事件处理的效率有了很大的提升。After testing, the network framework for executing the target event of this embodiment is not less efficient than the network framework in the prior art when facing more than 10,000 user connections per second; at the same time, the network framework has stronger robustness, Configurability, dynamic link library dynamic loading, task queue length control, no avalanche effect, easy to use and maintain for computing-intensive service development, has been widely promoted and used in the background, and the efficiency of event processing has been greatly improved improvement.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. Because of the present invention, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products are stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to enable a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in various embodiments of the present invention.
实施例3Example 3
根据本发明实施例,还提供了一种用于实施上述事件处理方法的事件处理装置。图13是根据本发明实施例的一种事件处理装置的示意图。如图13所示,该事件处理装置可以包括:第一获取单元10、第二获取单元20和第一处理单元30。According to an embodiment of the present invention, an event processing device for implementing the above event processing method is also provided. Fig. 13 is a schematic diagram of an event processing device according to an embodiment of the present invention. As shown in FIG. 13 , the event processing apparatus may include: a first acquiring unit 10 , a second acquiring unit 20 and a first processing unit 30 .
第一获取单元10,用于获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件。The first obtaining unit 10 is configured to obtain a first request, wherein the first request is used to request execution of a first target event, and the first target event is an event executed in a remote procedure call.
第二获取单元20,用于在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应。The second obtaining unit 20 is used to obtain the multi-process used for processing the first target event in the proxy server when the first request meets the first preset condition, wherein the number of multi-process processes is determined by the proxy server It is pre-configured, and the number of processes of the multi-process corresponds to the first target event.
第一处理单元30,用于通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。The first processing unit 30 is configured to process the first target event through multi-threads corresponding to each process in the multi-processes, wherein the number of threads of the multi-threads is pre-configured by the proxy server, and the number of threads of the multi-threads is consistent with the first target event Corresponding.
图14是根据本发明实施例的另一种事件处理装置的示意图。如图14所示,该事件处理装置可以包括:第一获取单元10、第二获取单元20和第一处理单元30。其中,该装置还包括:发送单元40。其中,第一处理单元30包括第一处理模块31。Fig. 14 is a schematic diagram of another event processing device according to an embodiment of the present invention. As shown in FIG. 14 , the event processing apparatus may include: a first acquiring unit 10 , a second acquiring unit 20 and a first processing unit 30 . Wherein, the device further includes: a sending unit 40 . Wherein, the first processing unit 30 includes a first processing module 31 .
需要说明的是,该实施例的第一获取单元10、第二获取单元20和第一处理单元30与图13所示实施例的事件处理装置中的作用相同,此处不再赘述。It should be noted that the functions of the first acquisition unit 10 , the second acquisition unit 20 and the first processing unit 30 in this embodiment are the same as those of the event processing device in the embodiment shown in FIG. 13 , and will not be repeated here.
发送单元40,用于当至少一个每个进程分别对应的预设队列中当前记录的请求的数量超过预设数量时,向客户端发送用于指示请求的数量超过预设数量的提示信息,其中,请求包括第一请求。The sending unit 40 is configured to send prompt information to the client indicating that the number of requests exceeds the preset number when the number of currently recorded requests in at least one preset queue corresponding to each process exceeds the preset number, wherein , the request includes the first request.
第一处理单元30包括第一处理模块31,用于当预设队列中当前记录的请求的数量均未超过预设数量时,通过多进程中每个进程分别对应的多线程处理第一目标事件。The first processing unit 30 includes a first processing module 31, configured to process the first target event through a multi-thread corresponding to each process in the multi-process when the number of requests currently recorded in the preset queue does not exceed the preset number .
图15是根据本发明实施例的另一种事件处理装置的示意图。如图15所示,该事件处理装置可以包括:第一获取单元10、第二获取单元20和第一处理单元30。其中,第二获取单元20包括:第一确定模块21、初始化模块22和第二确定模块23。Fig. 15 is a schematic diagram of another event processing device according to an embodiment of the present invention. As shown in FIG. 15 , the event processing apparatus may include: a first acquiring unit 10 , a second acquiring unit 20 and a first processing unit 30 . Wherein, the second acquisition unit 20 includes: a first determination module 21 , an initialization module 22 and a second determination module 23 .
需要说明的是,该实施例的第一获取单元10、第二获取单元20和第一处理单元30与图13所示实施例的事件处理装置中的作用相同,此处不再赘述。It should be noted that the functions of the first acquisition unit 10 , the second acquisition unit 20 and the first processing unit 30 in this embodiment are the same as those of the event processing device in the embodiment shown in FIG. 13 , and will not be repeated here.
第一确定模块21,用于根据预设进程模型确定多进程中的父进程。The first determining module 21 is configured to determine a parent process in the multi-process according to a preset process model.
初始化模块22,用于通过父进程对配置文件进行初始化,其中,配置文件用于配置在处理第一目标事件的过程中所需要的处理参数。The initialization module 22 is configured to initialize the configuration file through the parent process, wherein the configuration file is used to configure processing parameters required in the process of processing the first target event.
第二确定模块23,用于根据初始化后的配置文件确定多进程中的多个子进程,其中,多个子进程用于对第一请求进行处理。The second determining module 23 is configured to determine multiple sub-processes in the multi-process according to the initialized configuration file, wherein the multiple sub-processes are used to process the first request.
图16是根据本发明实施例的另一种事件处理装置的示意图。如图16所示,该事件处理装置可以包括:第一获取单元10、第二获取单元20和第一处理单元30。其中,第二获取单元20包括:第一确定模块21、初始化模块22和第二确定模块23。该装置还包括:第一接收单元50和第二处理单元60。Fig. 16 is a schematic diagram of another event processing device according to an embodiment of the present invention. As shown in FIG. 16 , the event processing apparatus may include: a first acquiring unit 10 , a second acquiring unit 20 and a first processing unit 30 . Wherein, the second acquisition unit 20 includes: a first determination module 21 , an initialization module 22 and a second determination module 23 . The device also includes: a first receiving unit 50 and a second processing unit 60 .
需要说明的是,该实施例的第一获取单元10、第二获取单元20和第一处理单元30,第一确定模块21和第二确定模块22与图15所示实施例的事件处理装置中的作用相同,此处不再赘述。It should be noted that the first acquisition unit 10, the second acquisition unit 20, the first processing unit 30, the first determination module 21 and the second determination module 22 of this embodiment are the same as those in the event processing device of the embodiment shown in FIG. have the same effect and will not be repeated here.
第一接收单元50,用于在根据初始化后的配置文件确定多进程中的多个子进程之后,在第一目标事件报错的情况下,通过多个子进程接收第二请求,其中,第二请求用于请求执行第二目标事件,第二目标事件为对报错的第一目标事件进行恢复后的事件。The first receiving unit 50 is configured to, after determining multiple sub-processes in the multi-process according to the initialized configuration file, receive the second request through the multiple sub-processes when the first target event reports an error, wherein the second request uses In order to request to execute the second target event, the second target event is an event after recovering the error-reported first target event.
第二处理单元60,用于根据第二请求处理第二目标事件。The second processing unit 60 is configured to process the second target event according to the second request.
图17是根据本发明实施例的另一种事件处理装置的示意图。如图17所示,该事件处理装置可以包括:第一获取单元10、第二获取单元20和第一处理单元30。其中,第二获取单元20包括:第一确定模块21、初始化模块22和第二确定模块23。其中,该装置还包括:第二接收单元70和升级单元80。Fig. 17 is a schematic diagram of another event processing device according to an embodiment of the present invention. As shown in FIG. 17 , the event processing apparatus may include: a first acquiring unit 10 , a second acquiring unit 20 and a first processing unit 30 . Wherein, the second acquisition unit 20 includes: a first determination module 21 , an initialization module 22 and a second determination module 23 . Wherein, the device further includes: a second receiving unit 70 and an upgrading unit 80 .
需要说明的是,该实施例的第一获取单元10、第二获取单元20和第一处理单元30,第一确定模块21和第二确定模块22与图15所示实施例的事件处理装置中的作用相同,此处不再赘述。It should be noted that the first acquisition unit 10, the second acquisition unit 20, the first processing unit 30, the first determination module 21 and the second determination module 22 of this embodiment are the same as those in the event processing device of the embodiment shown in FIG. have the same effect and will not be repeated here.
第二接收单元70,用于在根据初始化后的配置文件确定多进程中的多个子进程之后,接收用于指示对代理服务器进行升级的升级指令。The second receiving unit 70 is configured to receive an upgrade instruction for instructing to upgrade the proxy server after determining multiple sub-processes in the multi-process according to the initialized configuration file.
升级单元80,用于根据升级指令对代理服务器进行升级。The upgrading unit 80 is configured to upgrade the proxy server according to the upgrading instruction.
图18是根据本发明实施例的另一种事件处理装置的示意图。如图18所示,该事件处理装置可以包括:第一获取单元10、第二获取单元20和第一处理单元30。该第一处理单元30包括:第二处理模块31和执行模块32。Fig. 18 is a schematic diagram of another event processing device according to an embodiment of the present invention. As shown in FIG. 18 , the event processing apparatus may include: a first acquiring unit 10 , a second acquiring unit 20 and a first processing unit 30 . The first processing unit 30 includes: a second processing module 31 and an execution module 32 .
需要说明的是,该实施例的第一获取单元10、第二获取单元20和第一处理单元30与图13所示实施例的事件处理装置中的作用相同,此处不再赘述。It should be noted that the functions of the first acquisition unit 10 , the second acquisition unit 20 and the first processing unit 30 in this embodiment are the same as those of the event processing device in the embodiment shown in FIG. 13 , and will not be repeated here.
第二处理模块31,用于通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件。The second processing module 31 is configured to obtain and execute multiple task events meeting the second preset condition in the first target event through multi-threading.
执行模块32,用于在执行完多个任务事件之后,获取第三请求,并向客户端发送用于指示执行完多个任务事件的第一响应结果,其中,第三请求用于请求执行第三目标事件,第三目标事件为在远程过程调用中执行的事件。The execution module 32 is configured to obtain a third request after executing multiple task events, and send a first response result indicating that multiple task events are executed to the client, wherein the third request is used to request the execution of the first task event. Three target events, the third target event is an event executed in a remote procedure call.
需要说明的是,该实施例中的第一获取单元10可以用于执行本申请实施例1中的步骤S302,该实施例中的第二获取单元20可以用于执行本申请实施例1中的步骤S304,该实施例中的第一处理单元30可以用于执行本申请实施例1中的步骤S306。It should be noted that the first acquisition unit 10 in this embodiment can be used to execute step S302 in Embodiment 1 of the present application, and the second acquisition unit 20 in this embodiment can be used to execute step S302 in Embodiment 1 of the present application. In step S304, the first processing unit 30 in this embodiment may be used to execute step S306 in Embodiment 1 of the present application.
该实施例通过第一获取单元10获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件,通过第二获取单元20在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应,通过第一处理单元30通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应,由于同时采用多进程和多线程处理事件,能够满足各式各样的事件处理需求,从而实现了提高远程过程调用中的事件处理效率的技术效果,进而解决了相关技术远程过程调用中的事件处理效率低下的技术问题。In this embodiment, the first request is obtained by the first obtaining unit 10, wherein the first request is used to request the execution of the first target event, and the first target event is an event executed in a remote procedure call. When a request meets the first preset condition, obtain the multi-processes used to process the first target event in the proxy server, wherein the number of multi-processes is pre-configured by the proxy server, and the number of multi-processes is the same as Corresponding to the first target event, the first target event is processed by the first processing unit 30 through the multi-threads corresponding to each process in the multi-process, wherein the number of threads of the multi-thread is pre-configured by the proxy server, and the number of threads of the multi-thread Corresponding to the first target event, due to the use of multi-process and multi-thread processing events at the same time, it can meet various event processing requirements, thereby achieving the technical effect of improving the event processing efficiency in remote procedure calls, and then solving related problems. Technical issues with event handling inefficiencies in technical remote procedure calls.
此处需要说明的是,上述单元和模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例1所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图2所示的硬件环境中,可以通过软件实现,也可以通过硬件实现,其中,硬件环境包括网络环境。It should be noted here that the examples and application scenarios implemented by the above units and modules are the same as those of the corresponding steps, but are not limited to the content disclosed in Embodiment 1 above. It should be noted that, as a part of the device, the above modules can run in the hardware environment shown in FIG. 2 , and can be implemented by software or by hardware, wherein the hardware environment includes a network environment.
实施例4Example 4
根据本发明实施例,还提供了一种用于实施上述事件处理方法的服务器或终端。According to an embodiment of the present invention, a server or terminal for implementing the above event processing method is also provided.
图19是根据本发明实施例的一种终端的结构框图。如图19所示,该终端可以包括:一个或多个(图中仅示出一个)处理器191、存储器193、以及传输装置195。如图19所示,该终端还可以包括输入输出设备197。Fig. 19 is a structural block diagram of a terminal according to an embodiment of the present invention. As shown in FIG. 19 , the terminal may include: one or more (only one is shown in the figure) processors 191 , a
其中,存储器193可用于存储软件程序以及模块,如本发明实施例中的事件处理方法和装置对应的程序指令/模块,处理器191通过运行存储在存储器193内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的事件处理方法。存储器193可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器193可进一步包括相对于处理器191远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。Among them, the
上述的传输装置195用于经由一个网络接收或者发送数据,还可以用于处理器与存储器之间的数据传输。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装置195包括一个网络适配器(Network Interface Controller,NIC),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置195为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。The above-mentioned
其中,具体地,存储器193用于存储应用程序。Wherein, specifically, the
处理器191可以通过传输装置195调用存储器193存储的应用程序,以执行下述步骤:The processor 191 can call the application program stored in the
获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件;Obtaining a first request, wherein the first request is used to request execution of a first target event, and the first target event is an event executed in a remote procedure call;
在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应;When the first request meets the first preset condition, obtain the multi-process used to process the first target event in the proxy server, wherein the number of multi-process processes is pre-configured by the proxy server, and the multi-process process The quantity corresponds to the first target event;
通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。The first target event is processed through multi-threads corresponding to each process in the multi-processes, wherein the number of threads of the multi-threads is pre-configured by the proxy server, and the number of threads of the multi-threads corresponds to the first target event.
处理器191还用于执行下述步骤:当至少一个每个进程分别对应的预设队列中当前记录的请求的数量超过预设数量时,向客户端发送用于指示请求的数量超过预设数量的提示信息,其中,请求包括第一请求,当预设队列中当前记录的请求的数量均未超过预设数量时,通过多进程中每个进程分别对应的多线程处理第一目标事件。The processor 191 is further configured to perform the following steps: when the number of requests currently recorded in at least one preset queue corresponding to each process exceeds the preset number, send a message indicating that the number of requests exceeds the preset number to the client. The prompt information, wherein the request includes the first request, and when the number of requests currently recorded in the preset queue does not exceed the preset number, the first target event is processed by the multi-thread corresponding to each process in the multi-processes.
处理器191还用于执行下述步骤:根据预设进程模型确定多进程中的父进程;通过父进程对配置文件进行初始化,其中,配置文件用于配置在处理第一目标事件的过程中所需要的处理参数;根据初始化后的配置文件确定多进程中的多个子进程,其中,多个子进程用于对第一请求进行处理。The processor 191 is also configured to perform the following steps: determine the parent process in the multi-process according to the preset process model; initialize the configuration file through the parent process, wherein the configuration file is used to configure the process of processing the first target event Required processing parameters; multiple sub-processes in the multi-process are determined according to the initialized configuration file, wherein the multiple sub-processes are used to process the first request.
处理器191还用于执行下述步骤:在根据初始化后的配置文件确定多进程中的多个子进程之后,在第一目标事件报错的情况下,通过多个子进程接收第二请求,其中,第二请求用于请求执行第二目标事件,第二目标事件为对报错的第一目标事件进行恢复后的事件;根据第二请求处理第二目标事件。The processor 191 is further configured to perform the following steps: after determining the multiple sub-processes in the multi-process according to the initialized configuration file, in the case of an error in the first target event, receiving the second request through the multiple sub-processes, wherein, the first The second request is used to request the execution of the second target event, and the second target event is an event after recovering the error-reported first target event; the second target event is processed according to the second request.
处理器191还用于执行下述步骤:在根据初始化后的配置文件确定多进程中的多个子进程之后,接收用于指示对代理服务器进行升级的升级指令;根据升级指令对代理服务器进行升级。The processor 191 is further configured to perform the following steps: after determining multiple sub-processes in the multi-process according to the initialized configuration file, receive an upgrade instruction for instructing to upgrade the proxy server; upgrade the proxy server according to the upgrade instruction.
处理器191还用于执行下述步骤:通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件;在执行完多个任务事件之后,获取第三请求,并向客户端发送用于指示执行完多个任务事件的第一响应结果,其中,第三请求用于请求执行第三目标事件,第三目标事件为在远程过程调用中执行的事件。The processor 191 is also configured to perform the following steps: obtain and execute multiple task events in the first target event that meet the second preset condition through multithreading; after executing the multiple task events, obtain the third request, and send The client sends a first response result indicating that multiple task events have been executed, wherein the third request is used to request execution of a third target event, and the third target event is an event executed in a remote procedure call.
处理器191还用于执行下述步骤:在获取在代理服务器中对第一目标事件进行处理所使用的多进程之前,加载用于执行第一目标事件的动态链接库,其中,动态链接库封装有多进程中用于执行第一目标事件的操作。Processor 191 is also used to perform the following steps: before acquiring the multi-process used to process the first target event in the proxy server, load a dynamic link library for executing the first target event, wherein the dynamic link library encapsulates There are multiple processes for performing operations on the first target event.
处理器191还用于执行下述步骤:获取第一请求携带的统一资源标识符,其中,统一资源标识符用于标识多进程;根据统一资源标识符从预设存储位置获取多进程,其中,预设存储位置存储了包括多进程的多个进程。The processor 191 is further configured to perform the following steps: acquire the uniform resource identifier carried by the first request, wherein the uniform resource identifier is used to identify the multi-process; acquire the multi-process from a preset storage location according to the uniform resource identifier, wherein, The preset storage location stores multiple processes including multiple processes.
采用本发明实施例,提供了一种事件处理的方案。通过采用获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件;在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应;通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。由于同时采用多进程和多线程处理事件,能够满足各式各样的事件处理需求,从而实现了提高远程过程调用中的事件处理效率的技术效果,进而解决了相关技术远程过程调用中的事件处理效率低下的技术问题。By adopting the embodiment of the present invention, a solution for event processing is provided. Acquire the first request by adopting, wherein the first request is used to request the execution of the first target event, and the first target event is an event executed in the remote procedure call; when the first request meets the first preset condition, the acquisition The multi-process used for processing the first target event in the proxy server, wherein the process quantity of the multi-process is pre-configured by the proxy server, and the process quantity of the multi-process corresponds to the first target event; through each of the multi-process The multi-threads corresponding to the processes respectively process the first target event, wherein the number of threads of the multi-threads is pre-configured by the proxy server, and the number of threads of the multi-threads corresponds to the first target event. Due to the use of multi-process and multi-thread processing events at the same time, it can meet various event processing requirements, thereby achieving the technical effect of improving the event processing efficiency in remote procedure calls, and then solving the event processing in related technology remote procedure calls Inefficient technical issues.
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, and details are not repeated in this embodiment.
本领域普通技术人员可以理解,图19所示的结构仅为示意,终端可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及移动互联网设备(Mobile InternetDevices,MID)、PAD等终端设备。图19其并不对上述电子装置的结构造成限定。例如,终端还可包括比图19中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图19所示不同的配置。Those of ordinary skill in the art can understand that the structure shown in FIG. 19 is only schematic, and the terminal can be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, and a mobile Internet device (Mobile InternetDevices, MID), PAD and other terminal equipment. FIG. 19 does not limit the structure of the above-mentioned electronic device. For example, the terminal may also include more or less components than those shown in FIG. 19 (such as a network interface, a display device, etc.), or have a configuration different from that shown in FIG. 19 .
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(RandomAccess Memory,RAM)、磁盘或光盘等。Those skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can be Including: a flash disk, a read-only memory (Read-Only Memory, ROM), a random access device (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like.
实施例5Example 5
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质存储可以用于执行事件处理方法的程序代码。The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the above-mentioned storage medium stores program codes that can be used to execute the event processing method.
可选地,在本实施例中,上述存储介质可以位于上述实施例所示的网络中的多个网络设备中的至少一个网络设备上。Optionally, in this embodiment, the foregoing storage medium may be located on at least one network device among the plurality of network devices in the network shown in the foregoing embodiments.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:Optionally, in this embodiment, the storage medium is configured to store program codes for performing the following steps:
获取第一请求,其中,第一请求用于请求执行第一目标事件,第一目标事件为在远程过程调用中执行的事件;Obtaining a first request, wherein the first request is used to request execution of a first target event, and the first target event is an event executed in a remote procedure call;
在第一请求符合第一预设条件的情况下,获取在代理服务器中对第一目标事件进行处理所使用的多进程,其中,多进程的进程数量由代理服务器预先配置,且多进程的进程数量与第一目标事件相对应;When the first request meets the first preset condition, obtain the multi-process used to process the first target event in the proxy server, wherein the number of multi-process processes is pre-configured by the proxy server, and the multi-process process The quantity corresponds to the first target event;
通过多进程中每个进程分别对应的多线程处理第一目标事件,其中,多线程的线程数量由代理服务器预先配置,且多线程的线程数量与第一目标事件相对应。The first target event is processed through multi-threads corresponding to each process in the multi-processes, wherein the number of threads of the multi-threads is pre-configured by the proxy server, and the number of threads of the multi-threads corresponds to the first target event.
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:当至少一个每个进程分别对应的预设队列中当前记录的请求的数量超过预设数量时,向客户端发送用于指示请求的数量超过预设数量的提示信息,其中,请求包括第一请求,当预设队列中当前记录的请求的数量均未超过预设数量时,通过多进程中每个进程分别对应的多线程处理第一目标事件。Optionally, the storage medium is also configured to store program codes for executing the following steps: when the number of currently recorded requests in at least one preset queue corresponding to each process exceeds the preset number, send the request to the client For the prompt information indicating that the number of requests exceeds the preset number, where the request includes the first request, when the number of requests currently recorded in the preset queue does not exceed the preset number, each process in the multi-process corresponds to The first target event is processed by multiple threads.
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:根据预设进程模型确定多进程中的父进程;通过父进程对配置文件进行初始化,其中,配置文件用于配置在处理第一目标事件的过程中所需要的处理参数;根据初始化后的配置文件确定多进程中的多个子进程,其中,多个子进程用于对第一请求进行处理。Optionally, the storage medium is also configured to store program code for performing the following steps: determine the parent process in the multi-process according to the preset process model; initialize the configuration file through the parent process, wherein the configuration file is used to configure the Processing parameters required in the process of processing the first target event; multiple sub-processes in the multi-process are determined according to the initialized configuration file, wherein the multiple sub-processes are used to process the first request.
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:在根据初始化后的配置文件确定多进程中的多个子进程之后,在第一目标事件报错的情况下,通过多个子进程接收第二请求,其中,第二请求用于请求执行第二目标事件,第二目标事件为对报错的第一目标事件进行恢复后的事件;根据第二请求处理第二目标事件。Optionally, the storage medium is also configured to store program codes for executing the following steps: After determining multiple sub-processes in the multi-process according to the initialized configuration file, in the case of an error in the first target event, through the multiple sub-processes The process receives a second request, wherein the second request is used for requesting execution of a second target event, and the second target event is an event after recovering the error-reported first target event; and processes the second target event according to the second request.
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:在根据初始化后的配置文件确定多进程中的多个子进程之后,接收用于指示对代理服务器进行升级的升级指令;根据升级指令对代理服务器进行升级。Optionally, the storage medium is also configured to store program codes for performing the following steps: after determining multiple sub-processes in the multi-process according to the initialized configuration file, receiving an upgrade instruction for instructing the proxy server to be upgraded; Upgrade the proxy server according to the upgrade instructions.
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:通过多线程获取并执行第一目标事件中符合第二预设条件的多个任务事件;在执行完多个任务事件之后,获取第三请求,并向客户端发送用于指示执行完多个任务事件的第一响应结果,其中,第三请求用于请求执行第三目标事件,第三目标事件为在远程过程调用中执行的事件。Optionally, the storage medium is also configured to store program codes for performing the following steps: acquire and execute multiple task events in the first target event that meet the second preset condition through multithreading; Afterwards, a third request is obtained, and a first response result indicating the execution of multiple task events is sent to the client, wherein the third request is used to request the execution of a third target event, and the third target event is a remote procedure call events executed in .
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:在获取在代理服务器中对第一目标事件进行处理所使用的多进程之前,加载用于执行第一目标事件的动态链接库,其中,动态链接库封装有多进程中用于执行第一目标事件的操作。Optionally, the storage medium is also configured to store program codes for executing the following steps: before acquiring the multi-process used for processing the first target event in the proxy server, loading the dynamic code for executing the first target event A link library, wherein the dynamic link library encapsulates operations for executing the first target event in multiple processes.
可选地,存储介质还被设置为存储用于执行以下步骤的程序代码:获取第一请求携带的统一资源标识符,其中,统一资源标识符用于标识多进程;根据统一资源标识符从预设存储位置获取多进程,其中,预设存储位置存储了包括多进程的多个进程。Optionally, the storage medium is further configured to store program codes for performing the following steps: obtaining the uniform resource identifier carried by the first request, wherein the uniform resource identifier is used to identify multiple processes; It is assumed that the storage location acquires multiple processes, wherein the preset storage location stores multiple processes including multiple processes.
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, and details are not repeated in this embodiment.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。Optionally, in this embodiment, the above-mentioned storage medium may include but not limited to: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk Various media that can store program codes such as discs or optical discs.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the above embodiments of the present invention are for description only, and do not represent the advantages and disadvantages of the embodiments.
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。If the integrated units in the above embodiments are realized in the form of software function units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium. Several instructions are included to make one or more computer devices (which may be personal computers, servers or network devices, etc.) execute all or part of the steps of the methods described in the various embodiments of the present invention.
在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present invention, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. Wherein, the device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or can be Integrate into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of units or modules may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above is only a preferred embodiment of the present invention, it should be pointed out that, for those of ordinary skill in the art, without departing from the principle of the present invention, some improvements and modifications can also be made, and these improvements and modifications can also be made. It should be regarded as the protection scope of the present invention.
Claims (12)
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 CN108733496A (en) | 2018-11-02 |
CN108733496B true 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) |
Families Citing this family (10)
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 |
CN111770123B (en) * | 2019-04-02 | 2022-01-11 | 华为技术有限公司 | Communication method, apparatus and storage medium |
CN110147269B (en) * | 2019-05-09 | 2023-06-13 | 腾讯科技(上海)有限公司 | Event processing method, device, equipment and storage medium |
CN110569112B (en) * | 2019-09-12 | 2022-04-08 | 江苏安超云软件有限公司 | Log data writing method and object storage daemon device |
CN112114976B (en) * | 2020-08-19 | 2024-03-22 | 浙江大搜车融资租赁有限公司 | Service processing method, device, equipment and storage medium |
CN112231114B (en) * | 2020-09-22 | 2024-10-25 | 深圳云天励飞技术股份有限公司 | Event processing method and related equipment |
CN112698791B (en) * | 2020-12-31 | 2024-09-10 | 珠海豹趣科技有限公司 | Method and device for cleaning system disk, electronic equipment and storage medium |
CN114936091A (en) * | 2022-04-30 | 2022-08-23 | 济南浪潮数据技术有限公司 | Method, device, equipment and storage medium for batch remote request calling protocol |
CN116192609B (en) * | 2023-02-20 | 2025-08-01 | 北京天融信网络安全技术有限公司 | Network event processing method and device and electronic equipment |
CN119728756A (en) * | 2024-12-02 | 2025-03-28 | 天翼云科技有限公司 | Event processing method and device |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106293670A (en) * | 2015-06-03 | 2017-01-04 | 阿里巴巴集团控股有限公司 | A kind of event-handling method, equipment and a kind of server |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7249355B2 (en) * | 2002-12-18 | 2007-07-24 | Microsoft Corporation | Unified network thread management |
US7203863B2 (en) * | 2003-05-09 | 2007-04-10 | Oracle International Corporation | Distributed transaction state management through application server clustering |
CN101127685B (en) * | 2007-09-20 | 2011-05-25 | 中兴通讯股份有限公司 | An inter-process communication device and inter-process communication method |
CN105808428B (en) * | 2016-03-03 | 2018-09-14 | 南京大学 | A method of unified performance test is carried out to distributed file system |
-
2017
- 2017-04-24 CN CN201710273195.0A patent/CN108733496B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106293670A (en) * | 2015-06-03 | 2017-01-04 | 阿里巴巴集团控股有限公司 | A kind of event-handling method, equipment and a kind of server |
Also Published As
Publication number | Publication date |
---|---|
CN108733496A (en) | 2018-11-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108733496B (en) | Event processing method and device | |
US11210109B2 (en) | Method and system for loading resources | |
US8387075B1 (en) | Common scheduling and synchronization primitives | |
CN106161537B (en) | Method, device and system for processing remote procedure call and electronic equipment | |
US9766921B2 (en) | Fast-booting application image using variation points in application source code | |
US7171663B2 (en) | External event interrupt for server-side programs | |
CN110990132B (en) | Asynchronous task processing method and device, computer equipment and storage medium | |
CN109308241B (en) | Method, device, terminal device and storage medium for monitoring application startup process | |
CN103746782B (en) | Method and apparatus for obtaining feedback information of application | |
EP2932390B1 (en) | Inversion-of-control component service models for virtual environments | |
US7950022B1 (en) | Techniques for use with device drivers in a common software environment | |
US8286194B2 (en) | Coupling state aware systems | |
CN103064680B (en) | The player method of plug-in unit and device in browser | |
CN105069163B (en) | Network request treating method and apparatus | |
US20210263736A1 (en) | Semantic functional wrappers of services | |
CN109729121A (en) | A kind of cloud storage system and the method for realizing self-defining data processing in cloud storage system | |
WO2015062494A1 (en) | Method and device for sdk uploading and downloading of a file | |
CN115550354A (en) | Data processing method and device and computer readable storage medium | |
US7950025B1 (en) | Common software environment | |
CN115373869A (en) | Process processing method and device based on AAR and electronic equipment | |
CN103077047B (en) | A kind of plug-in playback method and device | |
CN113127775B (en) | Page loading method, device, equipment and storage medium | |
US10628513B2 (en) | Providing isolated extensibility for webpages with a unified manifest and omni-accessible platform script | |
CN117667421A (en) | Implementation method, device, computer equipment and storage medium of distributed lock | |
US8205218B1 (en) | Data storage system having common software environment |
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 |