简体   繁体   English

.NET调度程序类体系结构

[英].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 对于周期为X秒的每个任务,创建其自己的计时器,其间隔等于任务的周期,或者

  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. 第一种方法似乎更简单明了,但是我不知道创建10或20个计时器是否昂贵。

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)如何?

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是功能齐全的开源作业调度系统,可用于最小的应用程序到大型企业系统。 Quartz.NET is a pure .NET library written in C# and is a port of very propular open source Java job scheduling framework, Quartz . Quartz.NET是用C#编写的纯.NET库,并且是非常实用的开源Java作业调度框架Quartz的端口。 This project owes very much to original Java project, it's father James House and the project contributors. 这个项目很大程度上归功于原始的Java项目,它是父亲James House和项目贡献者。

http://quartznet.sourceforge.net/ http://quartznet.sourceforge.net/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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