Skip to content

Instantly share code, notes, and snippets.

@barek2k2
Created May 5, 2013 14:49
Show Gist options
  • Save barek2k2/5521021 to your computer and use it in GitHub Desktop.
Save barek2k2/5521021 to your computer and use it in GitHub Desktop.
Parallel processing on Ruby On Rails using fork
fork do
ActiveRecord::Base.establish_connection
for i in 0..20000
puts 'I m in sub process-1'
end
exit
end
fork do
ActiveRecord::Base.establish_connection
for i in 2001..40000
puts 'I m in sub process-2'
end
exit
end
.......
fork do
ActiveRecord::Base.establish_connection
for i in 40000..N
puts 'I m in sub process-M'
end
exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment