Reputation: 1051
I need to develop multi-process application in Ruby: one master process manage several worker processes. Master creates (forks! I dont want multithreading, but multiprocessing) pull of workers and then asks database for new records to be processed periodically, and if any - send records to workers via pipes. When worker done its job it must notify master, so master can send to this worker another record to process. I cant find solution for notifications which workers can send to master, seems like it should be done in async, but IO pipes work in sync mode. Please, give me the direction to go? Any fork best practices in comments are also welcomed! Thank you.
PS. I dont want to use external solutions like EventMachine or Parallel, only forks.
Upvotes: 0
Views: 287
Reputation: 120
well i do realy think a MQ system is more suitable. master publish the job, works query and process the job.
rails also have a publish/subscription function see
http://api.rubyonrails.org/classes/ActiveSupport/Notifications.html
Upvotes: 2