running fork in delayed job

别等时光非礼了梦想. 提交于 2019-12-24 10:48:53

问题


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.

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

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?


回答1:


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

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.. :]

so ensuring that there is god watching over the worker is important.

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



来源:https://stackoverflow.com/questions/13997807/running-fork-in-delayed-job

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!