如何处理Web服务器上的大量计划任务? [英] How to handle large amounts of scheduled tasks on a web server?

查看:138
本文介绍了如何处理Web服务器上的大量计划任务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个网站(使用LAMP堆栈),该网站必须处理许多用户制定的计划任务.它的工作方式如下:一个用户创建一个事件并设置一个日期,其他用户(多达63个)可以加入.在设置日期的几个小时之前,系统必须向每个订阅该事件的用户发送电子邮件.就是这样.

I'm developing a website (using a LAMP stack) which must handle many user-made scheduling tasks. It works as following: an user creates an event and sets a date, and others users (as many as 63) may join. A few hours before the set date, the system must email each user subscribed to that event. And that's it.

但是,我从未处理过调度,而且我唯一(很差地)知道的工具是cron和at.我的计划是为每个事件创建一个at job,它将调用一个脚本,该脚本获取所有订阅者的电子邮件并将其邮寄给他们.

However, I have never handled scheduling, and the only tools I know (poorly) are cron and at. My plan is to create an at job for each event, which will call a script that gets all subscribers emails and mails them.

我的问题是:我的计划/设计好吗?它可扩展吗?还有我应该注意的更好的选择吗?

My question is: is my plan/design good? Is it scalable? Are there better options that I should be aware of?

推荐答案

如果您考虑使用应用程序服务器(而不是简单的Web服务器)的适当框架,请使用简单的任务调度层.在服务器上安排作业确实比简单的LAMP安装所能完成的更多,但是我有一段时间没有使用PHP了,所以也许有一个等效的选择.

If you would consider a proper framework that uses an application server (and not a simple webserver), Spring has a task scheduling layer that's simple to use. Scheduling jobs on the server really requires more than what a simple LAMP install can do, but I haven't used PHP in a while so maybe there's an equivalent.

此处是一篇文章,比较了您的某些选项.

Here's an article that compares some of your options.

这篇关于如何处理Web服务器上的大量计划任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆