简体   繁体   中英

.NET scheduler class architecture

We are developing a custom scheduler class, that should be able to invoke tasks periodically.

We are thinking of two possible approaches:

  1. For each task, that has period of X seconds, create its own timer with interval equal to task's period, or

  2. Create one timer, and on each its tick recalculate its interval, iterating all tasks and finding one that is the most close in time?

The first approach seems to be more simple and straightforward, but I do not know if creating of 10 or 20 timers is expensive.

How do you think, which one is better from the performance point of view?

What about using an existing scheduling library like Quartz.net?

Quartz.NET is a full-featured, open source job scheduling system that can be used from smallest apps to large scale enterprise systems. Quartz.NET is a pure .NET library written in C# and is a port of very propular open source Java job scheduling framework, Quartz . This project owes very much to original Java project, it's father James House and the project contributors.

http://quartznet.sourceforge.net/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM