Should I have a heroku worker dyno for poll a AWS SQS?

Posted by Luccas on Server Fault See other posts from Server Fault or by Luccas
Published on 2012-11-28T16:00:05Z Indexed on 2012/11/28 17:06 UTC
Read the original article Hit count: 321

Filed under:
|
|

Im confusing about where should I have a script polling an Aws Sqs inside a Rails application.

If I use a thread inside the web app probably it will use cpu cycles to listen this queue forever and then affecting performance.

And if I reserve a single heroku worker dyno it costs $34.50 per month. It makes sense to pay this price for it for a single queue poll? Or it's not the case to use a worker for it?

The script code:

  queue = AWS::SQS::Queue.new(SQSADDR['my_queue'])    
  queue.poll(:idle_timeout => 20) do |msg|
     # code here
  end

I need help!! Thanks

© Server Fault or respective owner

Related posts about amazon-ec2

Related posts about ruby-on-rails