Multi threading in heroku rails3 project?

I am using multi Threading concept to optimize performance of long
array which takes long time to do action with every element. I
used .peach in my code

require ‘peach’
def fr_display
@graph =[:fbuser]

@friends = @graph.get_connections("me", "friends")
   @friends.peach do |friend|

rescue StandardError => e


but in heroku deployment it is not running and showing error in error
log that New Thread is unable to create.

any solution to work with Multi threading in rails 3 heroku project or
optimize performance without using multi threading.

Thank You in advance

This is what background workers are good for. On heroku your choices are
delayed job and resque (which I prefer) or you might want to use, which is a great solution and scales better.

Thank You for your valuable submission. I will follow the document of and try.