CN106886457B - Message queue processing method and device - Google Patents

Message queue processing method and device Download PDF

Info

Publication number
CN106886457B
CN106886457B CN201510945045.0A CN201510945045A CN106886457B CN 106886457 B CN106886457 B CN 106886457B CN 201510945045 A CN201510945045 A CN 201510945045A CN 106886457 B CN106886457 B CN 106886457B
Authority
CN
China
Prior art keywords
message queue
depth
processing
job
message
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
Application number
CN201510945045.0A
Other languages
Chinese (zh)
Other versions
CN106886457A (en
Inventor
刘世强
汤晋军
张霄栋
鲁丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Taikang Insurance Group Co Ltd
Original Assignee
Taikang Insurance Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taikang Insurance Group Co Ltd filed Critical Taikang Insurance Group Co Ltd
Priority to CN201510945045.0A priority Critical patent/CN106886457B/en
Publication of CN106886457A publication Critical patent/CN106886457A/en
Application granted granted Critical
Publication of CN106886457B publication Critical patent/CN106886457B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Digital Computer Display Output (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a message queue processing method and device. The message queue processing method comprises the following steps: starting monitoring processing jobs, and detecting the message queue depth of a message queue, the states and the number of all the current running processing jobs of the message queue and the utilization rate of a current CPU (central processing unit); and determining whether to start a new temporary operation processing job according to the message queue depth, the states and the number of all the current operation processing jobs and the utilization rate of the current CPU. The message queue processing method can judge whether a new temporary operation processing job is started or not, thereby avoiding the problems of wasting system resources and reducing the efficiency of long-running processing jobs caused by starting a large number of temporary operation processing jobs, improving the processing efficiency of the message queue on one hand and saving the system resources on the other hand.

Description

Message queue processing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a message queue processing method and device.
Background
Message Queue (MQ) technology is a technology applied to exchange information between distributed applications. Message queues provide a loosely coupled approach for constructing distributed applications that are implemented in a synchronous or asynchronous manner. An Application Program Interface (API) for the message queue is provided to the new or existing Application. The information exchange function between the application programs is provided through the sending of the message. Additionally, the message queue may be applied to perform other various functions, such as demand servicing or asynchronous processing, among others.
When the server processes the message queue, it usually opens a long running processing job for processing, and when detecting that a message to be processed appears in the message queue, the server processes the message. When a large number of messages enter the message queue at the same time, the messages in the message queue can be processed one by one through the long-running processing job. However, such a processing method causes accumulation of messages, and reduces processing efficiency. Alternatively, one or more temporarily running processing job programs may be started to process the messages in the message queue in parallel. However, the temporary running processing job itself also occupies CPU resources and consumes memory, and when a large number of temporary running processing jobs are started at the same time, the efficiency is further reduced, which affects the efficiency of the long running processing job.
Disclosure of Invention
In view of this, the present invention provides a method and an apparatus for processing a message queue, which can improve the processing efficiency of the message queue and avoid a large occupation of system resources.
Additional features and advantages of the invention will be set forth in the detailed description which follows, or may be learned by practice of the invention.
According to an aspect of the present invention, there is provided a message queue processing method, including: starting monitoring processing jobs, and detecting the message queue depth of a message queue, the states and the number of all the current running processing jobs of the message queue and the utilization rate of a current CPU (central processing unit); and determining whether to start a new temporary operation processing job according to the message queue depth, the states and the number of all the current operation processing jobs and the utilization rate of the current CPU.
According to an embodiment of the present invention, the determining whether to start the new temporary run processing job according to the message queue depth, the states and the number of all the currently run processing jobs, and the utilization of the current CPU includes: judging whether the depth of the message queue exceeds a preset new operation starting threshold value or not; if the depth of the message queue exceeds the new job starting threshold, judging whether the number of all the current running processing jobs exceeds a preset job total threshold; if the number of all the current running processing jobs does not exceed the total number threshold of the jobs, judging whether the current CPU utilization rate exceeds a preset CPU utilization rate threshold; and if the current CPU utilization rate does not exceed the CPU utilization rate threshold value, starting the new temporary operation processing job.
According to an embodiment of the present invention, after the starting of the new temporarily running processing job, the method further includes: judging whether a message is still to be processed in the message queue; and if no message is to be processed in the message queue, suspending the monitoring processing operation, starting a sleep timer, and entering a sleep state.
According to an embodiment of the present invention, the message queue processing method further includes: judging whether the depth of the message queue exceeds a preset warning depth threshold value or not; and if the depth of the message queue exceeds the warning depth threshold value, sending warning information to the message queue.
According to an embodiment of the present invention, the message queue processing method further includes: judging whether the states of all the current running processing jobs are in a lock state or a message waiting state; and if the states of all the current running processing jobs are in a lock state or a message waiting state, sending warning information to the message queue.
According to an embodiment of the present invention, the message queue processing method further includes: and judging whether to start the monitoring processing operation or the long-running processing operation according to the setting of a preset mark.
According to another aspect of the present invention, there is provided a message queue processing apparatus including: the message queue detection module is used for detecting the message queue depth of the message queue, the states and the number of all the current running processing jobs of the message queue and the utilization rate of a current CPU (central processing unit); and a temporary job starting determining module, configured to determine whether to start a new temporary operation processing job according to the message queue depth detected by the message queue detecting module, the states and numbers of all currently-running processing jobs, and the utilization rate of the current CPU.
According to an embodiment of the present invention, the temporary job initiation determination module includes: the first queue depth judgment submodule is used for judging whether the message queue depth detected by the message queue detection module exceeds a preset new operation starting threshold value or not; a first job status judgment sub-module, configured to, when the first queue depth judgment sub-module judges that the message queue depth exceeds the new job starting threshold, judge whether the number of all currently-running processing jobs detected by the message queue detection module exceeds a preset job total threshold; a CPU utilization rate determining submodule, configured to determine whether the CPU utilization rate detected by the message queue detecting module exceeds a preset CPU utilization threshold when the first job status determining submodule determines that the number of all currently-running processing jobs does not exceed the job total threshold; and a temporary operation starting sub-module, configured to start the new temporary operation processing operation when the CPU utilization determining sub-module determines that the CPU utilization does not exceed the CPU utilization threshold.
According to an embodiment of the present invention, the temporary job initiation determining module further includes: the message judging submodule is used for judging whether a message is to be processed in the message queue after the temporary operation starting module starts the new temporary operation processing operation; and the dormancy submodule is used for pausing the monitoring processing operation, starting a dormancy timer and entering a dormancy state when the message judging submodule judges that no message is to be processed in the message queue.
According to an embodiment of the present invention, the temporary job initiation determining module further includes: the second queue depth submodule is used for judging whether the message queue depth detected by the message queue detection module exceeds a preset warning depth threshold value or not; and the first alarm submodule is used for sending warning information to the message queue when the second queue depth submodule judges that the depth of the message queue exceeds the warning depth threshold value.
According to an embodiment of the present invention, the temporary job initiation determining module further includes: a second job state judgment submodule, configured to judge whether the states of all currently running processing jobs detected by the message queue detection module are in a lock state or a message waiting state; and the second alarm submodule is used for sending warning information to the message queue when the second operation state judgment submodule judges that the states of all the current operation processing operations are in a locking state or a message waiting state.
According to an embodiment of the present invention, the message queue processing apparatus further includes: and the monitoring operation judging module is used for judging whether to start the monitoring processing operation or the long-running processing operation according to the setting of a preset mark.
According to the message queue processing method and device, whether a new temporary operation processing job is started or not can be judged, so that the problems of system resource waste and long-operation processing job efficiency reduction caused by starting a large number of temporary operation processing jobs are solved, the processing efficiency of the message queue can be improved, and the system resource is saved. In addition, according to some embodiments, the message queue processing method and apparatus of the present invention further provide a sleep mechanism, when it is determined that there is no message to be processed in the message queue, the message queue enters a sleep mode for a period of time, and the monitoring operation is suspended, thereby avoiding unnecessary system resource occupation.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
The above and other objects, features and advantages of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
FIG. 1 is a flow diagram illustrating a message queue processing method in accordance with an exemplary embodiment.
FIG. 2 is a flow diagram illustrating another message queue processing method in accordance with an example embodiment.
FIG. 3 is a flow diagram illustrating a temporary run processing job in accordance with an exemplary embodiment.
FIG. 4 is a flowchart illustrating a long run processing job in accordance with an exemplary embodiment.
Fig. 5 is a flow chart illustrating yet another message queue processing method according to an example embodiment.
Fig. 6 is a block diagram illustrating a message queue processing apparatus according to an example embodiment.
Fig. 7 is a block diagram illustrating another message queue processing apparatus according to an example embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known structures, methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the invention.
FIG. 1 is a flow diagram illustrating a message queue processing method in accordance with an exemplary embodiment. As shown in fig. 1, the message queue processing method 10 includes:
in step S110, a monitoring processing job is started, and the depth of the message queue, the status and number of all the currently running processing jobs in the message queue, and the utilization rate of the current CPU are detected.
Wherein the message queue depth is the number of messages in the message queue.
The message queue may include all currently running processing jobs including both long running processing jobs and all temporarily running processing jobs, or may only include all temporarily running processing jobs.
In step S120, it is determined whether to start a new temporary running processing job according to the depth of the message queue, the status and number of all currently running processing jobs in the message queue, and the utilization rate of the current CPU.
The message queue processing method provided by the embodiment can judge whether a new temporary operation processing job is started or not, thereby avoiding the problems of wasting system resources and reducing the efficiency of long-operation processing jobs caused by starting a large number of temporary operation processing jobs, improving the processing efficiency of the message queue on one hand, and saving the system resources on the other hand.
It should be clearly understood that the present disclosure describes how to make and use particular examples, but the principles of the present disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
FIG. 2 is a flow diagram illustrating another message queue processing method in accordance with an example embodiment. As shown in fig. 2, the message queue processing method 20 includes:
in step S210, it is determined whether or not the monitoring processing job is started, and if the monitoring processing job is started, step S220 is executed, otherwise, step S290 is executed.
Wherein, the determination of whether to start the monitoring processing job can be determined by, for example, determining that a preset flag is set, and if the preset flag is YES (YES or tune), determining to start the monitoring processing job; and if the preset flag is set to NO (NO or FALSE), the monitoring operation is not started. Alternatively, the monitoring operation may be started when no; if yes, the monitoring operation is not started.
The preset flag may be considered to be set, and may also be set by other applications, functions, and the like, and the present invention is not limited thereto.
Further, in the message queue processing method 10 shown in fig. 1, it may also be determined whether to start the monitoring processing job before step S110, and if the monitoring processing job is started, step S110 is executed; otherwise, executing the long-running processing job.
In step S220, it is determined whether the message queue depth exceeds a new job start threshold, and if the message queue depth exceeds the new job start threshold, step S230 is executed; otherwise, the method is ended.
The new job starting threshold may be a preset fixed value, or may also be a threshold dynamically set according to the message queue processing condition and/or the CPU utilization rate, and the present invention is not limited thereto.
In step S230, it is determined whether the number of all currently running processing jobs in the message queue exceeds a job total threshold, and if not, step S240 is executed; otherwise, the method is ended.
The total number of jobs threshold may be a preset fixed value, or may also be a threshold dynamically set according to the message queue processing condition and/or the CPU utilization, and the present invention is not limited thereto.
The current all-running processing jobs in the message queue may include long-running processing jobs and all temporary-running processing jobs, or may only be all temporary-running processing jobs. The setting of the total number of operations threshold may be different for these two cases.
In step S240, it is determined whether the current CPU utilization exceeds a CPU utilization threshold, and if not, step S250 is executed; otherwise, the method is ended.
The CPU utilization threshold may be a preset fixed value, or may also be a threshold dynamically set according to the message queue processing condition and/or the CPU utilization, and the like, which is not limited in the present invention.
In step S250, a new temporary run processing job is started.
In step S260, the long run processing job is executed.
In some embodiments, the message queue processing method 20 may further include: and judging whether the depth of the message queue exceeds a warning depth threshold value, and if the depth of the message queue exceeds the warning depth threshold value, sending warning information to the message queue so as to issue a short message notification to the outside. This step may be performed, for example, before step S220, and after issuing the warning information, step S220 is continuously performed; and if the alert depth threshold is not exceeded, the step S220 is continuously performed. Alternatively, this step may be performed before step S230, and after the warning information is issued, step S230 may be continuously performed; and if the alert depth threshold is not exceeded, continuing to perform step S230. Still alternatively, this step may be performed before step S240, and after the warning information is issued, step S240 is continuously performed; and if the alert depth threshold is not exceeded, the process continues to step S240. Still alternatively, the step may be performed before step S250, and after the warning information is issued, step S250 is continuously performed; and if the alert depth threshold is not exceeded, continuing to perform step S250. The warning depth threshold may be a preset fixed value, or may be a threshold dynamically set according to the message queue processing condition and/or the CPU utilization, and the invention is not limited thereto.
In some embodiments, the message queue processing method 20 may further include: and judging whether the current states of all the running processing jobs of the message queue are in a locking state or a message waiting state, if so, sending warning information to the message queue, and thus, externally issuing a short message notification. This step may be performed, for example, before step S230, and after issuing the warning information, step S230 is continued; if not, the process continues to step S230. Alternatively, this step may be performed before step S220, and after the warning information is issued, step S220 may be continuously performed; if not, the process continues to step S220. Still alternatively, this step may be performed before step S240, and after the warning information is issued, step S240 is continuously performed; if not, the process continues to step S240. Still alternatively, the step may be performed before step S250, and after the warning information is issued, step S250 is continuously performed; if not, the process continues to step S250. The lock status and the message waiting status of the processing job are well known to those skilled in the art, and will not be described herein.
FIG. 3 is a flow diagram illustrating a temporary run processing job in accordance with an exemplary embodiment. As shown in fig. 3, the temporary execution processing job flow includes:
in step S2510, it is determined whether there is a message to be processed in the message queue, and if there is a message to be processed, step S2520 is performed; otherwise, the temporary run processing job is ended.
In step S2520, the messages in the message queue are processed, and the process returns to step S2510.
FIG. 4 is a flowchart illustrating a long run processing job in accordance with an exemplary embodiment. As shown in fig. 4, the long run processing job flow includes:
in step S2610, it is determined whether there is a message pending in the message queue, and if there is a message pending, step S2620 is performed; otherwise, step S2640 is performed.
In step S2620, it is determined whether the acquisition of the message in the message queue is allowed, and if the acquisition is allowed, step S2630 is performed; otherwise, the long run processing job is ended.
In step S2630, the messages in the message queue are processed, and the process returns to step S2610.
In step S2640, the wireless standby mode is entered, and the determination in step S2610 is continuously performed.
In the message queue processing method provided by the embodiment, whether a new temporary operation processing job needs to be started is determined by jointly referring to the depth of the message queue, the states and the number of all the current operation processing jobs of the message queue and the utilization rate of the current CPU, so that the problems of wasting system resources and reducing the efficiency of long-operation processing jobs caused by starting a large number of temporary operation processing jobs are solved, the processing efficiency of the message queue can be improved, and the system resources are saved.
Fig. 5 is a flow chart illustrating yet another message queue processing method according to an example embodiment. Steps S310 to S360 in the message queue processing method 30 shown in fig. 5 are the same as steps S210 to S260 in the message queue processing method 20 shown in fig. 2, and reference may be made to the description of the message queue processing method 20 shown in fig. 2, which is not repeated herein. In addition, the message queue processing method 30 further includes:
in step S370, it is determined whether there are more messages to be processed in the message queue, and if there are more messages to be processed, the process returns to step S320; otherwise, step S380 is executed.
In step S380, the current monitoring processing job is suspended, and a sleep timer is started to enter a sleep state.
When the sleep timer expires, the monitoring status is returned to step S320.
The message queue processing method provided by the embodiment further provides a sleep mechanism, and after the message queue is judged to have no message to be processed, the sleep mode is entered for a period of time, and the monitoring operation is suspended, so that unnecessary system resource occupation is avoided.
It is to be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the method according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention. For details which are not disclosed in the embodiments of the apparatus of the present invention, reference is made to the embodiments of the method of the present invention.
Fig. 6 is a block diagram illustrating a message queue processing apparatus according to an example embodiment. As shown in fig. 6, the message queue processing apparatus 40 includes: a message queue detection module 410, and a temporary job initiation determination module 420.
The message queue detecting module 410 is used to detect the depth of the message queue, the status and number of all running processing jobs currently running in the message queue, and the utilization rate of the current CPU.
The temporary job starting determining module 420 is configured to determine whether to start a new temporary running processing job according to the depth of the message queue detected by the message queue detecting module 410, the state and number of all currently running processing jobs in the message queue, and the utilization rate of the current CPU.
Fig. 7 is a block diagram illustrating another message queue processing apparatus according to an example embodiment. As shown in fig. 7, the message queue processing apparatus 50 includes: a message queue detection module 510 and a temporary job initiation determination module 520.
The message queue detection module 510 is configured to detect a depth of the message queue, a status and a number of all currently running processing jobs in the message queue, and a utilization rate of a current CPU.
The temporary job initiation determination module 520 includes: a first queue depth judgment sub-module 5204, a first job status judgment sub-module 5206, a CPU utilization judgment sub-module 5208, and a temporary job activation sub-module 5210.
The first queue depth determining sub-module 5204 is configured to determine whether the message queue depth detected by the message queue detecting module 510 exceeds a new job starting threshold.
The first job status determining sub-module 5206 is configured to determine, when the first queue depth determining sub-module 5204 determines that the message queue depth exceeds the new job starting threshold, whether the number of all currently running processing jobs in the message queue detected by the message queue detecting module 510 exceeds the job total threshold.
The CPU utilization determining sub-module 5208 is configured to determine whether the CPU utilization detected by the message queue detecting module 510 exceeds the CPU utilization threshold when the first job status determining sub-module 5206 determines that the number of all currently running processing jobs in the message queue does not exceed the job total threshold.
The temporary job starting sub-module 5210 is used to start a new temporary run processing job when the CPU utilization determining sub-module 5208 determines that the CPU utilization does not exceed the CPU utilization threshold.
In some embodiments, the temporary job initiation determination module 520 may further include: a message determination submodule 5212 and a sleep submodule 5214.
The message determining submodule 5212 is configured to determine whether a message is still pending in the message queue after the temporary job starting submodule 5210 starts a new temporary operation processing job.
The sleep sub-module 5214 is used to suspend the current monitoring and processing task, start a sleep timer, and enter a sleep state when the message determining sub-module 5212 determines that no message is pending in the message queue.
In some embodiments, the temporary job initiation determination module 520 may further include: a second queue depth sub-module and a first alarm sub-module.
The second queue depth sub-module is configured to determine whether the depth of the message queue detected by the message queue detecting module 510 exceeds the alert depth threshold.
And the first alarm submodule is used for sending warning information to the message queue when the second queue depth submodule judges that the message queue exceeds the warning depth threshold value, so that a short message notification is issued to the outside.
In some embodiments, the temporary job initiation determination module 520 may further include: a second operation state judgment submodule and a second alarm submodule.
The second job status determining sub-module is configured to determine whether all the current running processing jobs of the message queue detected by the message queue detecting module 510 are in a locked state or a message waiting state.
And the second alarm submodule is used for sending warning information to the message queue when the second job state judgment submodule judges that the states of all the current running processing jobs of the message queue are in a locking state or a message waiting state, so that a short message notification is issued to the outside.
In some embodiments, the message queue processing apparatus 50 may further include: and a monitoring job judging module 530, configured to judge whether to start the monitoring processing job or the long run processing job by setting a preset flag.
Further, the monitoring job determination module may be included in the message queue processing apparatus 40 so as to determine whether to start the monitoring processing job or the long run processing job by setting a preset flag.
It is noted that the block diagrams shown in the above figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to make a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) execute the method according to the embodiment of the present invention.
Exemplary embodiments of the present invention are specifically illustrated and described above. It is to be understood that the invention is not limited to the precise construction, arrangements, or instrumentalities described herein; on the contrary, the invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (8)

1. A message queue processing method, comprising:
starting monitoring processing jobs, and detecting the message queue depth of a message queue, the states and the number of all the current running processing jobs of the message queue and the utilization rate of a current CPU (central processing unit); and
determining whether to start a new temporary operation processing job according to the message queue depth, the states and the number of all the current operation processing jobs and the utilization rate of the current CPU, wherein the method comprises the following steps:
judging whether the depth of the message queue exceeds a preset warning depth threshold value or not; if the depth of the message queue exceeds the warning depth threshold value, warning information is sent to the message queue; if the depth of the message queue does not exceed the warning depth threshold, judging whether the depth of the message queue exceeds a preset new operation starting threshold; if the depth of the message queue exceeds the new job starting threshold, judging whether the number of all the current running processing jobs exceeds a preset job total threshold; if the number of all the current running processing jobs does not exceed the total number threshold of the jobs, judging whether the current CPU utilization rate exceeds a preset CPU utilization rate threshold; and if the current CPU utilization rate does not exceed the CPU utilization rate threshold value, starting the new temporary operation processing job.
2. The message queue processing method according to claim 1, further comprising, after starting the new temporarily running processing job: judging whether a message is still to be processed in the message queue; and if no message is to be processed in the message queue, suspending the monitoring processing operation, starting a sleep timer, and entering a sleep state.
3. The message queue processing method according to claim 1, further comprising: judging whether the states of all the current running processing jobs are in a lock state or a message waiting state; and if the states of all the current running processing jobs are in a lock state or a message waiting state, sending warning information to the message queue.
4. The message queue processing method according to claim 1, further comprising: and judging whether to start the monitoring processing operation or the long-running processing operation according to the setting of a preset mark.
5. A message queue processing apparatus, comprising:
the message queue detection module is used for starting monitoring processing jobs, and detecting the message queue depth of the message queue, the states and the number of all the current running processing jobs of the message queue and the utilization rate of a current CPU; and
a temporary job starting determining module, configured to determine whether to start a new temporary operation processing job according to the message queue depth detected by the message queue detecting module, the states and numbers of all currently-running processing jobs, and the utilization rate of the current CPU;
wherein the temporary job initiation determination module includes:
the second queue depth submodule is used for judging whether the message queue depth detected by the message queue detection module exceeds a preset warning depth threshold value or not;
the first alarm submodule is used for sending alarm information to the message queue when the second queue depth submodule judges that the depth of the message queue exceeds the warning depth threshold;
the first queue depth judgment sub-module is used for judging whether the message queue depth detected by the message queue detection module exceeds a preset new operation starting threshold value or not when the second queue depth sub-module judges that the message queue depth does not exceed an alert depth threshold value;
a first job status judgment sub-module, configured to, when the first queue depth judgment sub-module judges that the message queue depth exceeds the new job starting threshold, judge whether the number of all currently-running processing jobs detected by the message queue detection module exceeds a preset job total threshold;
a CPU utilization rate determining submodule, configured to determine whether the CPU utilization rate detected by the message queue detecting module exceeds a preset CPU utilization threshold when the first job status determining submodule determines that the number of all currently-running processing jobs does not exceed the job total threshold; and
and the temporary operation starting sub-module is used for starting the new temporary operation processing operation when the CPU utilization rate judging sub-module judges that the CPU utilization rate does not exceed the CPU utilization threshold.
6. The message queue processing apparatus according to claim 5, wherein the temporary job initiation determination module further comprises:
the message judging submodule is used for judging whether a message is to be processed in the message queue after the temporary operation starting module starts the new temporary operation processing operation; and
and the dormancy submodule is used for pausing the monitoring processing operation, starting a dormancy timer and entering a dormancy state when the message judgment submodule judges that no message is to be processed in the message queue.
7. The message queue processing apparatus according to claim 5, wherein the temporary job initiation determination module further comprises:
a second job state judgment submodule, configured to judge whether the states of all currently running processing jobs detected by the message queue detection module are in a lock state or a message waiting state; and
and the second alarm submodule is used for sending warning information to the message queue when the second job state judgment submodule judges that the states of all the current running processing jobs are in a locking state or a message waiting state.
8. The message queue processing apparatus according to claim 5, further comprising: and the monitoring operation judging module is used for judging whether to start the monitoring processing operation or the long-running processing operation according to the setting of a preset mark.
CN201510945045.0A 2015-12-16 2015-12-16 Message queue processing method and device Active CN106886457B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510945045.0A CN106886457B (en) 2015-12-16 2015-12-16 Message queue processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510945045.0A CN106886457B (en) 2015-12-16 2015-12-16 Message queue processing method and device

Publications (2)

Publication Number Publication Date
CN106886457A CN106886457A (en) 2017-06-23
CN106886457B true CN106886457B (en) 2020-09-04

Family

ID=59176147

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510945045.0A Active CN106886457B (en) 2015-12-16 2015-12-16 Message queue processing method and device

Country Status (1)

Country Link
CN (1) CN106886457B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108259248A (en) * 2018-01-31 2018-07-06 泰康保险集团股份有限公司 The configuration method and device of queue management device
CN109766236A (en) * 2018-12-15 2019-05-17 中国平安人寿保险股份有限公司 KAFKA message queue number monitoring method, device, electronic equipment and storage medium
CN110659142A (en) * 2019-08-02 2020-01-07 平安科技(深圳)有限公司 Message queue processing method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102457906A (en) * 2010-10-26 2012-05-16 中国移动通信集团河南有限公司 Load balancing control method and system of message queues
CN103618643A (en) * 2013-11-26 2014-03-05 北京京东尚科信息技术有限公司 Method and device for dynamic alarm type monitoring of message queue
CN103856963A (en) * 2014-03-05 2014-06-11 浪潮通信信息系统有限公司 Method for establishing intelligence communication channels
CN104079500A (en) * 2013-03-29 2014-10-01 中兴通讯股份有限公司 Queue scheduling method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030046396A1 (en) * 2000-03-03 2003-03-06 Richter Roger K. Systems and methods for managing resource utilization in information management environments
US20020194251A1 (en) * 2000-03-03 2002-12-19 Richter Roger K. Systems and methods for resource usage accounting in information management environments

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102457906A (en) * 2010-10-26 2012-05-16 中国移动通信集团河南有限公司 Load balancing control method and system of message queues
CN104079500A (en) * 2013-03-29 2014-10-01 中兴通讯股份有限公司 Queue scheduling method and device
CN103618643A (en) * 2013-11-26 2014-03-05 北京京东尚科信息技术有限公司 Method and device for dynamic alarm type monitoring of message queue
CN103856963A (en) * 2014-03-05 2014-06-11 浪潮通信信息系统有限公司 Method for establishing intelligence communication channels

Also Published As

Publication number Publication date
CN106886457A (en) 2017-06-23

Similar Documents

Publication Publication Date Title
CN106980546B (en) Task asynchronous execution method, device and system
CN106886457B (en) Message queue processing method and device
CN107273141B (en) Embedded real-time operating system
JP4747307B2 (en) Network processing control device, program, and method
US7444450B2 (en) Method and system for detecting excessive interrupt processing for a processor
CN110659142A (en) Message queue processing method and device, electronic equipment and storage medium
CN106528318B (en) Thread dead loop detection method and device
CN109981737B (en) Network request processing method, device, terminal and storage medium
CN115361451B (en) Network communication parallel processing method and system
CN112383585A (en) Message processing system and method and electronic equipment
CN112817772B (en) Data communication method, device, equipment and storage medium
WO2017198112A1 (en) Frequency switching method and apparatus, and computer readable storage medium
CN111314140B (en) Method and device for improving stability of network equipment, network equipment and storage medium
CN107729207B (en) Application program main thread monitoring method and device
EP2541406A1 (en) Multi-core processor system, interrupt program, and interrupt method
WO2014101892A1 (en) Resource adjustment method and device
CN111597056A (en) Distributed scheduling method, system, storage medium and device
CN111142813A (en) Method and device for detecting connection state of printer
CN115378685A (en) Data processing method, system, electronic device and computer readable storage medium
EP2610752B1 (en) Parallel computer, job information acquisition program of parallel computer, and job information acquisition method for parallel computer
CN111796949A (en) Communication task processing method, device, equipment and storage medium
KR101725408B1 (en) Tasks scheduling method for realtime operating system
CN111857996A (en) Interrupt processing method, system, equipment and computer readable storage medium
WO2011120263A1 (en) Alarm platform and alarm implementation method thereof
CN110677877B (en) Wireless management frame sending method and device, AP (access point) equipment and storage medium

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