CN108255515B - Method and device for realizing timer service - Google Patents

Method and device for realizing timer service Download PDF

Info

Publication number
CN108255515B
CN108255515B CN201810044326.2A CN201810044326A CN108255515B CN 108255515 B CN108255515 B CN 108255515B CN 201810044326 A CN201810044326 A CN 201810044326A CN 108255515 B CN108255515 B CN 108255515B
Authority
CN
China
Prior art keywords
timer
service
message
sending
service process
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
CN201810044326.2A
Other languages
Chinese (zh)
Other versions
CN108255515A (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.)
Guangzhou Teligen Communication Technology Co ltd
Original Assignee
Guangzhou Teligen Communication Technology 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 Guangzhou Teligen Communication Technology Co ltd filed Critical Guangzhou Teligen Communication Technology Co ltd
Priority to CN201810044326.2A priority Critical patent/CN108255515B/en
Publication of CN108255515A publication Critical patent/CN108255515A/en
Application granted granted Critical
Publication of CN108255515B publication Critical patent/CN108255515B/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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/30076Arrangements for executing specific machine instructions to perform miscellaneous control operations, e.g. NOP

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)

Abstract

The embodiment of the invention discloses a method and a device for realizing timer service.A timer process receives a timer addition request sent by a service process; configuring a corresponding timer object according to the timing information carried in the timer adding request; and after the timer object finishes the timing task, sending an overtime message to the service process. The timer module is separated from the service process and runs in an independent process mode, and for the service process, the timer process is an asynchronous task and cannot occupy resources, so that the service process can be more concentrated in processing the service process, and the processing performance of the service process is improved. And the business process does not need to establish a thread for the timer process, so that the performance reduction caused by thread locking is reduced, the difficulty of software architecture design is simplified, the development efficiency is improved, and the later maintenance difficulty is reduced.

Description

Method and device for realizing timer service
Technical Field
The invention relates to the technical field of network software development, in particular to a method and a device for realizing timer service.
Background
In network software development, timing control, such as timeout processing, delay control, timing tasks, and the like, is often used. Especially in network communication development, the timing requirement is large. In order to obtain the required timing control, accurate and stable time control in software is required, and the implemented modules are generally called timers. There are generally two methods for implementing timers: hardware timers and software timers.
The hardware timer refers to a special hardware module and can periodically send out an interrupt signal according to a hardware clock to trigger software processing, but the hardware timer needs to depend on hardware design, has limited resources and is poor in transportability.
The software timer is implemented in software, and can be implemented by using a timer interface provided by an operating system or by using a timer algorithm only. Timer interfaces provided by an operating system are generally processed by adopting signal triggering or thread starting, the management of the timers cannot be unified, and inconvenience is brought to multi-module collaborative development and later maintenance. Therefore, software projects generally adopt a timer module realized by a pure software algorithm, a standard interface is packaged, and the timer module is used as an independent module to be applied to development of each business module, so that the complexity of software design is greatly reduced, and development and maintenance are facilitated.
In the existing software architecture design, an application process generally includes a service module and a timer module at the same time, and in order to ensure that the timer is triggered on time, the timer module runs in an independent thread, and the service module runs in other threads.
Although many timer algorithms suitable for different scenarios have been designed to improve the efficiency of the timer, such as minimum heap based, ordered double-nematic based and time round based algorithms, the timer list needs to be scanned frequently, consuming CPU resources of the process, and especially when a large number of timers exist, the overhead of the timers affects normal traffic.
When the timer is overtime, the timer module calls an overtime processing function provided by the service module in the timer thread, and the overtime processing function may access service data, so that safety protection in a multi-thread mode must be considered, such as mutual exclusion lock on shared resources, synchronization on states and the like, the complexity of a service flow is increased, and meanwhile, the use of the mutual exclusion lock also increases the system overhead and reduces the processing capacity of the process.
Therefore, how to reduce the influence of the timing control on the business process under the condition of meeting the requirement of the timing control is a problem to be solved urgently by technical personnel in the field.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for realizing timer service, which can reduce the influence of timing control on a business process and improve the performance of an application process for processing business under the condition of meeting the requirement of timing control.
In order to solve the above technical problem, an embodiment of the present invention provides a method for implementing a timer service, which is applied to a timer process, and the method includes:
receiving a timer adding request sent by a service process;
configuring a corresponding timer object according to the timing information carried in the timer adding request;
and when the timer object finishes a timing task, sending an overtime message to the service process.
Optionally, the method further includes:
and when the timer object finishes a timing task, correspondingly processing the timer object according to the timing mode of the timer object.
Optionally, when the timing mode is a single-time operation mode, the performing, according to the timing mode of the timer object, corresponding processing on the timer object includes:
deleting the timer object.
Optionally, when the timing mode is a periodic operation mode, the performing, according to the timing mode of the timer object, corresponding processing on the timer object includes:
and clearing the timer object and restarting the timing task.
Optionally, after configuring the corresponding timer object according to the timing information carried in the timer addition request, the method further includes:
and sending a confirmation message to the business process.
Optionally, the method further includes:
receiving a deleting message sent by the service process;
and stopping and deleting the corresponding timer object according to the timer number carried in the deletion message.
The embodiment of the invention also provides a device for realizing the timer service, which is applied to the timer process and comprises a receiving unit, a configuration unit and a sending unit;
the receiving unit is used for receiving a timer adding request sent by a service process;
the configuration unit is configured to configure a corresponding timer object according to the timing information carried in the timer addition request;
and the sending unit is used for sending an overtime message to the service process when the timer object completes a timing task.
Optionally, the system further comprises a processing unit; and the processing unit is used for carrying out corresponding processing on the timer object according to the timing mode of the timer object.
Optionally, when the timing mode is a single-run mode, the processing unit is specifically configured to delete the timer object.
Optionally, when the timing mode is a periodic operation mode, the processing unit is specifically configured to clear the timer object and restart a timing task.
Optionally, the sending unit is further configured to send an acknowledgement message to the service process.
Optionally, the system further comprises a deleting unit;
the receiving unit is further configured to receive a deletion message sent by the service process;
and the deleting unit is used for stopping and deleting the corresponding timer object according to the timer number carried in the deleting message.
The embodiment of the invention also provides a method for realizing the timer service, which is applied to the business process and comprises the following steps:
sending a timer addition request to a timer process;
and receiving the overtime message sent by the timer process, and calling an overtime processing function corresponding to the overtime message.
Optionally, the method further includes:
and receiving a confirmation message sent by the timer process, and recording the timer number and the state identification code carried in the confirmation message.
The embodiment of the invention also provides a device for realizing the timer service, which is applied to the business process and comprises a sending unit, a receiving unit and a calling unit;
the sending unit is used for sending a timer adding request to the timer process;
the receiving unit is configured to receive an timeout message sent by the timer process;
and the calling unit is used for calling the overtime processing function corresponding to the overtime message.
Optionally, the system further comprises a recording unit;
the receiving unit is further configured to receive a confirmation message sent by the timer process and trigger the recording unit; and the recording unit is used for recording the timer number and the state identification code carried in the confirmation message.
According to the technical scheme, the timer process receives a timer adding request sent by the service process; configuring a corresponding timer object according to the timing information carried in the timer adding request; and after the timer object finishes the timing task, sending an overtime message to the service process. The timer module is separated from the service process and runs in an independent process mode, and for the service process, the timer process is an asynchronous task and cannot occupy resources, so that the service process can be more concentrated in processing the service process, and the processing performance of the service process is improved. And the business process does not need to establish a thread for the timer process, so that the performance reduction caused by thread locking is reduced, the difficulty of software architecture design is simplified, the development efficiency is improved, and the later maintenance difficulty is reduced.
Drawings
In order to illustrate the embodiments of the present invention more clearly, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings can be obtained by those skilled in the art without inventive effort.
Fig. 1 is a signaling diagram of a method for implementing a timer service according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a method for implementing communication between a service process and a timer process based on a message queue according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an apparatus for implementing a timer service in a timer process according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device for implementing a timer service in a business process according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative work belong to the protection scope of the present invention.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
Next, a method for implementing a timer service according to an embodiment of the present invention is described in detail. Fig. 1 is a signaling diagram of a method for implementing a timer service according to an embodiment of the present invention, where the method includes:
s101: the business process sends a timer addition request to the timer process.
In the embodiment of the invention, in order to avoid the timer module from consuming the CPU resource of the service process, the timer module is separated from the service process and runs in an independent process mode, namely, an independent timer process is established.
When a business process needs to invoke a timer object, a timer addition request may be sent to the timer process.
In practical application, a business process may call multiple timer objects, and for convenience of management, a timer management module is provided in each business process. The function of the timer management module is to record the running timer object, i.e. to record the timer object in the active state. In addition to the timer management module, a service module for executing a service is included in the service process.
To reduce interface dependency, communication between the business process and the timer process may be passed through a message queue. Correspondingly, both the service process and the timer process include message queue interfaces.
In the embodiment of the invention, the message is transmitted between the service process and the timer process through the message queue, so that the interface dependence is avoided, the number of the service process and the timer process can be dynamically adjusted when the system runs on site conveniently, and the system can conveniently expand the capacity according to the actual requirement.
As shown in fig. 2, a service module in the service process calls a local timer management module to add a timer object, and parameter information of the timer object includes timeout time, a timeout processing function, a parameter of the timeout processing function, and the like; the timer management module in the service process records the added parameter information, assigns a globally unique timer number to the timer object, and then sends a timer addition request to a local message queue interface, and the message queue interface sends the timer addition request to a message queue.
In a distributed system, the number of the service processes may be multiple, and in order to facilitate the system to distinguish different service processes, a corresponding service process number may be set for each service process.
The timer addition request may carry timing information such as a service process number, a timer number, timeout time, a timer mode, and the like.
The timer addition request is defined as follows,
struct AddTimerReqMsg
{
std is string pid; // Business Process numbering
std, string tid; // timer numbering
int timeout; // time-out time in milliseconds
int mode; // timer mode
}
S102: and the timer process receives a timer adding request sent by the service process.
Taking the message queue to implement communication between the service process and the timer process as an example, each timer process includes a message queue interface, and can receive a timer addition request sent by the message queue.
In the distributed system, the number of the timer processes may be multiple, and when the message queue receives a timer addition request sent by a certain service process, a suitable timer process may be selected from the multiple timer processes according to a preset priority order or a load balancing policy, and the timer addition request is sent to a message queue interface of the timer process.
S103: and configuring a corresponding timer object by the timer process according to the timing information carried in the timer adding request.
A plurality of timer objects can be contained in one timer process, and for convenience of management, a timer management module is arranged in each timer process. The function of the timer management module is to configure the timer objects required by the business process.
In combination with the above description of the communication process shown in fig. 2, the message queue pushes a timer addition request to a message queue interface of a timer process, the message queue interface receives the request and then transfers the request to a timer management module in the timer process, and the timer management module configures a corresponding timer object according to the timing information carried in the request.
The timing information may include a timer number, a timeout time, and a timer mode, and the timer object is configured, i.e., the information is used as a parameter of the timer object, and the timer object is in an active state to start a timing task.
S104: and when the timer object finishes a timing task, the timer process sends an overtime message to the service process.
The timer scanning module in the timer process can scan the timer object in real time so as to find whether the timer object reaches the timeout time in time.
When the timer object reaches the timeout time, in order to facilitate the business process to timely know that the timing task is completed, the timer process sends a timeout message to the business process.
The timeout message may carry a service process number, a timer number, a timeout number, and the like.
The timeout message is defined as follows,
struct TimeoutMsg
{
std is string pid; // Business Process numbering
std, string tid; // timer numbering
int cnt; // number of timeouts
}
S105: and the service process receives the overtime message sent by the timer process and calls an overtime processing function corresponding to the overtime message.
The specific process of the timer process sending the timeout message to the service process is similar to the process of the service process sending the timer addition request to the timer process.
When finding that the timer object is overtime, a timer scanning module of the timer process reports an overtime message to a timer management module, the timer management module sends the overtime message to a message queue interface, and the message queue interface of the timer process sends the overtime message to a message queue; the message queue pushes the overtime message to a message queue interface of a business process; and after receiving the overtime message, the message queue interface of the service process transmits the overtime message to the timer management module, and the timer management module of the service process can search the parameter information of the timer object according to the timer number carried in the overtime message, so that a corresponding overtime processing function is called to notify the service module.
According to the technical scheme, the timer process receives a timer adding request sent by the service process; configuring a corresponding timer object according to the timing information carried in the timer adding request; and after the timer object finishes the timing task, sending an overtime message to the service process. The timer module is separated from the service process and runs in an independent process mode, and for the service process, the timer process is an asynchronous task and cannot occupy resources, so that the service process can be more concentrated in processing the service process, and the processing performance of the service process is improved. And the business process does not need to establish a thread for the timer process, so that the performance reduction caused by thread locking is reduced, the difficulty of software architecture design is simplified, the development efficiency is improved, and the later maintenance difficulty is reduced.
In the above description of S103, it is mentioned that when configuring a timer object, the timer object has a corresponding timing mode, and the processing flows of the timer object in different timing modes are different, specifically, when the timer object completes a timing task, the timer object is correspondingly processed according to the timing mode of the timer object.
The timing mode may include a single operation mode and a periodic operation mode, among others.
When the timing mode is a single-time running mode, the timer object has no use value after completing the timing task, and in order to timely release the resources occupied by the timer object, the timer object can be deleted from the timer process when completing the timing task. Accordingly, the timer management module of the business process can delete the previously recorded timer object.
When the timing mode is a periodic operation mode, after the timer object completes the timing task, the timer object is required to be used for executing the timing task subsequently, therefore, when the timer object completes the timing task, the timer object is cleared, and the timing task is restarted.
According to the timing mode of the timer object, the timer object is deleted or cleared, so that the timer service is further improved, and the resource utilization rate of the timer process is improved.
After the timer process completes the configuration of the timer object, in order to facilitate the business process to know the relevant information of the timer object in time, the timer process may send a confirmation message to the business process.
The confirmation message may include a service process number, a timer number, and a status identifier.
The acknowledgement message is defined as follows:
struct AddTimerResMsg
{
std is string pid; // Business Process numbering
std, string tid; // timer numbering
int status; //0 indicates success, others are error codes
}
The status identifier is used to indicate whether the timer process successfully completes the configuration of the timer object, i.e., whether the timer object is activated.
In a specific implementation, the number 0 may be used to indicate that the timer object is activated, that is, when the status identifier code is 0, it indicates that the timer object is activated; when the status identification code is in other forms than 0, it indicates that the timer object is not activated, and the timer object cannot perform the timing task.
And the service process receives a confirmation message sent by the timer process and records the timer number and the state identification code carried in the confirmation message. And according to the state identification code and the number of the timer, which timer objects are in the activated state can be known.
In practical application, it may happen that a timer object called by a service process has not reached timeout time yet, and the service process has completed corresponding service processing, and at this time, the timer object is no longer required to execute a timing task. For this situation, the service process may send a delete message to the timer process, and the timer process receives the delete message; and stopping and deleting the corresponding timer object according to the timer number carried in the deletion message.
The delete message may include a service process number and a timer number.
The delete message is defined as follows:
struct DelTimerMsg
{
std is string pid; // Business Process numbering
std, string tid; // timer numbering
}
The service process sends the deletion message to the timer process, so that the timer process is prevented from executing unnecessary timing tasks, resources occupied by the timer object can be released in time, and the resource utilization rate of the timer process is further improved.
Fig. 3 is a schematic structural diagram of an apparatus for implementing a timer service according to an embodiment of the present invention, which is applied to a timer process, and includes a receiving unit 31, a configuring unit 32, and a sending unit 33;
the receiving unit 31 is configured to receive a timer addition request sent by a service process;
the configuration unit 32 is configured to configure a corresponding timer object according to the timing information carried in the timer addition request;
the sending unit 33 is configured to send an timeout message to the service process when the timer object completes a timing task.
Optionally, the system further comprises a processing unit; and the processing unit is used for carrying out corresponding processing on the timer object according to the timing mode of the timer object.
Optionally, when the timing mode is a single-run mode, the processing unit is specifically configured to delete the timer object.
Optionally, when the timing mode is a periodic operation mode, the processing unit is specifically configured to clear the timer object and restart a timing task.
Optionally, the sending unit is further configured to send an acknowledgement message to the service process.
Optionally, the system further comprises a deleting unit;
the receiving unit is further configured to receive a deletion message sent by the service process;
and the deleting unit is used for stopping and deleting the corresponding timer object according to the timer number carried in the deleting message.
The description of the features in the embodiment corresponding to fig. 3 may refer to the related description of the embodiment corresponding to fig. 1, and is not repeated here.
According to the technical scheme, the receiving unit of the timer process receives the timer adding request sent by the service process; the configuration unit of the timer process configures a corresponding timer object according to the timing information carried in the timer addition request; and the sending unit of the timer process is used for sending an overtime message to the service process when the timer object completes a timing task. The timer module is separated from the service process and runs in an independent process mode, and for the service process, the timer process is an asynchronous task and cannot occupy resources, so that the service process can be more concentrated in processing the service process, and the processing performance of the service process is improved. And the business process does not need to establish a thread for the timer process, so that the performance reduction caused by thread locking is reduced, the difficulty of software architecture design is simplified, the development efficiency is improved, and the later maintenance difficulty is reduced.
Fig. 4 is a schematic structural diagram of an apparatus for implementing a timer service according to an embodiment of the present invention, which is applied to a business process, where the apparatus includes a sending unit 41, a receiving unit 42, and a calling unit 43;
the sending unit 41 is configured to send a timer addition request to the timer process;
the receiving unit 42 is configured to receive a timeout message sent by the timer process;
the calling unit 43 is configured to call a timeout processing function corresponding to the timeout message.
Optionally, the system further comprises a recording unit;
the receiving unit is further configured to receive a confirmation message sent by the timer process and trigger the recording unit; and the recording unit is used for recording the timer number and the state identification code carried in the confirmation message.
The description of the features in the embodiment corresponding to fig. 4 may refer to the related description of the embodiment corresponding to fig. 1, and is not repeated here.
According to the technical scheme, the sending unit of the business process sends a timer adding request to the timer process; a receiving unit of the service process receives an overtime message sent by the timer process; and the calling unit of the service process calls the overtime processing function corresponding to the overtime message. For the business process, the timer process is an asynchronous task, and resources cannot be occupied, so that the business process can concentrate more on processing the business process, and the processing performance of the business process is improved. And the business process does not need to establish a thread for the timer process, so that the performance reduction caused by thread locking is reduced, the difficulty of software architecture design is simplified, the development efficiency is improved, and the later maintenance difficulty is reduced.
The method and the device for implementing the timer service provided by the embodiment of the invention are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

Claims (10)

1. A method for implementing a timer service, applied to a timer process, the method comprising:
receiving a timer adding request sent by a service process; the communication between the service process and the timer process is transmitted through a message queue; when a message queue receives a timer adding request sent by a service process, selecting a timer process from a plurality of timer processes according to a preset priority order or a load balancing strategy, and sending the timer adding request to a message queue interface of the selected timer process;
configuring a corresponding timer object according to the timing information carried in the timer adding request;
and when the timer object finishes a timing task, sending an overtime message to the service process.
2. The method of claim 1, further comprising:
and when the timer object finishes a timing task, correspondingly processing the timer object according to the timing mode of the timer object.
3. The method according to claim 2, wherein when the timing mode is a single-run mode, the performing the corresponding processing on the timer object according to the timing mode of the timer object comprises:
deleting the timer object.
4. The method according to claim 2, wherein when the timing mode is a periodic operation mode, the performing the corresponding processing on the timer object according to the timing mode of the timer object comprises:
and clearing the timer object and restarting the timing task.
5. The method according to any one of claims 1 to 4, wherein after configuring the corresponding timer object according to the timing information carried in the timer addition request, the method further comprises:
and sending a confirmation message to the business process.
6. The method of any one of claims 1-4, further comprising:
receiving a deleting message sent by the service process;
and stopping and deleting the corresponding timer object according to the timer number carried in the deletion message.
7. The device for realizing the timer service is applied to the timer process and comprises a receiving unit, a configuration unit and a sending unit;
the receiving unit is used for receiving a timer adding request sent by a service process; the communication between the service process and the timer process is transmitted through a message queue; when a message queue receives a timer adding request sent by a service process, selecting a timer process from a plurality of timer processes according to a preset priority order or a load balancing strategy, and sending the timer adding request to a message queue interface of the selected timer process;
the configuration unit is configured to configure a corresponding timer object according to the timing information carried in the timer addition request;
and the sending unit is used for sending an overtime message to the service process when the timer object completes a timing task.
8. A method for implementing a timer service, applied to a business process, the method comprising:
sending a timer addition request to a timer process; the communication between the service process and the timer process is transmitted through a message queue; when a message queue receives a timer adding request sent by a service process, selecting a timer process from a plurality of timer processes according to a preset priority order or a load balancing strategy, and sending the timer adding request to a message queue interface of the selected timer process;
and receiving the overtime message sent by the timer process, and calling an overtime processing function corresponding to the overtime message.
9. The method of claim 8, further comprising:
and receiving a confirmation message sent by the timer process, and recording the timer number and the state identification code carried in the confirmation message.
10. The device for realizing the timer service is applied to business processes and comprises a sending unit, a receiving unit and a calling unit;
the sending unit is used for sending a timer adding request to the timer process; the communication between the service process and the timer process is transmitted through a message queue; when a message queue receives a timer adding request sent by a service process, selecting a timer process from a plurality of timer processes according to a preset priority order or a load balancing strategy, and sending the timer adding request to a message queue interface of the selected timer process;
the receiving unit is configured to receive an timeout message sent by the timer process;
and the calling unit is used for calling the overtime processing function corresponding to the overtime message.
CN201810044326.2A 2018-01-17 2018-01-17 Method and device for realizing timer service Active CN108255515B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810044326.2A CN108255515B (en) 2018-01-17 2018-01-17 Method and device for realizing timer service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810044326.2A CN108255515B (en) 2018-01-17 2018-01-17 Method and device for realizing timer service

Publications (2)

Publication Number Publication Date
CN108255515A CN108255515A (en) 2018-07-06
CN108255515B true CN108255515B (en) 2021-02-02

Family

ID=62741388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810044326.2A Active CN108255515B (en) 2018-01-17 2018-01-17 Method and device for realizing timer service

Country Status (1)

Country Link
CN (1) CN108255515B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114647696A (en) * 2020-12-17 2022-06-21 中兴通讯股份有限公司 Timer system and method
CN112817666B (en) * 2021-01-27 2023-07-21 北京字跳网络技术有限公司 Timing method, timing device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02245938A (en) * 1989-03-20 1990-10-01 Fujitsu Ltd Timer processing system for software processing
CN1584842A (en) * 2004-06-09 2005-02-23 中兴通讯股份有限公司 Method for applied server of computer system
CN101014049A (en) * 2007-02-14 2007-08-08 中兴通讯股份有限公司 Method for managing timer of terminal wireless communication protocol stack sofeware
CN101446911A (en) * 2009-01-06 2009-06-03 中兴通讯股份有限公司 Time-division processing method and device therefor
US8220001B2 (en) * 2009-02-13 2012-07-10 Oracle International Corporation Adaptive cluster timer manager
US9032404B2 (en) * 2003-08-28 2015-05-12 Mips Technologies, Inc. Preemptive multitasking employing software emulation of directed exceptions in a multithreading processor

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100479390C (en) * 2007-03-29 2009-04-15 华为技术有限公司 Distributed system timing method and system
CN101730137B (en) * 2008-10-31 2012-04-04 华为技术有限公司 Data processing method and system
CN101719080B (en) * 2009-12-25 2014-03-26 北京网御星云信息技术有限公司 Multi-core timer implementing method and system
CN105528246A (en) * 2015-12-07 2016-04-27 厦门雅迅网络股份有限公司 In-process timer management method and system based on dynamic timing periods

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02245938A (en) * 1989-03-20 1990-10-01 Fujitsu Ltd Timer processing system for software processing
US9032404B2 (en) * 2003-08-28 2015-05-12 Mips Technologies, Inc. Preemptive multitasking employing software emulation of directed exceptions in a multithreading processor
CN1584842A (en) * 2004-06-09 2005-02-23 中兴通讯股份有限公司 Method for applied server of computer system
CN101014049A (en) * 2007-02-14 2007-08-08 中兴通讯股份有限公司 Method for managing timer of terminal wireless communication protocol stack sofeware
CN101446911A (en) * 2009-01-06 2009-06-03 中兴通讯股份有限公司 Time-division processing method and device therefor
US8220001B2 (en) * 2009-02-13 2012-07-10 Oracle International Corporation Adaptive cluster timer manager

Also Published As

Publication number Publication date
CN108255515A (en) 2018-07-06

Similar Documents

Publication Publication Date Title
CN111782360B (en) Distributed task scheduling method and device
CA3168286A1 (en) Data flow processing method and system
EP3432159A1 (en) Garbage collection method and device
JPS61500751A (en) Method for stopping program processes in multiprocessing systems
CN106533805A (en) Micro-service request processing method, micro-service controller and micro-service architecture
EP1390848B1 (en) Task supervision
US11327794B2 (en) Periodic task execution in an automated context
CN111064789B (en) Data migration method and system
CN109697112B (en) Distributed intensive one-stop operating system and implementation method
CN108255515B (en) Method and device for realizing timer service
US10491452B2 (en) Method and system for clustered real-time correlation of trace data fragments describing distributed transaction executions
CN110618864A (en) Interrupt task recovery method and device
US10122602B1 (en) Distributed system infrastructure testing
CN102314382A (en) Method and module for emergently probing system information
CN114840318A (en) Scheduling method for preempting hardware key encryption and decryption resources through multiple processes
CN110532060B (en) Hybrid network environment data acquisition method and system
CN110287159B (en) File processing method and device
CN113268318A (en) Task scheduling method and distributed system
CN110928630A (en) Activation control method, device and equipment for application program window and storage medium
CN111767122A (en) Distributed task scheduling management method and device
CN101895519A (en) Service processing method and device
CN115190052A (en) Long connection management method, system and control unit
CN116450386A (en) Watchdog detection method, device and storage medium
CN115701584A (en) Thread determining method and device, storage medium and electronic device
CN111858177A (en) Method and device for repairing abnormality of interprocess communication, electronic 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