Backgroundprocessing for Rails
Backgroundprocessing for Rails
- script/runner
- rake
- cron
- daemon
- run_later plugin
- spawn plugin
script/runner
- In Your Rails App root:
- script/runner “Worker.process”
rake
- In RAILS_ROOT/lib/tasks/dev.rake
rake dev:process
cron
- Cron is a time-based job scheduler in Unixlike computer operating systems.
- crontab -e
daemon_controller
- A library for robust daemon management
- Make daemon-dependent applications Just Work without having to start the daemons manually.
off-load task via system command
Simple Thread
run_later plugin
- Borrowed from Merb
- Uses worker thread and a queue
- Simple solution for simple tasks
spawn plugin
- By default, spawn will use the fork to spawn child processes. You can configure it to do threading.
- Works by creating new database connections in ActiveRecord::Base for thespawned block.
- Fock need copy Rails every time