在延迟的工作中运行叉子 [英] running fork in delayed job

查看:84
本文介绍了在延迟的工作中运行叉子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在Web应用程序中使用了延迟的工作,我们需要并行处理多个延迟的工作,但是我们不知道需要多少工作。

we use delayed job in our web application and we need multiple delayed jobs workers happening parallelly, but we don't know how many will be needed.

解决方案i当前尝试运行一名工作人员,并在所需任务中调用fork / Process.detach。

solution i currently try is running one worker and calling fork/Process.detach inside the needed task.

我以前曾尝试直接在rails应用程序中运行fork,但它对乘客的运行效果不太好。

i was trying to run fork directly in rails application previously but it didnt work too good with passenger.

此解决方案似乎效果很好。

this solution seems to work well. could there be any caveats in production?

推荐答案

今天发生在我身上的一个问题,任何试图解决的问题是以下内容:

one issue which happened to me today and which anyone trying that should take care of was following:

我注意到工人掉了下来,所以我开始了。我没有想到的是,有70个工作在排队等待。并且由于进程是分叉的,因此几乎立即启动所有进程并消耗进程中的所有内存,它们几乎杀死了我们的服务器约半小时。::

i noticed that worker is down so i started it. something i didnt think about was that there were 70 jobs waiting in queue. and since processes are forked, they pretty much killed our server for around half an hour by starting all almost immediately and eating all memory in process.. :]

工人似乎也经常死亡,但不确定是否与分叉有关。

also worker seems to die often but not sure yet if its connected with forking.

这篇关于在延迟的工作中运行叉子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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