WO2019061647A1 - 队列消息处理方法、装置、终端设备及介质 - Google Patents

队列消息处理方法、装置、终端设备及介质 Download PDF

Info

Publication number
WO2019061647A1
WO2019061647A1 PCT/CN2017/108623 CN2017108623W WO2019061647A1 WO 2019061647 A1 WO2019061647 A1 WO 2019061647A1 CN 2017108623 W CN2017108623 W CN 2017108623W WO 2019061647 A1 WO2019061647 A1 WO 2019061647A1
Authority
WO
WIPO (PCT)
Prior art keywords
queue
message
run
run queue
unprocessed
Prior art date
Application number
PCT/CN2017/108623
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 WO2019061647A1 publication Critical patent/WO2019061647A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Definitions

  • This application belongs to the field of data processing technologies, and in particular, to a queue message processing method, apparatus, terminal device, and medium.
  • Message queues are used to store messages during the transmission of messages.
  • Traditional message queues use "first in, first out” or “last in, first out” to implement message entry and dequeue. For a large number of messages, the transmission processing needs to be performed. The traditional message queue needs to periodically wait for the status of the query queue, which results in low efficiency and poor message forwarding.
  • the embodiment of the present application provides a method, a device, a terminal device, and a medium for processing a queue message, so as to solve the problem in the prior art that the state of the query queue is periodically waited for, and the efficiency is low and the actual performance is relatively low. Poor question.
  • a first aspect of the embodiments of the present application provides a method for processing a queue message, including:
  • the queue message waiting for the inbound queue is stored in the wait queue; the wait queue is constructed based on the unbounded set of the distributed document storage database.
  • a second aspect of the embodiment of the present application provides a queue message processing apparatus, including:
  • a queue setting module configured to set a run queue and a wait queue, wherein the run queue is constructed based on a fixed set of distributed document storage databases, and the wait queue is constructed based on an unbounded set of distributed document storage databases;
  • a load calculation module configured to acquire an unprocessed message in the run queue, and calculate a current load of the run queue according to an unprocessed message in the run queue, where the run queue is based on a distributed document storage database Fixed set construction;
  • a determining module configured to determine, according to a current loading degree of the running queue, whether an unprocessed message in the running queue exceeds a current limit of the running queue
  • a processing module configured to: when an unprocessed message in the run queue does not exceed a current limit of the run queue, store a queue message waiting for an entry into the run queue; After the queue message is stored in the running queue, the current load of the running queue increases;
  • the processing module is further configured to: when the unprocessed message in the run queue exceeds a current limit of the run queue, store a queue message waiting for an entry into a wait queue; the wait queue is based on a distributed An unbounded collection of document storage databases.
  • a third aspect of the embodiments of the present application provides a queue message processing terminal device, including a memory, a processor, and computer readable instructions stored in the memory and operable on the processor, The processor executes the computer readable instructions to implement the following steps:
  • the queue message waiting for the entry is stored in the wait queue; the wait queue is constructed based on the unbounded set of the distributed document storage database.
  • a fourth aspect of the embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the computer readable instructions being executed by at least one processor The following steps:
  • the queue message waiting for the inbound queue is stored in the wait queue; the wait queue is constructed based on the unbounded set of the distributed document storage database.
  • an unprocessed message in a run queue is obtained, according to an unprocessed in the run queue.
  • the message calculates a current load of the run queue, and if an unprocessed message in the run queue does not exceed a current limit of the run queue, storing a queue message waiting for an entry into the run queue, If the unprocessed message in the run queue exceeds the current limit of the run queue, the queue message waiting for the queue is stored in the wait queue, and the "producer-consumer" model is introduced by setting the run queue and the wait queue.
  • the running queue After entering the queue, it is temporarily stored in the waiting queue, and the running queue is built based on a fixed set of distributed document storage database, which can realize efficient query and update, thereby improving the realism of the message and eliminating the longest data in the daytime. , improve the efficiency of message transmission.
  • FIG. 1 is a flowchart of an implementation of a queue message processing method according to an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of a run queue provided by an embodiment of the present application.
  • step S103 in FIG. 1 is a flowchart of an implementation of step S103 in FIG. 1;
  • FIG. 4 is a schematic diagram of an operating environment of a queue message processing program according to an embodiment of the present application.
  • 5 is a program module diagram of a queue message processing program provided by an embodiment of the present application.
  • Step S101 setting a running queue and a waiting queue, where the running queue stores data based on a distributed document.
  • a running queue is built by a fixed collection of MONGODB (Distributed Document Storage Database).
  • the running queue is a circular queue.
  • the inserted queue message will overwrite the initial queue message.
  • the value of the first queue message in the run queue corresponds to 5
  • the value corresponding to the second queue message is -3
  • the value corresponding to the third queue message is 17,
  • the fourth queue message corresponds to The value is -9
  • the value corresponding to the Nth queue message is 56
  • N is a positive integer.
  • the two queues of the running queue and the waiting queue can conveniently process the subsequent information, and refer to the related content of the subsequent steps.
  • Step S102 Acquire an unprocessed message in the run queue, and calculate a current load degree of the run queue according to the unprocessed message in the run queue.
  • the calculating the current load degree of the running queue according to the unprocessed message in the running queue in step S102 may be: occupying according to a preset load and the unprocessed message. Load, calculate the current load of the run queue.
  • the preset load of the running queue is set in advance, and the current load degree of the running queue is calculated.
  • the system startup phase or the operation phase increases or decreases the load degree in advance. On the one hand, it can be used for the availability verification of the MQ service after the startup of the distributed document storage database, and on the other hand, the load degree calculation abnormality caused by the unpredictable special reason can be prevented. Increasing or decreasing the load allows the system to make moderate self-tuning.
  • the current load degree of the running queue is correspondingly increased, for example, 1 is added to the original value; after the message is dequeued, the current load degree of the running queue will be correspondingly Decrease, for example, by one on the basis of the original value.
  • the current load of the run queue is less than or equal to zero, the query request will not be submitted to the distributed document storage database to save resources.
  • the method may further include: starting the MQ service of the distributed document storage database, including parameter loading, parameter refreshing, and task re-tuning, where the specific parameters may include: a queue message length upper limit, a queue message capacity, and a message.
  • the specific parameters may include: a queue message length upper limit, a queue message capacity, and a message. The number of queued tasks, the first delay of the dequeue task, the execution time of the dequeue task, the continuation of the pessimistic dequeue, the threshold of the load ratio, the upper limit of the enrollment, the upper limit of the dequeue, Whether to start monitoring and so on.
  • the parameter information may be stored in the relational database ORACLE, and the version of the current configuration information record is calculated according to the update time and updater fields recorded in the table every fixed time, once the version is found. Changes, parameters will be overloaded to ensure that the parameters are thread-safely refreshed.
  • Step S103 Determine, according to the current loading degree of the running queue, whether an unprocessed message in the running queue exceeds a current limit of the running queue.
  • step S103 can be implemented by the following process:
  • Step S301 calculating (A/B)*C, where A is the message capacity that the running queue can accommodate, B is the preset average message size, and C is the preset load degree proportional threshold.
  • the average message size is obtained according to the statistical information of the set of mongo, and in the case of no data, the average message size is equal to the upper limit of the queue message length.
  • the preset load ratio proportional threshold may be specifically set according to actual conditions or experience or experimental data, which is not limited thereto.
  • Step S302 determining whether (A/B)*C is greater than the current load of the running queue.
  • step S303 if (A/B)*C is greater than a current load of the running queue, step S303 is performed; if (A/B)*C is greater than a current load of the running queue, Step S304 is performed.
  • Step S304 Determine that an unprocessed message in the run queue exceeds a current limit of the run queue.
  • Step S305 determining that the unprocessed message in the run queue does not exceed the current limit of the run queue
  • Step S104 The unprocessed message in the run queue does not exceed the current limit of the run queue, and the queue message waiting for the queue is stored in the run queue.
  • a preset value may be added, for example, 1; a corresponding value may also be added according to the queue message received, for example, a value related to the size, length, and the like of the queue message.
  • Step S105 After the unprocessed message in the run queue exceeds the current limit of the run queue, store the queue message waiting for the queue into the waiting queue.
  • the foregoing queue message processing method may further include:
  • the unprocessed message does not exceed the current limit of the run queue and the queue message exists in the wait queue, and the queue message in the wait queue is stored in the run queue.
  • the unprocessed message in the run queue does not exceed the current limit of the run queue and the queue message exists in the wait queue, because the queue message in the wait queue is relatively long waiting Therefore, the queue information stored in the waiting queue can be preferentially queued, stored in the running queue for calling, and the like.
  • the foregoing queue message processing method may further include:
  • the log file includes one of information such as a scenario/event ID, a service-associated MQ serial number, a host name, a start time, an end time, a current time, and a current load degree, or A variety of information, so according to the log file, it is possible to infer the business scenario in which the problem occurred based on the log file and evaluate the impact of the problem on the current system business function.
  • the main purpose is to prevent the amount of data of the individual queue messages from being huge, resulting in slow entry and exit. You can preset the upper limit of the size of the queue message. For queue messages that exceed the upper limit, the message will be rejected to ensure the stability of the system. For the monitoring of the queue message in the running queue, the queue message that is located in the running queue and is not processed for a long time can be found, so that the queue message is processed accordingly.
  • the use of the distributed document storage database save and findAndModify operations to achieve queue messages Enter and dequeue.
  • the distributed document storage database save and findAndModif y can also achieve bulk enqueue and dequeue.
  • the queue message waiting for the queue is performed and stored in the run queue.
  • the current load of the run queue is increased by 1.
  • the unprocessed message in the run queue does not exceed the current limit of the run queue, and there is a queue message in the wait queue, and the queue message in the wait queue is performed to be stored in the run queue.
  • the dequeue information of the queue message and the queue message are monitored in the running queue, and a log file is generated for storage.
  • the queue message processing method the unprocessed message in the run queue is obtained, and the current load of the run queue is calculated according to the unprocessed message in the run queue, and the unprocessed message in the run queue does not exceed
  • the current limit of the run queue is to store a queue message waiting for the queue into the run queue. After the unprocessed message in the run queue exceeds the current limit of the run queue, the queue message waiting for the queue will be waited for.
  • Stored in the wait queue introduces the "producer-consumer" model by setting the run queue and wait queue. When the queue message cannot be entered, it is temporarily stored in the wait queue, and the run queue is based on a fixed set of distributed document storage databases.
  • FIG. 4 is a schematic diagram showing the running environment of the queue message processing program provided by the embodiment of the present application. For the convenience of explanation, only the parts related to the present embodiment are shown.
  • the queue message processing program 400 is installed and runs in the terminal device 40.
  • the terminal device 40 can be a mobile terminal, a palmtop computer, a server, or the like.
  • the terminal device 40 can include, but is not limited to, a memory 401 and a processor 402.
  • Figure 4 shows only the terminal device 40 with components 401-402.
  • the memory 401 may be an internal storage unit of the terminal device 40, such as a hard disk or memory of the terminal device 40, in some embodiments.
  • the memory 401 may also be an external storage device of the terminal device 40 in other embodiments, such as a plug-in hard disk equipped on the terminal device 40, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc.
  • SMC smart memory card
  • SD Secure Digital
  • flash card etc.
  • the memory 401 may also include both an internal storage unit of the terminal device 40 and an external storage device.
  • the memory 401 is configured to store application software and various types of data installed in the terminal device 40, such as program codes of the queue message processing program 400.
  • the memory 401 can also be used to temporarily store data that has been output or is about to be output.
  • the processor 402 may be a central processing unit (Central Processing)
  • the terminal device 40 may further include a display.
  • the display may be an LE D display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode) touch sensor or the like in some embodiments.
  • the display is for displaying information processed in the terminal device 40 and a user interface for displaying visualizations, such as an application menu interface, an application icon interface, and the like.
  • the components 401-402 of the terminal device 40 communicate with one another via a system bus.
  • FIG. 5 is a program module diagram of the queue message processing program 400 provided by the embodiment of the present application.
  • the queue message processing program 400 may be divided into one or more modules, and the one or more modules are stored in the memory 401 and configured by one or more processors (this An embodiment is performed by the processor 402) to complete the application.
  • the queue message processing program 400 can be divided into a queue setting module 501, a load degree calculation module 502, a determination module 50 3, and a processing module 504.
  • a module referred to in this application refers to a series of computer readable instruction segments capable of performing a particular function, and is more suitable than the program to describe the execution of the queue message processing program 400 in the terminal device 40. The following description will specifically describe the functions of the modules 501-504.
  • the queue setting module 501 is configured to set a running queue and a waiting queue, wherein the running queue is constructed based on a fixed set of distributed document storage databases, and the waiting queue is constructed based on an unbounded set of distributed document storage databases.
  • the load calculation module 502 is configured to acquire an unprocessed message in the run queue, and calculate a current load of the run queue according to the unprocessed message in the run queue, where the run queue is based on a distributed document storage database. Fixed collection build.
  • the determining module 503 is configured to determine, according to the current loading degree of the running queue, whether an unprocessed message in the running queue exceeds a current limit of the running queue.
  • the processing module 504 is configured to: when an unprocessed message in the run queue does not exceed a current limit of the run queue, store a queue message waiting for an entry into the run queue; After the queue message of the column is stored in the run queue, the current load of the run queue increases.
  • the processing module 504 is further configured to: when the unprocessed message in the run queue exceeds a current limit of the run queue, store a queue message waiting for an entry into a wait queue; the wait queue is based on a distributed document. Unbounded collection build of the storage database.
  • the load calculation module 502 is specifically configured to: calculate a current load of the run queue according to a preset load and a load occupied by the unprocessed message.
  • the determining module 503 is specifically configured to:
  • the queue information processing program 400 may also be divided into a monitoring module.
  • the monitoring module may also be divided into a monitoring module.
  • the processing module 504 is further configured to: in the running queue, an unprocessed message does not exceed a current limit of the running queue, and a queue message exists in the waiting queue, where the waiting queue is Queue messages are stored in the run queue.
  • the unit described as a separate component may or may not be physically distributed, and the component displayed as a unit may or may not be a physical unit, that is, may be located in one place, or may be distributed to multiple On the network unit. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated modules/units if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium.
  • the present application implements all or part of the processes in the foregoing embodiments, and may also be implemented by instructing related hardware by computer readable instructions, which may be stored in a computer readable storage medium.
  • the computer readable instructions are executed by the processor to implement the steps of the various method embodiments described above.
  • the computer readable instructions include computer readable instruction code, which may be in the form of source code, object code, executable or some intermediate form.
  • the computer readable medium may comprise: any entity or device capable of carrying the computer readable instruction code, a recording medium, a USB flash drive, a removable hard drive, a magnetic disk, an optical disk, a computer memory, a read only memory (R OM, Read- Only Memory), Random Access Memory (RAM, Random Access Memory) ), electrical carrier signals, telecommunications signals, and software distribution media.
  • R OM Read- Only Memory
  • RAM Random Access Memory

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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)

Abstract

本申请适用于数据处理技术领域,提供了队列消息处理方法、装置、终端设备及介质。该队列消息处理方法包括:设置运行队列和等待队列;获取运行队列中的未处理消息,根据运行队列中的未处理消息计算运行队列的当前负载度;根据运行队列的当前负载度判断运行队列中的未处理消息是否超过运行队列的当前限度;在运行队列中的未处理消息未超过运行队列的当前限度时,将等待入列的队列消息存储至运行队列中;在运行队列中未处理消息超过运行队列的当前限度时,将等待入列的队列消息存储至等待队列中。本申请能够提高消息的实时性,淘汰时间较久的数据,提高消息传输的效率。

Description

队列消息处理方法、 装置、 终端设备及介质
[0001] 本申请申明享有 2017年 9月 26日递交的申请号为 201710879900.1、 名称为 "队列 消息处理方法及终端设备"中国专利申请的优先权, 该中国专利申请的整体内容 以参考的方式结合在本申请中。
技术领域
[0002] 本申请属于数据处理技术领域, 尤其涉及队列消息处理方法、 装置、 终端设备 及介质。
背景技术
[0003] 消息队列用于在消息的传输过程中保存消息, 传统的消息队列采用 "先进先出" 或"后进先出"的方式实现消息的入列和出列。 而对于大量的消息需要传输处理吋 , 传统的消息队列由于需要周期性等待査询队列的状态, 因此导致效率较低, 消息转发的实吋性较差。
技术问题
[0004] 有鉴于此, 本申请实施例提供了队列消息处理方法、 装置、 终端设备及介质, 以解决现有技术中由于需要周期性等待査询队列的状态导致效率较低、 实吋性 较差的问题。
问题的解决方案
技术解决方案
[0005] 本申请实施例的第一方面提供了一种队列消息处理方法, 包括:
[0006] 设置运行队列和等待队列, 所述运行队列基于分布式文档存储数据库的固定集 合构建, 所述等待队列基于分布式文档存储数据库的无界集合构建;
[0007] 获取运行队列中的未处理消息, 根据所述运行队列中的未处理消息计算所述运 行队列的当前负载度, 所述运行队列基于分布式文档存储数据库的固定集合构 建;
[0008] 根据所述运行队列的当前负载度判断所述运行队列中的未处理消息是否超过所 述运行队列的当前限度; [0009] 在所述运行队列中的未处理消息未超过所述运行队列的当前限度吋, 将等待入 列的队列消息存储至所述运行队列中; 其中, 将等待入列的队列消息存储至所 述运行队列中后, 所述运行队列的当前负载度增加;
[0010] 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等待入列的 队列消息存储至等待队列中; 所述等待队列基于分布式文档存储数据库的无界 集合构建。
[0011] 本申请实施例的第二方面提供了一种队列消息处理装置, 包括:
[0012] 队列设置模块, 用于设置运行队列和等待队列, 所述运行队列基于分布式文档 存储数据库的固定集合构建, 所述等待队列基于分布式文档存储数据库的无界 集合构建;
[0013] 负载度计算模块, 用于获取运行队列中的未处理消息, 根据所述运行队列中的 未处理消息计算所述运行队列的当前负载度, 所述运行队列基于分布式文档存 储数据库的固定集合构建;
[0014] 判断模块, 用于根据所述运行队列的当前负载度判断所述运行队列中的未处理 消息是否超过所述运行队列的当前限度;
[0015] 处理模块, 用于在所述运行队列中的未处理消息未超过所述运行队列的当前限 度吋, 将等待入列的队列消息存储至所述运行队列中; 其中, 将等待入列的队 列消息存储至所述运行队列中后, 所述运行队列的当前负载度增加;
[0016] 所述处理模块, 还用于在所述运行队列中未处理消息超过所述运行队列的当前 限度吋, 将等待入列的队列消息存储至等待队列中; 所述等待队列基于分布式 文档存储数据库的无界集合构建。
[0017] 本申请实施例的第三方面, 提供了一种队列消息处理终端设备, 包括存储器、 处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令, 所述处理器执行所述计算机可读指令吋实现如下步骤:
[0018] 设置运行队列和等待队列, 所述运行队列基于分布式文档存储数据库的固定集 合构建, 所述等待队列基于分布式文档存储数据库的无界集合构建;
[0019] 获取运行队列中的未处理消息, 根据所述运行队列中的未处理消息计算所述运 行队列的当前负载度, 所述运行队列基于分布式文档存储数据库的固定集合构 建;
[0020] 根据所述运行队列的当前负载度判断所述运行队列中的未处理消息是否超过所 述运行队列的当前限度;
[0021] 在所述运行队列中的未处理消息未超过所述运行队列的当前限度吋, 将等待入 列的队列消息存储至所述运行队列中; 其中, 将等待入列的队列消息存储至所 述运行队列中后, 所述运行队列的当前负载度增加;
[0022] 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等待入列的 队列消息存储至等待队列中; 所述等待队列基于分布式文档存储数据库的无界 集合构建。
[0023] 本申请实施例的第四方面, 提供了一种计算机可读存储介质, 所述计算机可读 存储介质存储有计算机可读指令, 所述计算机可读指令被至少一个处理器执行 吋实现如下步骤:
[0024] 设置运行队列和等待队列, 所述运行队列基于分布式文档存储数据库的固定集 合构建, 所述等待队列基于分布式文档存储数据库的无界集合构建;
[0025] 获取运行队列中的未处理消息, 根据所述运行队列中的未处理消息计算所述运 行队列的当前负载度, 所述运行队列基于分布式文档存储数据库的固定集合构 建;
[0026] 根据所述运行队列的当前负载度判断所述运行队列中的未处理消息是否超过所 述运行队列的当前限度;
[0027] 在所述运行队列中的未处理消息未超过所述运行队列的当前限度吋, 将等待入 列的队列消息存储至所述运行队列中; 其中, 将等待入列的队列消息存储至所 述运行队列中后, 所述运行队列的当前负载度增加;
[0028] 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等待入列的 队列消息存储至等待队列中; 所述等待队列基于分布式文档存储数据库的无界 集合构建。
发明的有益效果
有益效果
[0029] 本申请实施例, 获取运行队列中的未处理消息, 根据所述运行队列中的未处理 消息计算所述运行队列的当前负载度, 在所述运行队列中的未处理消息未超过 所述运行队列的当前限度吋, 将等待入列的队列消息存储至所述运行队列中, 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等待入列的 队列消息存储至等待队列中, 通过设置运行队列和等待队列引入 "生产者-消费者 "模型, 当队列消息无法入列吋, 先暂存至等待队列, 而运行队列基于分布式文 档存储数据库的固定集合构建, 能够实现高效的査询、 更新, 从而能够提高消 息的实吋性, 淘汰吋间最久的数据, 提高消息传输的效率。
对附图的简要说明
附图说明
[0030] 为了更清楚地说明本申请实施例中的技术方案, 下面将对实施例或现有技术描 述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是 本申请的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动性 的前提下, 还可以根据这些附图获得其他的附图。
[0031] 图 1是本申请实施例提供的队列消息处理方法的实现流程图;
[0032] 图 2是本申请实施例提供的运行队列的结构示意图;
[0033] 图 3是图 1中步骤 S103的实现流程图;
[0034] 图 4是本申请实施例提供的队列消息处理程序的运行环境示意图;
[0035] 图 5是本申请实施例提供的队列消息处理程序的程序模块图。
本发明的实施方式
[0036] 下面将结合本申请实施例中的附图, 对本申请实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本申请一部分实施例, 而不是全部的实 施例。 基于本申请中的实施例, 本领域普通技术人员在没有做出创造性劳动前 提下所获得的所有其他实施例, 都属于本申请保护的范围。
[0037] 为了说明本申请所述的技术方案, 下面通过具体实施例来进行说明。
[0038] 实施例一
[0039] 图 1示出了本申请实施例一提供的队列消息处理方法的实现流程, 详述如下: [0040] 步骤 S101, 设置运行队列和等待队列, 所述运行队列基于分布式文档存储数据 库的固定集合构建, 所述等待队列基于分布式文档存储数据库的无界集合构建
[0041] 本实施例中, 通过 MONGODB (分布式文档存储数据库) 的固定集合构建运行 队列。 如图 2所示, 所述运行队列为环形队列, 当环形队列的空间用完后, 再插 入的队列消息就会覆盖最初始的队列消息。 图 2中, 所述运行队列的第一个队列 消息对应的数值为 5, 第二个队列消息对应的数值为 -3, 第三个队列消息对应的 数值为 17, 第四个队列消息对应的数值为 -9, 第 N个队列消息对应的数值为 56, N为正整数。 另外, 对等待队列的结构不做限制。
[0042] 其中, 设置运行队列和等待队列两种队列能够方便对后续信息的处理, 具体参 照后续步骤的相关内容。
[0043] 步骤 S102, 获取运行队列中的未处理消息, 根据所述运行队列中的未处理消息 计算所述运行队列的当前负载度。
[0044] 作为一种可实施方式, 步骤 S102中的所述根据所述运行队列中的未处理消息计 算所述运行队列的当前负载度具体可以为: 根据预设负载和所述未处理消息占 用的负载, 计算所述运行队列的当前负载度。
[0045] 具体的, 在队列系统启动阶段, 会预先对运行队列的预设负载进行设置, 对运 行队列的当前负载度进行计算。 系统启动阶段或运行阶段预先增加或减少负载 度, 一方面可用于分布式文档存储数据库的 MQ服务启动后的可用性验证, 另一 方面也可防止不可预知的特殊原因导致的负载度计算异常, 因此增加或减少负 载度可让系统进行适度的自我微调。
[0046] 可以理解的, 在消息入队吋, 运行队列的当前负载度会相应的增加, 例如, 在 原值的基础上加 1 ; 在消息出队吋, 运行队列的当前负载度将相应的降低, 例如 , 在原值的基础上减 1。 在运行队列的当前负载度小于或等于零吋, 将不会向分 布式文档存储数据库提交査询请求, 以节约资源。
[0047] 在步骤 S102之前, 还可以包括: 启动分布式文档存储数据库的 MQ服务, 包括 参数加载、 参数刷新和任务重调, 其中具体的参数可以包括: 队列消息长度上 限、 队列消息容量、 消息出队任务线程数、 出队任务首次延迟、 出队任务执行 周期、 悲观出队持续吋间、 负载度比例阈值、 入队吋间上限、 出队吋间上限、 是否幵启监控等。
[0048] 本实施例中, 参数信息可以存储于关系型数据库 ORACLE中, 每隔固定吋间, 根据表中记录的更新吋间和更新人字段来计算当前配置信息记录的版本, 一旦 发现版本发生变化, 将会重载参数以保证参数得到线程安全的刷新。
[0049] 步骤 S103, 根据所述运行队列的当前负载度判断所述运行队列中的未处理消息 是否超过所述运行队列的当前限度。
[0050] 可以理解的, 由于基于分布式文档存储数据库的固定集合构建运行队列, 先入 列的消息可能会被覆盖, 所以为了防止后入列的消息覆盖未被处理的消息, 所 以在入列前需要判断所述运行队列中是否存在过多的消息未被处理。
[0051] 参见图 3, 步骤 S103可以通过以下过程实现:
[0052] 步骤 S301, 计算 (A/B)*C, 其中 A为所述运行队列可容纳的消息容量, B为预设 的平均消息大小, C为预设的负载度比例阀值。
[0053] 其中, 所述平均消息大小根据 mongo的集合的统计信息得出, 而在无数据的情 况下, 所述平均消息大小等于队列消息长度上限。 所述预设的负载度比例阀值 具体可以根据实际情况或经验或实验数据进行设置, 对此不做限定。
[0054] 步骤 S302, 判定 (A/B)*C是否大于所述运行队列的当前负载度。
[0055] 具体的, 若 (A/B)*C是否大于所述运行队列的当前负载度, 则执行步骤 S303; 若 (A/B)*C是否大于所述运行队列的当前负载度, 则执行步骤 S304。
[0056] 步骤 S304, 判定所述运行队列中的未处理消息超过所述运行队列的当前限度。
[0057] 其中, 超过所述运行队列的当前限度表示所述运行队列中的未处理消息过多, 超出了所述运行队列的可承受限度。
[0058] 步骤 S305, 判定所述运行队列中的未处理消息未超过所述运行队列的当前限度
[0059] 其中, 未超过所述运行队列的当前限度表示所述运行队列中的未处理消息还未 达到限度, 等待入列的队列消息还可继续存储至所述运行队列中。
[0060] 步骤 S104, 在所述运行队列中的未处理消息未超过所述运行队列的当前限度吋 , 将等待入列的队列消息存储至所述运行队列中。
[0061] 其中, 将等待入列的队列消息存储至所述运行队列中后, 所述运行队列的当前 负载度增加。 具体的, 可以增加预设数值, 例如 1 ; 也可以根据入列的队列消息 增加对应的数值, 例如与队列消息的大小、 长度等相关的数值。
[0062] 步骤 S105, 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将 等待入列的队列消息存储至等待队列中。
[0063] 其中, 通过设置运行队列和等待队列引入 "生产者-消费者"模型, 当队列消息无 法入列吋, 先将队列消息暂存至等待队列, 然后可以在运行队列的负载度较低 吋, 优先将暂存在等待队列中的队列消息入列。
[0064] 可选的, 上述队列消息处理方法还可以包括:
[0065] 在所述运行队列中未处理消息未超过所述运行队列的当前限度且所述等待队列 中存在队列消息吋, 将所述等待队列中的队列消息存储至所述运行队列中。
[0066] 具体的, 在所述运行队列中未处理消息未超过所述运行队列的当前限度且所述 等待队列中存在队列消息吋, 由于所述等待队列中的队列消息相对等待吋间较 长, 因此可以优先将在所述等待队列中存储的队列信息入列, 存储至所述运行 队列中进行调用等操作。
[0067] 可选的, 上述队列消息处理方法还可以包括:
[0068] 监测所述队列消息在所述运行队列中的吋间、 所述队列消息的入队耗吋信息、 所述队列消息的出队耗吋信息和所述队列消息的大小, 并生成日志文件进行存 储。
[0069] 其中, 所述日志文件中包括场景 /事件 ID、 业务关联的 MQ流水号、 主机名、 幵 始吋间、 结束吋间、 当前吋间以及当前负载度等信息中的一种信息或多种信息 , 因此根据该日志文件能够及吋根据日志文件推断出发生问题的业务场景及评 估该问题对目前系统业务功能的影响范围。
[0070] 对于队列消息大小的监测, 主要为防止个别队列消息数据量巨大, 造成出入队 缓慢。 可以预设队列消息的大小上限, 对于超出上限的队列消息将拒绝处理, 以保障系统的稳定性。 对于队列消息在所述运行队列中的吋间的监测, 能够及 吋发现位于运行队列中且长期未处理的队列消息, 从而对该队列消息进行相应 的处理。
[0071] 另外, 采用分布式文档存储数据库的 save和 findAndModify操作实现队列消息的 入列和出列。 为了提升系统性能, 分布式文档存储数据库的 save和 findAndModif y还可实现批量入队和出队。
[0072] 以下对队列消息的入列过程进行进一步的说明。
[0073] 接收队列消息的入列请求。
[0074] 根据预设负载和运行队列中未处理消息占用的负载, 计算运行队列的当前负载 度。
[0075] 根据运行队列的当前负载度判断运行队列中的未处理消息是否超过运行队列的 当前限度。
[0076] 在运行队列中的未处理消息未超过运行队列的当前限度吋, 对该等待入列的队 列消息执行入列操作, 存储至运行队列中。 将等待入列的队列消息存储至运行 队列中后, 运行队列的当前负载度增加 1。
[0077] 在运行队列中未处理消息超过运行队列的当前限度吋, 将等待入列的队列消息 存储至等待队列中。
[0078] 监测队列消息的入队耗吋信息和队列消息的大小, 并生成日志文件进行存储。
[0079] 另外, 在运行队列中的未处理消息未超过运行队列的当前限度, 且等待队列中 存在队列消息吋, 对等待队列中的队列消息执行入列操作, 存储至运行队列中
。 也可以定吋批量将等待队列中的队列消息尝试放入运行队列中。
[0080] 另外, 在运行队列的当前负载度大于零吋, 位于运行队列中的队列即可以出列
。 同吋, 监测队列消息的出队耗吋信息和队列消息在运行队列中的吋间, 并生 成日志文件进行存储。
[0081] 上述队列消息处理方法, 获取运行队列中的未处理消息, 根据所述运行队列中 的未处理消息计算所述运行队列的当前负载度, 在所述运行队列中的未处理消 息未超过所述运行队列的当前限度吋, 将等待入列的队列消息存储至所述运行 队列中, 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等 待入列的队列消息存储至等待队列中, 通过设置运行队列和等待队列引入 "生产 者-消费者"模型, 当队列消息无法入列吋, 先暂存至等待队列, 而运行队列基于 分布式文档存储数据库的固定集合构建, 能够实现高效的査询、 更新, 从而能 够提高消息的实吋性, 淘汰吋间最久的数据, 提高消息传输的效率。 [0082] 应理解, 上述实施例中各步骤的序号的大小并不意味着执行顺序的先后, 各过 程的执行顺序应以其功能和内在逻辑确定, 而不应对本申请实施例的实施过程 构成任何限定。
[0083] 实施例二
[0084] 对应于上文实施例一所述的队列消息处理方法, 图 4示出了本申请实施例提供 的队列消息处理程序的运行环境示意图。 为了便于说明, 仅示出了与本实施例 相关的部分。
[0085] 在本实施例中, 所述的队列消息处理程序 400安装并运行于终端设备 40中。 该 终端设备 40可以是移动终端、 掌上电脑、 服务器等。 该终端设备 40可包括, 但 不仅限于, 存储器 401和处理器 402。 图 4仅示出了具有组件 401-402的终端设备 40
, 但是应理解的是, 并不要求实施所有示出的组件, 可以替代的实施更多或者 更少的组件。
[0086] 所述存储器 401在一些实施例中可以是所述终端设备 40的内部存储单元, 例如 该终端设备 40的硬盘或内存。 所述存储器 401在另一些实施例中也可以是所述终 端设备 40的外部存储设备, 例如所述终端设备 40上配备的插接式硬盘, 智能存 储卡 (Smart Media Card, SMC) , 安全数字 (Secure Digital, SD) 卡, 闪存卡 (Flash Card) 等。 进一步地, 所述存储器 401还可以既包括所述终端设备 40的内 部存储单元也包括外部存储设备。 所述存储器 401用于存储安装于所述终端设备 40的应用软件及各类数据, 例如所述队列消息处理程序 400的程序代码等。 所述 存储器 401还可以用于暂吋地存储已经输出或者将要输出的数据。
[0087] 所述处理器 402在一些实施例中可以是一中央处理器 (Central Processing
Unit, CPU) , 微处理器或其他数据处理芯片, 用于运行所述存储器 401中存储 的程序代码或处理数据, 例如执行所述队列消息处理程序 400等。
[0088] 可选的, 终端设备 40还可以包括显示器。 所述显示器在一些实施例中可以是 LE D显示器、 液晶显示器、 触控式液晶显示器以及 OLED (Organic Light-Emitting Diode, 有机发光二极管) 触摸器等。 所述显示器用于显示在所述终端设备 40中 处理的信息以及用于显示可视化的用户界面, 例如应用菜单界面、 应用图标界 面等。 所述终端设备 40的部件 401-402通过系统总线相互通信。 [0089] 请参阅图 5, 是本申请实施例提供的队列消息处理程序 400的程序模块图。 在本 实施例中, 所述的队列消息处理程序 400可以被分割成一个或多个模块, 所述一 个或者多个模块被存储于所述存储器 401中, 并由一个或多个处理器 (本实施例 为所述处理器 402) 所执行, 以完成本申请。 例如, 在图 5中, 所述的队列消息 处理程序 400可以被分割成队列设置模块 501、 负载度计算模块 502、 判断模块 50 3和处理模块 504。 本申请所称的模块是指能够完成特定功能的一系列计算机可 读指令段, 比程序更适合于描述所述队列消息处理程序 400在所述终端设备 40中 的执行过程。 以下描述将具体介绍所述模块 501-504的功能。
[0090] 其中, 队列设置模块 501, 用于设置运行队列和等待队列, 所述运行队列基于 分布式文档存储数据库的固定集合构建, 所述等待队列基于分布式文档存储数 据库的无界集合构建。
[0091] 负载度计算模块 502, 用于获取运行队列中的未处理消息, 根据所述运行队列 中的未处理消息计算所述运行队列的当前负载度, 所述运行队列基于分布式文 档存储数据库的固定集合构建。
[0092] 判断模块 503, 用于根据所述运行队列的当前负载度判断所述运行队列中的未 处理消息是否超过所述运行队列的当前限度。
[0093] 处理模块 504, 用于在所述运行队列中的未处理消息未超过所述运行队列的当 前限度吋, 将等待入列的队列消息存储至所述运行队列中; 其中, 将等待入列 的队列消息存储至所述运行队列中后, 所述运行队列的当前负载度增加。
[0094] 处理模块 504, 还用于在所述运行队列中未处理消息超过所述运行队列的当前 限度吋, 将等待入列的队列消息存储至等待队列中; 所述等待队列基于分布式 文档存储数据库的无界集合构建。
[0095] 可选的, 负载度计算模块 502具体用于: 根据预设负载和所述未处理消息占用 的负载, 计算所述运行队列的当前负载度。
[0096] 可选的, 判断模块 503具体用于:
[0097] 计算 (A/B)*C, 其中 A为所述运行队列可容纳的消息容量, B为预设的平均消息 大小, C为预设的负载度比例阀值;
[0098] 在 (A/B)*C大于所述运行队列的当前负载度吋, 判定所述运行队列中的未处理 消息超过所述运行队列的当前限度;
[0099] 在 (A/B)*C小于等于所述运行队列的当前负载度吋, 判定所述运行队列中的未 处理消息未超过所述运行队列的当前限度。
[0100] 可选的, 所述队列信息处理程序 400还可以被分割为监测模块。 所述监测模块
, 用于监测所述队列消息在所述运行队列中的吋间、 所述队列消息的入队耗吋 信息、 所述队列消息的出队耗吋信息和所述队列消息的大小, 并生成日志文件 进行存储。
[0101] 可选的, 处理模块 504, 还用于在所述运行队列中未处理消息未超过所述运行 队列的当前限度且所述等待队列中存在队列消息吋, 将所述等待队列中的队列 消息存储至所述运行队列中。
[0102] 所述作为分离部件说明的单元可以是或者也可以不是物理上分幵的, 作为单元 显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可 以分布到多个网络单元上。 可以根据实际的需要选择其中的部分或者全部单元 来实现本实施例方案的目的。
[0103] 另外, 在本申请各个实施例中的各功能单元可以集成在一个处理单元中, 也可 以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一个单元中。 上述集成的单元既可以采用硬件的形式实现, 也可以采用软件功能单元的形式 实现。
[0104] 所述集成的模块 /单元如果以软件功能单元的形式实现并作为独立的产品销售 或使用吋, 可以存储在一个计算机可读取存储介质中。 基于这样的理解, 本申 请实现上述实施例方法中的全部或部分流程, 也可以通过计算机可读指令来指 令相关的硬件来完成, 所述的计算机可读指令可存储于一计算机可读存储介质 中, 该计算机可读指令在被处理器执行吋, 可实现上述各个方法实施例的步骤 。 其中, 所述计算机可读指令包括计算机可读指令代码, 所述计算机可读指令 代码可以为源代码形式、 对象代码形式、 可执行文件或某些中间形式等。 所述 计算机可读介质可以包括: 能够携带所述计算机可读指令代码的任何实体或装 置、 记录介质、 U盘、 移动硬盘、 磁碟、 光盘、 计算机存储器、 只读存储器 (R OM, Read-Only Memory) 、 随机存取存储器 (RAM, Random Access Memory ) 、 电载波信号、 电信信号以及软件分发介质等。 需要说明的是, 所述计算机 可读介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的 增减, 例如在某些司法管辖区, 根据立法和专利实践, 计算机可读介质不包括 电载波信号和电信信号。
以上所述实施例仅用以说明本申请的技术方案, 而非对其限制; 尽管参照前述 实施例对本申请进行了详细的说明, 本领域的普通技术人员应当理解: 其依然 可以对前述各实施例所记载的技术方案进行修改, 或者对其中部分技术特征进 行等同替换; 而这些修改或者替换, 并不使相应技术方案的本质脱离本申请各 实施例技术方案的精神和范围, 均应包含在本申请的保护范围之内。

Claims

权利要求书
[权利要求 1] 一种队列消息处理方法, 其特征在于, 包括:
设置运行队列和等待队列, 所述运行队列基于分布式文档存储数据库 的固定集合构建, 所述等待队列基于分布式文档存储数据库的无界集 合构建;
获取运行队列中的未处理消息, 根据所述运行队列中的未处理消息计 算所述运行队列的当前负载度;
根据所述运行队列的当前负载度判断所述运行队列中的未处理消息是 否超过所述运行队列的当前限度;
在所述运行队列中的未处理消息未超过所述运行队列的当前限度吋, 将等待入列的队列消息存储至所述运行队列中; 其中, 将等待入列的 队列消息存储至所述运行队列中后, 所述运行队列的当前负载度增加 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等 待入列的队列消息存储至等待队列中。
[权利要求 2] 如权利要求 1所述的队列消息处理方法, 其特征在于, 所述根据所述 运行队列中的未处理消息计算运行队列的当前负载度为:
根据预设负载和所述未处理消息占用的负载, 计算所述运行队列的当 前负载度。
[权利要求 3] 如权利要求 1所述的队列消息处理方法, 其特征在于, 所述根据所述 队列的当前负载度判断所述运行队列中的未处理消息是否超过所述运 行队列的当前限度为:
计算所述运行队列的当前限度: (A/B)*C, 其中 A为所述运行队列可 容纳的消息容量, B为预设的平均消息大小, C为预设的负载度比例 阀值;
在 (A/B)*C大于所述运行队列的当前负载度吋, 判定所述运行队列中 的未处理消息超过所述运行队列的当前限度;
在 (A/B)*C小于等于所述运行队列的当前负载度吋, 判定所述运行队 列中的未处理消息未超过所述运行队列的当前限度。
[权利要求 4] 如权利要求 1所述的队列消息处理方法, 其特征在于, 还包括:
在所述运行队列中未处理消息未超过所述运行队列的当前限度且所述 等待队列中存在队列消息吋, 将所述等待队列中的队列消息存储至所 述运行队列中。
[权利要求 5] 如权利要求 1所述的队列消息处理方法, 其特征在于, 还包括:
监测所述队列消息在所述运行队列中的吋间、 所述队列消息的入队耗 吋信息、 所述队列消息的出队耗吋信息和所述队列消息的大小, 并生 成日志文件进行存储。
[权利要求 6] —种队列消息处理装置, 其特征在于, 包括:
队列设置模块, 用于设置运行队列和等待队列, 所述运行队列基于分 布式文档存储数据库的固定集合构建, 所述等待队列基于分布式文档 存储数据库的无界集合构建。
负载度计算模块, 用于获取运行队列中的未处理消息, 根据所述运行 队列中的未处理消息计算所述运行队列的当前负载度, 所述运行队列 基于分布式文档存储数据库的固定集合构建。
判断模块, 用于根据所述运行队列的当前负载度判断所述运行队列中 的未处理消息是否超过所述运行队列的当前限度。
处理模块, 用于在所述运行队列中的未处理消息未超过所述运行队列 的当前限度吋, 将等待入列的队列消息存储至所述运行队列中; 其中 , 将等待入列的队列消息存储至所述运行队列中后, 所述运行队列的 当前负载度增加。
处理模块, 还用于在所述运行队列中未处理消息超过所述运行队列的 当前限度吋, 将等待入列的队列消息存储至等待队列中; 所述等待队 列基于分布式文档存储数据库的无界集合构建。
[权利要求 7] 根据权利要求 6所述的队列消息处理装置, 其特征在于, 所述负载度 计算模块用于:
根据预设负载和所述未处理消息占用的负载, 计算所述运行队列的当 前负载度。
[权利要求 8] 根据权利要求 6所述的队列消息处理装置, 其特征在于, 所述判断模 块用于:
计算所述运行队列的当前限度: (A/B)*C, 其中 A为所述运行队列可 容纳的消息容量, B为预设的平均消息大小, C为预设的负载度比例 阀值;
在 (A/B)*C大于所述运行队列的当前负载度吋, 判定所述运行队列中 的未处理消息超过所述运行队列的当前限度;
在 (A/B)*C小于等于所述运行队列的当前负载度吋, 判定所述运行队 列中的未处理消息未超过所述运行队列的当前限度。
[权利要求 9] 根据权利要求 6所述的队列消息处理装置, 其特征在于, 还包括: 监测模块, 用于监测所述队列消息在所述运行队列中的吋间、 所述队 歹 息的入队耗吋信息、 所述队列消息的出队耗吋信息和所述队列消 息的大小, 并生成日志文件进行存储。
[权利要求 10] 根据权利要求 6所述的队列消息处理装置, 其特征在于, 所述处理模 块还用于:
在所述运行队列中未处理消息未超过所述运行队列的当前限度且所述 等待队列中存在队列消息吋, 将所述等待队列中的队列消息存储至所 述运行队列中。
[权利要求 11] 一种队列消息处理终端设备, 其特征在于, 包括存储器、 处理器, 所 述存储器上存储有可在所述处理器上运行的计算机可读指令, 所述处 理器执行所述计算机序吋实现如下步骤:
设置运行队列和等待队列, 所述运行队列基于分布式文档存储数据库 的固定集合构建, 所述等待队列基于分布式文档存储数据库的无界集 合构建;
获取运行队列中的未处理消息, 根据所述运行队列中的未处理消息计 算所述运行队列的当前负载度;
根据所述运行队列的当前负载度判断所述运行队列中的未处理消息是 否超过所述运行队列的当前限度;
在所述运行队列中的未处理消息未超过所述运行队列的当前限度吋, 将等待入列的队列消息存储至所述运行队列中; 其中, 将等待入列的 队列消息存储至所述运行队列中后, 所述运行队列的当前负载度增加 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等 待入列的队列消息存储至等待队列中。
根据权利要求 11所述的队列消息处理终端设备, 其特征在于, 所述根 据所述运行队列中的未处理消息计算运行队列的当前负载度为: 根据预设负载和所述未处理消息占用的负载, 计算所述运行队列的当 前负载度。
根据权利要求 11所述的队列消息处理终端设备, 其特征在于, 所述根 据所述队列的当前负载度判断所述运行队列中的未处理消息是否超过 所述运行队列的当前限度为:
计算所述运行队列的当前限度: (A/B)*C, 其中 A为所述运行队列可 容纳的消息容量, B为预设的平均消息大小, C为预设的负载度比例 阀值;
在 (A/B)*C大于所述运行队列的当前负载度吋, 判定所述运行队列中 的未处理消息超过所述运行队列的当前限度;
在 (A/B)*C小于等于所述运行队列的当前负载度吋, 判定所述运行队 列中的未处理消息未超过所述运行队列的当前限度。
根据权利要求 11所述的队列消息处理终端设备, 其特征在于, 所述处 理器执行所述计算机可读指令吋, 还实现如下步骤:
在所述运行队列中未处理消息未超过所述运行队列的当前限度且所述 等待队列中存在队列消息吋, 将所述等待队列中的队列消息存储至所 述运行队列中。
根据权利要求 11所述的队列消息处理终端设备, 其特征在于, 所述处 理器执行所述计算机可读指令吋, 还实现如下步骤: 监测所述队列消息在所述运行队列中的吋间、 所述队列消息的入队耗 吋信息、 所述队列消息的出队耗吋信息和所述队列消息的大小, 并生 成日志文件进行存储。
[权利要求 16] —种计算机可读存储介质, 所述计算机可读存储介质存储有计算机可 读指令, 其特征在于, 所述计算机可读指令被至少一个处理器执行吋 实现如下步骤:
设置运行队列和等待队列, 所述运行队列基于分布式文档存储数据库 的固定集合构建, 所述等待队列基于分布式文档存储数据库的无界集 合构建;
获取运行队列中的未处理消息, 根据所述运行队列中的未处理消息计 算所述运行队列的当前负载度;
根据所述运行队列的当前负载度判断所述运行队列中的未处理消息是 否超过所述运行队列的当前限度;
在所述运行队列中的未处理消息未超过所述运行队列的当前限度吋, 将等待入列的队列消息存储至所述运行队列中; 其中, 将等待入列的 队列消息存储至所述运行队列中后, 所述运行队列的当前负载度增加 在所述运行队列中未处理消息超过所述运行队列的当前限度吋, 将等 待入列的队列消息存储至等待队列中。
[权利要求 17] 根据权利要求 16所述的计算机可读存储介质, 其特征在于, 所述根据 所述运行队列中的未处理消息计算运行队列的当前负载度为: 根据预设负载和所述未处理消息占用的负载, 计算所述运行队列的当 前负载度。
[权利要求 18] 根据权利要求 16所述的计算机可读存储介质, 其特征在于, 所述根据 所述队列的当前负载度判断所述运行队列中的未处理消息是否超过所 述运行队列的当前限度为:
计算所述运行队列的当前限度: (A/B)*C, 其中 A为所述运行队列可 容纳的消息容量, B为预设的平均消息大小, C为预设的负载度比例 阀值;
在 (A/B)*C大于所述运行队列的当前负载度吋, 判定所述运行队列中 的未处理消息超过所述运行队列的当前限度;
在 (A/B)*C小于等于所述运行队列的当前负载度吋, 判定所述运行队 列中的未处理消息未超过所述运行队列的当前限度。
[权利要求 19] 根据权利要求 16所述的计算机可读存储介质, 其特征在于, 所述计算 机可读指令被至少一个处理器执行吋, 还实现如下步骤:
在所述运行队列中未处理消息未超过所述运行队列的当前限度且所述 等待队列中存在队列消息吋, 将所述等待队列中的队列消息存储至所 述运行队列中。
[权利要求 20] 根据权利要求 16所述的计算机可读存储介质, 其特征在于, 所述计算 机可读指令被至少一个处理器执行吋, 还实现如下步骤:
监测所述队列消息在所述运行队列中的吋间、 所述队列消息的入队耗 吋信息、 所述队列消息的出队耗吋信息和所述队列消息的大小, 并生 成日志文件进行存储。
PCT/CN2017/108623 2017-09-26 2017-10-31 队列消息处理方法、装置、终端设备及介质 WO2019061647A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710879900.1 2017-09-26
CN201710879900.1A CN107766160B (zh) 2017-09-26 2017-09-26 队列消息处理方法及终端设备

Publications (1)

Publication Number Publication Date
WO2019061647A1 true WO2019061647A1 (zh) 2019-04-04

Family

ID=61266568

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/108623 WO2019061647A1 (zh) 2017-09-26 2017-10-31 队列消息处理方法、装置、终端设备及介质

Country Status (2)

Country Link
CN (1) CN107766160B (zh)
WO (1) WO2019061647A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190745A (zh) * 2019-11-05 2020-05-22 腾讯科技(深圳)有限公司 一种数据处理方法、装置及计算机可读存储介质
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
CN109213583B (zh) * 2018-07-25 2022-03-29 中国科学院计算技术研究所 一种通过软硬件协同支持读写性能隔离的i/o调度器
CN111385218B (zh) * 2018-12-28 2023-08-15 广州市百果园信息技术有限公司 消息队列过载的丢包、流量控制方法、存储介质及设备
CN110149392A (zh) * 2019-05-17 2019-08-20 优信拍(北京)信息科技有限公司 一种推送消息的管理方法及装置
CN110333956A (zh) * 2019-05-23 2019-10-15 平安普惠企业管理有限公司 消息队列中消息存储方法、装置、介质及电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130290513A1 (en) * 2012-04-27 2013-10-31 Xerox Business Services, Llc Intelligent Work Load Manager
CN103414761A (zh) * 2013-07-23 2013-11-27 北京工业大学 一种基于Hadoop架构的移动终端云资源调度方法
CN104102693A (zh) * 2014-06-19 2014-10-15 广州华多网络科技有限公司 对象处理方法和装置
US20160299784A1 (en) * 2012-09-14 2016-10-13 International Business Machines Corporation Preferential cpu utilization for tasks

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100336027C (zh) * 2004-04-13 2007-09-05 英业达股份有限公司 多种互斥条件下的多模式测试系统及其方法
CN103226467B (zh) * 2013-05-23 2015-09-30 中国人民解放军国防科学技术大学 数据并行处理方法、系统及负载均衡调度器

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130290513A1 (en) * 2012-04-27 2013-10-31 Xerox Business Services, Llc Intelligent Work Load Manager
US20160299784A1 (en) * 2012-09-14 2016-10-13 International Business Machines Corporation Preferential cpu utilization for tasks
CN103414761A (zh) * 2013-07-23 2013-11-27 北京工业大学 一种基于Hadoop架构的移动终端云资源调度方法
CN104102693A (zh) * 2014-06-19 2014-10-15 广州华多网络科技有限公司 对象处理方法和装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111190745A (zh) * 2019-11-05 2020-05-22 腾讯科技(深圳)有限公司 一种数据处理方法、装置及计算机可读存储介质
CN111190745B (zh) * 2019-11-05 2024-01-30 腾讯科技(深圳)有限公司 一种数据处理方法、装置及计算机可读存储介质
CN113778321A (zh) * 2021-01-15 2021-12-10 北京沃东天骏信息技术有限公司 消息处理的方法和装置

Also Published As

Publication number Publication date
CN107766160A (zh) 2018-03-06
CN107766160B (zh) 2019-12-13

Similar Documents

Publication Publication Date Title
WO2019061647A1 (zh) 队列消息处理方法、装置、终端设备及介质
CN108762931A (zh) 基于分布式调度系统的任务调度方法、服务器及存储介质
US9092482B2 (en) Fair scheduling for mixed-query loads
EP2506147B1 (en) Epoll optimisations
WO2020140614A1 (zh) 离线消息分发方法、服务器及存储介质
CN107241281B (zh) 一种数据处理方法及其装置
CN110545260A (zh) 一种基于拟态构造的云管理平台构建方法
WO2019179026A1 (zh) 电子装置、集群访问域名自动生成方法及存储介质
US9378047B1 (en) Efficient communication of interrupts from kernel space to user space using event queues
EP2983089B1 (en) Method, device, and chip for implementing mutually exclusive operation of multiple threads
CN109343972B (zh) 任务处理方法及终端设备
WO2021104178A1 (zh) 一种动态消息推送方法、系统和汽车诊断服务器
US20140365429A1 (en) Method for issuing multipart receipts in connection to extensive database operations
CN109842621A (zh) 一种减少token存储数量的方法及终端
CN111158939A (zh) 数据处理方法、装置、存储介质及电子设备
CN112925792B (zh) 数据存储控制方法、装置、计算设备及介质
CN109426563B (zh) 一种进程管理方法及装置
CN115981893A (zh) 消息队列任务处理方法、装置、服务器及存储介质
JP6847112B2 (ja) ノードの再起動後にデータを処理する方法及びデバイス
CN112748883B (zh) 一种io请求流水线处理设备、方法、系统及存储介质
CN111611123B (zh) 数据处理方法、数据处理系统及设备
EP3387529A1 (en) Method and apparatus for time-based scheduling of tasks
CN111432357A (zh) 信息处理方法、系统及计算设备
JP6226666B2 (ja) バッチ処理制御プログラム、バッチ処理システム
CN116932248A (zh) 一种基于线程和协程的事件处理方法、装置和终端设备

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: 17927027

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 25.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17927027

Country of ref document: EP

Kind code of ref document: A1