我不确定 Rails 的最佳解决方案/实践是什么,所以我想我应该在这里问。
我需要有一个后台作业或某种每 5 分钟运行一次的服务来计算数万名用户(可能很快就会有数十万用户)的游戏排名。然后,将为每个需要确定排名的请求访问生成的数组。
这些天人们使用什么来实现此目的? cron 和 rake 任务?恶魔宝石? Resque 还是 Beanstalkd?
感谢您的聆听:)
I'm not sure what the best solution/practice is for Rails so I thought I'd ask here.
I need to have a background job or some kind of service that runs every 5 minutes to calculate the rankings for a game for tens of thousands of users, and possibly very soon, hundreds of thousands of users. The resulting array would then be accessed for each request that needs to determine a ranking.
What are people using these days for this? A cron and rake task? The daemon gem? Resque or Beanstalkd?
Thanks for listening :)
发布评论
评论(2)
上次我使用 Clockwork gem 和 Delayed_job 对于像你这样的问题
Last time I used Clockwork gem with Delayed_job for the problem like you have
我们对我们开发的应用程序有类似的要求。我们使用
whenever 来安排 cron 作业,并使用 delayed_job 用于后台处理。
When 会每 5 分钟触发一次 cron,这将有条件地将一个条目放入延迟作业队列中。
我们也可以使用 Resque。查看delayed_job 和resque 之间的比较,了解什么最适合您。
We had similar requirement for an application we developed. We used
whenever for scheduling cron jobs and delayed_job for background processing.
Whenever would trigger a cron every 5 minutes which would conditionally put an entry in the delayed job queue.
We could have also used Resque. Look at the comparison between delayed_job and resque to know what works best for you.