Rails background/async task requirement
We have a rails v2.3.8/apache/passenger application & have async requirements for some long running tasks. So I have been evaluating some solutions around rails/ruby, wanted to get feed back on some of the solutions.
Also I had one question - on how do the background tasks/workers get spawned. Given our rails app will run inside a apache/passenger container, does that mean the background/workers will also spawn a apache/passenger process/thread??
Is there only one worker thread/process that is launched, which would mean that the jobs will be processed serially or the jobs are processed in parallel? I come from java/j2ee background so I have good understanding of Message Beans/threading, but have no clue on how rails messaging solutions work?
Some of the parameters based on which we are evaluating the following solutions are - Performance/Scale, Distributed workers (running on separate nodes), Rails v3 support
Beanstalkd -> async-observer
Startling -> Workling
ActiveMQ(stomp) -> Workling/activeMessageing
开发者_JAVA百科Delayed JOB
Phusion Passenger only handles web requests. Background tasks are best handled by an external queue system. You've already mentioned some of them. These queue systems run as completely separate processes and don't affect any processes that Phusion Passenger manages.
I know it's a really late answer, but I am facing some issues that are probably worth taking into account.
With passenger's smart spawning, all connections have to be reset just after spawning a new thread. See http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_smart_spawning_gotcha_1_unintential_file_descriptor_sharing for reference.
This include also the connections to the queue. Be sure to reset them with the appropriate code in the
PhusionPassenger.on_event(:starting_worker_process) do |forked|
if forked
...
end
end if defined?(PhusionPassenger)
block.
精彩评论