WO2016177081A1 - 通知消息处理方法及装置 - Google Patents

通知消息处理方法及装置 Download PDF

Info

Publication number
WO2016177081A1
WO2016177081A1 PCT/CN2016/075776 CN2016075776W WO2016177081A1 WO 2016177081 A1 WO2016177081 A1 WO 2016177081A1 CN 2016075776 W CN2016075776 W CN 2016075776W WO 2016177081 A1 WO2016177081 A1 WO 2016177081A1
Authority
WO
WIPO (PCT)
Prior art keywords
notification message
module
new notification
processing
thread
Prior art date
Application number
PCT/CN2016/075776
Other languages
English (en)
French (fr)
Inventor
胡锐
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016177081A1 publication Critical patent/WO2016177081A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/224Monitoring or handling of messages providing notification on incoming messages, e.g. pushed notifications of received messages
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/216Handling conversation history, e.g. grouping of messages in sessions or threads

Definitions

  • This application relates to, but is not limited to, the field of communications.
  • each process needs to exchange information through the network and coordinate related processing.
  • multi-threaded methods are used to process message notifications on current multi-core hosts, but in multi-thread processing.
  • the process of notifying the message it is necessary to ensure that the order in which the thread processes each notification message is the same as the order in which each notification message is received. Otherwise, the business logic may be in a problem; the multi-thread processing method of the related technology in the related art is in a large distributed manner. It is difficult to ensure the above requirements in the system and the number of threads occupied by the notification message processing is large, and the system resource utilization is low.
  • the present invention provides a notification message processing method and apparatus, and solves the problem that the multi-thread processing notification message of the related art is difficult to ensure that the order of processing the notification message is consistent with the order of receiving the notification message, and the resource utilization rate is low.
  • An embodiment of the present invention provides a method for processing a notification message, including:
  • the pre-ordering queue is configured to sequentially store corresponding notification messages according to a preset rule
  • the worker thread module in the idle state is selected from the thread pool
  • the worker thread module processes the new notification message stored in the sequencer queue.
  • the method further includes:
  • the worker thread module determines whether the pre-order queue has an unprocessed new notification message, and if so, continues processing the unprocessed new notification message.
  • the method further includes: if the worker thread module determines that there is no unprocessed new notification message in the sequence, and starts timing monitoring in the waiting time threshold t. Whether the queue receives a new notification message, and if so, continues processing the new notification message.
  • the method further comprises: when the sequence queue does not receive a new notification message within the waiting time threshold t, the worker thread module returns to the thread pool.
  • the method further comprises: maintaining a life cycle and/or a working state of each worker thread module in the thread pool.
  • An embodiment of the present invention further provides a notification message processing apparatus, including:
  • the monitoring thread module is configured to: monitor whether a new notification message is stored in each of the order-preserving queues; and the order-preserving queue is configured to sequentially store the corresponding notification message according to a preset rule;
  • a thread selection module configured to: when the monitoring thread module detects that a sorting queue stores a new notification message, select an idle thread working thread module from the thread pool;
  • the worker thread module is configured to: process the new notification message stored in the sequencer queue.
  • the worker thread module includes a processing submodule and a determining submodule
  • the processing submodule is configured to: process the new notification message
  • the determining sub-module is configured to: after the processing sub-module processes the new notification message, determine whether the pre-ordering queue has an unprocessed new notification message, and if yes, notify the processing sub-module The new notification message for processing continues to be processed.
  • the worker thread module further includes a monitoring sub-module, configured to: when the determining sub-module determines that there is no unprocessed new notification message in the order-preserving queue, The start timing monitors whether the hold queue receives a new notification message within the wait time threshold t, and if so, notifies the processing sub-module to continue processing the new notification message.
  • a monitoring sub-module configured to: when the determining sub-module determines that there is no unprocessed new notification message in the order-preserving queue, The start timing monitors whether the hold queue receives a new notification message within the wait time threshold t, and if so, notifies the processing sub-module to continue processing the new notification message.
  • the monitoring submodule is further configured to: when the sequence queue does not receive a new notification message within the waiting time threshold t, return the worker thread module to the thread Pool.
  • the thread pool maintenance module is further configured to: maintain a life cycle and/or a working state of each worker thread module in the thread pool.
  • the embodiment of the present invention further provides a computer readable storage medium storing computer executable instructions for performing the method of any of the above.
  • the method and device for processing a notification message firstly stores a corresponding notification message in sequence according to a preset rule by using a sequence-preserving queue, so as to ensure processing sequence and reception when processing a notification message in each protection sequence.
  • the order of each notification message is consistent; then, it is monitored whether a new notification message is stored in each of the order-preserving queues, and when it is detected that the order-preserving queue is stored in the new notification message, the current working state is selected as the idle state from the thread pool.
  • the worker thread module processes the new notification message stored in the order queue by the worker thread module.
  • the use of the thread pool can achieve the reuse of the worker threads in the thread pool, and ensure that the processing of all the notification messages can be effectively completed by using threads that are far less than the data of the orderly queues, thereby improving system resource utilization.
  • FIG. 1 is a schematic flowchart 1 of a process for processing a notification message according to Embodiment 1 of the present invention
  • FIG. 2 is a second schematic flowchart of a process for processing a notification message according to Embodiment 1 of the present invention
  • FIG. 3 is a schematic structural diagram 1 of a notification message processing apparatus according to Embodiment 2 of the present invention.
  • FIG. 4 is a schematic structural diagram 2 of a notification message processing apparatus according to Embodiment 2 of the present invention.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • the feature of the notification message is used, and the corresponding notification message is stored in the sequence according to the preset rule (that is, according to the time sequence of receiving each notification message), so as to ensure subsequent to each protection sequence.
  • the processing sequence of the notification message is the same as the order of receiving each notification message, ensuring the accuracy of the business logic, and thus ensuring the normal operation of the service.
  • the preset rule in this embodiment may be flexibly set according to an actual message type and/or an application scenario; for example, when an SNMP (Simple Network Management Protocol) TRAP message is generated, an alarm occurs. During a storm, a large number of alarm notification messages from multiple devices are reported. At this time, each alarm notification message can be stored in a different order-preserving queue according to the source IP address of the message. The notification message can be processed concurrently, and the notification messages in each order-preserving queue are processed in the order of arrival.
  • SNMP Simple Network Management Protocol
  • each notification message is stored in an orderly manner according to a preset rule, so if a fixed worker thread is used to process the notification message for each sorting queue, It will take up a lot of worker threads and consume a lot of system resources. Since in all the order-preserving queues, the number of order-preserving queues that are in the state of arrival of the new notification message is quite limited, the present embodiment proposes to use a thread pool, and each of the order-preserving queues is completed by a small number of active monitoring threads.
  • Step 101 Monitor whether a new notification message is stored in each order-preserving queue; as shown in the above, the order-preserving queue is used to sequentially store corresponding notification messages according to a preset rule, where the ordering refers to receiving The order of each notification message;
  • Step 102 When it is detected that the save order queue is stored in the new notification message, select a worker thread module in an idle state from the thread pool;
  • Step 103 The selected worker thread module processes the new notification message stored in the sequencer.
  • the method further includes:
  • Step 104 The worker thread module determines whether the pre-order queue has an unprocessed new notification message. If yes, the new notification message is newly saved in the process of processing the new notification message stored by the worker thread module. Go to step 105; if not, go to step 106;
  • Step 105 After processing the unprocessed new notification message, return to step 104 to continue the determination;
  • Step 106 Start timing monitoring, whether the sequence queue receives a new notification message within the waiting time threshold t, if yes, go to step 107; if not, go to step 108;
  • Step 107 After the new notification message is processed, the process proceeds to step 104.
  • Step 108 The worker thread module returns to the thread pool.
  • step 106 the sequence queue is only monitored by the worker thread module, and the monitoring thread does not monitor the sequence queue during this period, but still monitors other sequence queues; after step 108 above, The monitoring of the sequencer continues to be handed over by the monitoring thread.
  • the steps of maintaining the life cycle and/or the working state of each worker thread module in the thread pool may be further included, and the rules and manners of the maintenance may be based on actual application scenarios. Flexible choices are not repeated here.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the embodiment provides a notification message processing device. Referring to FIG. 3, the method includes:
  • the protection queue module 1 is configured to: store each notification message in a sequential order according to a preset rule (that is, according to the time sequence of receiving each notification message), to ensure subsequent protection for each protection.
  • the processing sequence of the notification message in the sequence is the same as the sequence of receiving the notification message, ensuring the accuracy of the service logic, and ensuring the normal operation of the service.
  • the preset rule in this embodiment may be Flexible settings based on actual message types and/or application scenarios;
  • the monitoring thread module 2 is configured to: monitor whether a new notification message is stored in each sorting queue;
  • the thread selection module 3 is configured to: when the monitoring thread module detects that there is a sequence queue to store a new notification message, select the idle state worker thread module 4 from the thread pool;
  • the worker thread module 4 is configured to process the new notification message stored in the sequencer.
  • the worker thread module 4 includes a processing sub-module 41, a determining sub-module 42 and a monitoring sub-module 43;
  • the processing sub-module 41 is configured to: process a new notification message in the order-preserving queue;
  • the judging sub-module 42 is configured to: after the processing sub-module 41 processes the new notification message, determine whether the pre-ordering queue has an unprocessed new notification message, and if so, the notification processing sub-module continues processing the new notification message for processing. If not, notify the monitoring sub-module 43;
  • the monitoring sub-module 43 is configured to: when the determining sub-module 42 determines that there is no unprocessed new notification message in the order-preserving queue, start timing monitoring whether the order-preserving queue receives the new notification message within the waiting time threshold t, and if so, notify The processing sub-module 41 continues processing the new notification message; if not, the worker thread module is returned to the thread pool.
  • the monitoring thread module 2 no longer monitors the sequence-preserving queue during this period; after the worker thread module returns to the thread pool, the monitoring of the sequence-preserving queue continues to be handed over. Executed by the monitoring thread module 2.
  • the worker thread module 4 in this embodiment can ensure that the notification message in the same sequence is processed by the same worker thread module as much as possible, thereby reducing the switching of the thread context, improving the processing efficiency, and reducing the loss of system processing performance.
  • the notification message processing apparatus in this embodiment may further include a thread pool maintenance module 5 configured to: maintain a life cycle and/or a working state of each worker thread module in the thread pool.
  • the rules and methods of maintenance can be flexibly selected according to the actual application scenarios, etc. No longer.
  • all or part of the steps of the above embodiments may also be implemented by using an integrated circuit. These steps may be separately fabricated into individual integrated circuit modules, or multiple modules or steps may be fabricated into a single integrated circuit module. achieve.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • the device/function module/functional unit in the above embodiment When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the embodiment of the present invention is based on the event-driven model, and adopts a two-layer event-driven mechanism (the monitoring event of monitoring the new notification message and the processing thread for processing the new notification message, respectively), and ensuring the orderly processing of the notification information.
  • the advantages of multi-threading in processing performance are utilized at the same time, and the competition of lock resources is not involved in the whole processing flow, and the switching of thread context is reduced, and the thread pool is adopted, thereby achieving the purpose of thread multiplexing. This ensures that all the notification messages can be processed using threads that are much smaller than the number of preserving queues.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本文公布一种通知消息处理方法及装置,利用保序队列根据预设规则按序存储相应的通知消息,监测每个保序队列中是否存入新通知消息,当监测到有保序队列存入新通知消息时,从线程池中选择出当前工作状态为空闲状态的工作线程模块,利用该工作线程模块对该保序队列存入的新通知消息进行处理。

Description

通知消息处理方法及装置 技术领域
本申请涉及但不限于通信领域。
背景技术
在分布式环境中,每个进程需要通过网络来交互信息,协调相关的处理,为了提高消息的处理效率,在目前的多核主机上都会采用多线程的方式来处理消息通知,但在多线程处理通知消息的过程中,需要保证线程处理每个通知消息的顺序与接收到每个通知消息的顺序一致,否则就会造成业务逻辑出现问题;相关技术的多线程处理通知消息的方式在大型分布式系统中很难保证上述要求且进行通知消息处理所占用的线程多,系统资源利用率低。
因此在多线程处理通知消息过程中如何保证上述要求且尽可能占用较少线程以提升资源利用率就显得尤为重要。
发明内容
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。
本文提供一种通知消息处理方法及装置,解决相关技术的多线程处理通知消息难保证处理通知消息的顺序与接收通知消息的顺序一致,且资源利用率低的问题。
本发明实施例提供一种通知消息处理方法,包括:
监测每个保序队列中是否存入新通知消息;所述保序队列用于根据预设规则按序存储相应的通知消息;
当监测到有保序队列存入新通知消息时,从线程池中选择空闲状态的工作线程模块;
所述工作线程模块对所述保序队列存入的所述新通知消息进行处理。
在本发明的一种实施例中,所述工作线程模块对所述保序队列存入的所述新通知消息进行处理之后,还包括:
所述工作线程模块判断所述保序队列是否还有未处理的新通知消息,如有,对未处理的新通知消息继续处理。
在本发明的一种实施例中,所述方法还包括:如所述工作线程模块判断所述保序队列中没有未处理的新通知消息,开始计时监测在等待时间阈值t内所述保序队列是否接收到新通知消息,如有,则对该新通知消息继续处理。
在本发明的一种实施例中,所述方法还包括:在所述等待时间阈值t内所述保序队列没有接收到新通知消息时,所述工作线程模块回归所述线程池。
在本发明的一种实施例中,所述方法还包括:对所述线程池中的每个工作线程模块的生命周期和/或工作状态进行维护。
本发明实施例还提供了一种通知消息处理装置,包括:
监测线程模块,设置为:监测每个保序队列中是否存入新通知消息;所述保序队列用于根据预设规则按序存储相应的通知消息;
线程选择模块,设置为:在所述监测线程模块监测到有保序队列存入新通知消息时,从线程池中选择空闲状态的工作线程模块;
工作线程模块,设置为:对所述保序队列存入的所述新通知消息进行处理。
在本发明的一种实施例中,所述工作线程模块包括处理子模块和判断子模块;
所述处理子模块设置为:对所述新通知消息进行处理;
所述判断子模块设置为:在所述处理子模块对所述新通知消息进行处理后,判断所述保序队列是否还有未处理的新通知消息,如有,通知所述处理子模块对为处理的新通知消息继续处理。
在本发明的一种实施例中,所述工作线程模块还包括监测子模块,设置为:在所述判断子模块判断所述保序队列中没有未处理的新通知消息时,开 始计时监测在等待时间阈值t内所述保序队列是否接收到新通知消息,如有,则通知所述处理子模块对该新通知消息继续处理。
在本发明的一种实施例中,所述监测子模块还设置为:在所述等待时间阈值t内所述保序队列没有接收到新通知消息时,将所述工作线程模块回归所述线程池。
在本发明的一种实施例中,还包括线程池维护模块,设置为:对所述线程池中的每个工作线程模块的生命周期和/或工作状态进行维护。
本发明实施例还提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行上述任一项的方法。
本发明实施例提供的通知消息处理方法及装置,首先利用保序队列根据预设规则按序存储相应的通知消息,这样可以保证对每个保护序列中的通知消息进行处理时的处理顺序与接收到每个通知消息的顺序一致;然后监测每个保序队列中是否存入新通知消息,当监测到有保序队列存入新通知消息时,从线程池中选择出当前工作状态为空闲状态的工作线程模块,利用该工作线程模块对该保序队列存入的新通知消息进行处理。采用线程池可以实现对线程池中的工作线程的复用,保证能使用远少于保序队列数据的线程就能有效的完成对全部通知消息的处理,提升系统资源利用率。
在阅读并理解了附图和详细描述后,可以明白其他方面。
附图概述
图1为本发明实施例一提供的通知消息处理过程流程示意图一;
图2为本发明实施例一提供的通知消息处理过程流程示意图二;
图3为本发明实施例二提供的通知消息处理装置结构示意图一;
图4为本发明实施例二提供的通知消息处理装置结构示意图二。
本发明的实施方式
下面结合附图对本发明的实施方式进行说明。
实施例一:
本实施例利用通知消息的特点,采用保序队列对按照预设规则按序(也即按照接收到每个通知消息的时间先后)存储相应的通知消息,以保证后续对每个保护序列中的通知消息进行处理时的处理顺序与接收到每个通知消息的顺序一致,保证业务逻辑的准确无误,进而保证业务的正常进行。
应当理解的是,本实施例中的预设规则可以根据实际的消息类型和/或应用场景进行灵活设定;例如,对于SNMP(Simple Network Management Protocol,简单网络管理协议)TRAP消息,当发生告警风暴时,会上报来自多个设备的大量告警通知信息,此时就可将每个告警通知消息会按照消息的源IP地址存入到不同的保序队列中,每个保序队列之间的通知消息可以并发的进行处理,且每个保序队列中的通知消息都按照到达的先后次序进行处理。
另外,考虑到大型分布系统中需要较多的这种保序队列对每个通知消息按照预设规则进行有序存储,因此如果为每个保序队列指定用一个固定的工作线程处理通知消息的话,就会占用大量的工作线程,消耗很多的系统资源。由于在所有保序队列中,同时处于有新通知消息到达状态的保序队列的数量是相当有限的,因此本实施例提出采用线程池,且通过少量活动的监测线程来完成每个保序队列消息状态的监控,在监测到有保序队列有新的通知消息到达时,则从线程池选择出工作状态为空闲状态的工作线程模块对该保护队列中的新通知消息进行处理,处理完后则可回归线程池等待下一次或者其他保序列队的调用,这样采用线程池可以实现对线程池中的工作线程的复用,保证能使用远少于保序队列数据的线程就能有效的完成对全部通知消息的处理,提升系统资源利用率。上述过程请参见图1所示,包括:
步骤101:监测每个保序队列中是否存入新通知消息;如上所示,此处的保序队列用于根据预设规则按序存储相应的通知消息,此处的按序是指按接收到每个通知消息的先后顺序;
步骤102:监测到有保序队列存入新通知消息时,从线程池中选择空闲状态的工作线程模块;
步骤103:选择出的工作线程模块对该保序队列存入的新通知消息进行处理。
请参见图2所示,在本实施例中,在上述步骤103工作线程模块处理完新通知消息后,还包括:
步骤104:工作线程模块判断该保序队列是否还有未处理的新通知消息,如有,则该新通知消息则是工作线程模块处理之前存入的新通知消息过程中新存入的,转至步骤105;如没有,则转至步骤106;
步骤105,对未处理的新通知消息继续处理后,转回步骤104继续判断;
步骤106:开始计时监测,在等待时间阈值t内保序队列是否接收到新通知消息,如有,转至步骤107;如没有,则转至步骤108;
步骤107:对该新通知消息继续处理后,转至步骤104。
步骤108:工作线程模块回归线程池。
在上述步骤106中,仅由工作线程模块对该保序队列进行监测,监测线程在此期间不再对该保序队列进行监测,但仍对其他保序队列进行监测;在上述步骤108之后,该保序队列的监测则继续转交由监测线程执行。
通过上述步骤104-108,可以保证同一保序队列中的通知消息尽量由同一工作线程模块进行处理,从而降低线程上下文的切换,提升处理效率,降低系统处理性能的损耗。
本实施例中,在上述步骤过程中,还可包括对线程池中的每个工作线程模块的生命周期和/或工作状态进行维护的步骤,维护的规则和方式都可根据实际的应用场景等灵活选择,此处不再赘述。
实施例二:
本实施例提供一种通知消息处理装置,请参见图3所示,包括:
保护队列模块1,设置为:根据预设规则将每个通知消息按序存(也即按照接收到每个通知消息的时间先后)储到相应的保序队列中,以保证后续对每个保护序列中的通知消息进行处理时的处理顺序与接收到每个通知消息的顺序一致,保证业务逻辑的准确无误,进而保证业务的正常进行;应当理解的是,本实施例中的预设规则可以根据实际的消息类型和/或应用场景进行灵活设定;
监测线程模块2,设置为:监测每个保序队列中是否存入新通知消息;
线程选择模块3,设置为:在监测线程模块监测到有保序队列存入新通知消息时,从线程池中选择空闲状态的工作线程模块4;
工作线程模块4,设置为:对该保序队列存入的新通知消息进行处理。
其中,工作线程模块4包括处理子模块41、判断子模块42和监测子模块43;
处理子模块41设置为:对保序队列中的新通知消息进行处理;
判断子模块42设置为:在处理子模块41对新通知消息进行处理后,判断保序队列是否还有未处理的新通知消息,如有,通知处理子模块对为处理的新通知消息继续处理;如没有,则通知监测子模块43;
监测子模块43设置为:在判断子模块42判断保序队列中没有未处理的新通知消息时,开始计时监测在等待时间阈值t内保序队列是否接收到新通知消息,如有,则通知处理子模块41对该新通知消息继续处理;如没有,则将该工作线程模块回归线程池。在监测子模块43对该保序队列监测过程中,监测线程模块2在此期间不再对该保序队列进行监测;在该工作线程模块回归线程池后,该保序队列的监测则继续转交由监测线程模块2执行。
可见,本实施例中的工作线程模块4可以保证同一保序队列中的通知消息尽量由同一工作线程模块进行处理,从而降低线程上下文的切换,提升处理效率,降低系统处理性能的损耗。
请参见图4所示,本实施例中的通知消息处理装置还可包括线程池维护模块5,设置为:对所线程池中的每个工作线程模块的生命周期和/或工作状态进行维护,维护的规则和方式都可根据实际的应用场景等灵活选择,此处 不再赘述。
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(如系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。
上述实施例中的装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。
上述实施例中的装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。
工业实用性
本发明实施例以事件驱动模型为理论基础,采用了两层事件驱动机制(分别为监测新通知消息到来事件和处理该新通知消息的工作线程选择处理事件),在保证通知信息有序处理的前提下,同时利用了多线程在处理性能的优势,并且在整个处理流程中,不涉及对锁资源的竞争,并且减少了线程上下文的切换,同时采用了线程池,达到了线程复用的目的,保证了能使用远少于保序队列数目的线程,就能完成对全部通知消息的处理。

Claims (11)

  1. 一种通知消息处理方法,包括:
    监测每个保序队列中是否存入新通知消息;所述保序队列用于根据预设规则按序存储相应的通知消息;
    当监测到有保序队列存入新通知消息时,从线程池中选择空闲状态的工作线程模块;
    所述工作线程模块对所述保序队列存入的所述新通知消息进行处理。
  2. 如权利要求1所述的通知消息处理方法,其中,所述工作线程模块对所述保序队列存入的所述新通知消息进行处理之后,还包括:
    所述工作线程模块判断所述保序队列是否还有未处理的新通知消息,如有,对未处理的新通知消息继续处理。
  3. 如权利要求2所述的通知消息处理方法,还包括,如所述工作线程模块判断所述保序队列中没有未处理的新通知消息,开始计时监测在等待时间阈值t内所述保序队列是否接收到新通知消息,如有,则对该新通知消息继续处理。
  4. 如权利要求3所述的通知消息处理方法,还包括,在所述等待时间阈值t内所述保序队列没有接收到新通知消息时,所述工作线程模块回归所述线程池。
  5. 如权利要求1-4任一项所述的通知消息处理方法,还包括:对所述线程池中的每个工作线程模块的生命周期和/或工作状态进行维护。
  6. 一种通知消息处理装置,包括:
    监测线程模块,设置为:监测每个保序队列中是否存入新通知消息;所述保序队列用于根据预设规则按序存储相应的通知消息;
    线程选择模块,设置为:在所述监测线程模块监测到有保序队列存入新通知消息时,从线程池中选择空闲状态的工作线程模块;
    工作线程模块,设置为:对所述保序队列存入的所述新通知消息进行处理。
  7. 利要求6所述的消息处理装置,其中,所述工作线程模块包括处理子模块和判断子模块;
    所述处理子模块设置为:对所述新通知消息进行处理;
    所述判断子模块设置为:在所述处理子模块对所述新通知消息进行处理后,判断所述保序队列是否还有未处理的新通知消息,如有,通知所述处理子模块对为处理的新通知消息继续处理。
  8. 权利要求7所述的消息处理装置,其中,所述工作线程模块还包括监测子模块,设置为:在所述判断子模块判断所述保序队列中没有未处理的新通知消息时,开始计时监测在等待时间阈值t内所述保序队列是否接收到新通知消息,如有,则通知所述处理子模块对该新通知消息继续处理。
  9. 如权利要求8所述的消息处理装置,其中,所述监测子模块还设置为:在所述等待时间阈值t内所述保序队列没有接收到新通知消息时,将所述工作线程模块回归所述线程池。
  10. 如权利要求6-9任一项所述的消息处理装置,还包括线程池维护模块,设置为:对所述线程池中的每个工作线程模块的生命周期和/或工作状态进行维护。
  11. 一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1-5任一项的方法。
PCT/CN2016/075776 2015-08-07 2016-03-07 通知消息处理方法及装置 WO2016177081A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510483419.1 2015-08-07
CN201510483419.1A CN106453029A (zh) 2015-08-07 2015-08-07 通知消息处理方法及装置

Publications (1)

Publication Number Publication Date
WO2016177081A1 true WO2016177081A1 (zh) 2016-11-10

Family

ID=57218493

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/075776 WO2016177081A1 (zh) 2015-08-07 2016-03-07 通知消息处理方法及装置

Country Status (2)

Country Link
CN (1) CN106453029A (zh)
WO (1) WO2016177081A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778321A (zh) * 2021-01-15 2021-12-10 北京沃东天骏信息技术有限公司 消息处理的方法和装置

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107577529A (zh) * 2017-09-21 2018-01-12 浪潮软件股份有限公司 一种请求处理方法及装置
CN108881492B (zh) * 2018-08-08 2020-03-31 百卓网络科技有限公司 一种解决消息处理顺序及疏导消息处理的方法
CN109376020B (zh) * 2018-09-18 2021-02-12 中国银行股份有限公司 多区块链交互并发下的数据处理方法、装置及存储介质
CN111143065B (zh) * 2019-12-25 2023-08-22 杭州安恒信息技术股份有限公司 一种数据处理方法、装置、设备及介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6298386B1 (en) * 1996-08-14 2001-10-02 Emc Corporation Network file server having a message collector queue for connection and connectionless oriented protocols
CN101179553A (zh) * 2006-10-30 2008-05-14 国际商业机器公司 用于并行消息的有效保序传递的方法和装置
CN103197968A (zh) * 2013-03-18 2013-07-10 焦点科技股份有限公司 一种融合同步异步特点的线程池处理方法及系统

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6298386B1 (en) * 1996-08-14 2001-10-02 Emc Corporation Network file server having a message collector queue for connection and connectionless oriented protocols
CN101179553A (zh) * 2006-10-30 2008-05-14 国际商业机器公司 用于并行消息的有效保序传递的方法和装置
CN103197968A (zh) * 2013-03-18 2013-07-10 焦点科技股份有限公司 一种融合同步异步特点的线程池处理方法及系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113778321A (zh) * 2021-01-15 2021-12-10 北京沃东天骏信息技术有限公司 消息处理的方法和装置

Also Published As

Publication number Publication date
CN106453029A (zh) 2017-02-22

Similar Documents

Publication Publication Date Title
WO2016177081A1 (zh) 通知消息处理方法及装置
US11157061B2 (en) Processor management via thread status
US9501319B2 (en) Method and apparatus for scheduling blocking tasks
EP2701074B1 (en) Method, device, and system for performing scheduling in multi-processor core system
US20170061566A1 (en) Technologies for offloading network packet processing to a gpu
US20170091013A1 (en) Pcie error reporting and throttling
CN107491346A (zh) 一种应用的任务处理方法、装置及系统
US20160371122A1 (en) File processing workflow management
US20120284720A1 (en) Hardware assisted scheduling in computer system
US9916178B2 (en) Technologies for integrated thread scheduling
CN111427751A (zh) 基于异步处理机制对业务进行处理的方法及系统
CN107451012A (zh) 一种数据备份方法及流计算系统
CN101452399A (zh) 任务二级调度模块及方法
WO2021046932A1 (zh) 基于实时操作系统的消息驱动方法和装置
CN112860401B (zh) 任务调度方法、装置、电子设备和存储介质
EP3084603B1 (en) System and method for supporting adaptive busy wait in a computing environment
WO2016082463A1 (zh) 一种多核处理器下的数据处理方法、装置及存储介质
EP3396553B1 (en) Method and device for processing data after restart of node
CN109257280B (zh) 一种微引擎及其处理报文的方法
US20170161114A1 (en) Method and apparatus for time-based scheduling of tasks
CN107562527B (zh) 一种rtos上的smp的实时任务调度方法
CN107239417B (zh) 基于异步事件框架机制处理低速外设访问的系统及方法
WO2017020639A1 (zh) 网络处理器、报文处理数据的获取方法和存储介质
CN111381941A (zh) 并发任务处理系统中提供QoS的方法与装置
EP2962199B1 (en) System and method for supporting cooperative concurrency in a middleware machine environment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16789075

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16789075

Country of ref document: EP

Kind code of ref document: A1