简体   繁体   English

Sitecore计划任务与Windows任务计划程序进行数据迁移

[英]Sitecore Scheduled Tasks vs Windows Task Scheduler for data migration

We need to migrate data from an external database to Sitecore periodically (every 12 or 24 hours). 我们需要定期(每12或24小时)将数据从外部数据库迁移到Sitecore。 I would like to know whether creating a Sitecore Scheduled Task is what one can opt for in such a scenario. 我想知道创建Sitecore计划任务是否可以在这种情况下选择。 I would also like to know the performance impact it can have on the website. 我也想知道它对网站的性能影响。

Since I can also build an external app for this activity that doesn't rely on the IIS worker process and schedule the same using a Windows Task scheduler, I would like to know the benefits and drawbacks of both approaches. 由于我还可以为此活动构建一个不依赖于IIS工作进程并使用Windows任务调度程序安排相同活动的外部应用程序,因此我想知道这两种方法的优点和缺点。

The obvious answer to this is "it depends" but that's a cop out answer that drives me crazy when people use it. 对此的明显答案是“它取决于”,但这是一个警察的答案,当人们使用它时会让我发疯。

A scheduled task in Sitecore will have access to the full Sitecore API, so if you are doing data manipulation of Sitecore items, this can be really attractive. Sitecore中的计划任务将可以访问完整的Sitecore API,因此如果您正在对Sitecore项目进行数据处理,这可能非常有吸引力。 Jobs also run on background threads, so it does have a large impact on the website, but obviously if you exhaust all of threads the worker process is configured to use, that will be an issue, but a very small outside one at best. 乔布斯也运行在后台线程上,因此它确实对网站产生了很大的影响,但显然如果你耗尽了工作进程配置使用的所有线程,那将是一个问题,但最好是一个非常小的外部线程。

The drawback to a Sitecore scheduled task is they cannot be scheduled at a finite time. Sitecore计划任务的缺点是无法在有限时间安排它们。 IOW - "run this task at 3am every day" is not possible, tasks run on an interval basis. IOW - “每天凌晨3点运行此任务”是不可能的,任务以间隔为基础运行。 Might sound like a trivial difference, just schedule it to run every 24 hours, but in practice the interval inevitably drifts. 可能听起来像一个微不足道的差异,只是安排它每24小时运行一次,但在实践中间隔不可避免地漂移。 This is the big advantage Windows Scheduled tasks have. 这是Windows计划任务的最大优势。 If most of the work you need to do is not related to Sitecore, then this be a good approach. 如果您需要做的大部分工作与Sitecore无关,那么这是一个很好的方法。 I've seen hybrid approaches where a Windows scheduled task triggers a call to Sitecore, which uses the jobs API to kick off a background task, but it never felt that elegant. 我见过混合方法,其中Windows计划任务触发对Sitecore的调用,后者使用作业API启动后台任务,但它从未感觉到优雅。

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

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