At the beginning of the Heroku Dino / Worker game

I have an application written in Rails deployed to Heroku. I used to work on one web dynode, but today I published the app, the traffic is quite big, so I decided to increase to 4 web speakers and 1 working dinosaur. I don't know why always when I do heroku ps

it shows:

Process   State           Command                            
--------  --------------  ---------------------------------  
web.1     up for 22s      bundle exec rails server -p $PORT  
web.2     up for 36s      bundle exec rails server -p $PORT  
web.3     up for 25s      bundle exec rails server -p $PORT  
web.4     up for 22s      bundle exec rails server -p $PORT  
worker.1  crashed for 7s  bundle exec rake jobs:work

      

After heroku scale worker=1

that, the worker dynamics fails. Logs are like:

2012-03-11T23:12:18+00:00 heroku[worker.1]: Starting process with command `bundle exec rake jobs:work`
2012-03-11T23:12:19+00:00 heroku[worker.1]: State changed from starting to up
2012-03-11T23:12:22+00:00 app[worker.1]: rake aborted!
2012-03-11T23:12:22+00:00 app[worker.1]: Don't know how to build task 'jobs:work'
2012-03-11T23:12:22+00:00 app[worker.1]: 
2012-03-11T23:12:22+00:00 app[worker.1]: (See full trace by running task with --trace)
2012-03-11T23:12:23+00:00 heroku[worker.1]: Process exited with status 1
2012-03-11T23:12:23+00:00 heroku[worker.1]: State changed from up to crashed
2012-03-11T23:12:23+00:00 heroku[worker.1]: State changed from crashed to created
2012-03-11T23:12:23+00:00 heroku[worker.1]: State changed from created to starting
2012-03-11T23:12:32+00:00 heroku[worker.1]: Starting process with command `bundle exec rake jobs:work`
2012-03-11T23:12:32+00:00 heroku[worker.1]: State changed from starting to up
2012-03-11T23:12:36+00:00 app[worker.1]: rake aborted!
2012-03-11T23:12:36+00:00 app[worker.1]: Don't know how to build task 'jobs:work'
2012-03-11T23:12:36+00:00 app[worker.1]: 
2012-03-11T23:12:36+00:00 app[worker.1]: (See full trace by running task with --trace)
2012-03-11T23:12:37+00:00 heroku[worker.1]: Process exited with status 1
2012-03-11T23:12:37+00:00 heroku[worker.1]: State changed from up to crashed

      

What is it. Do you know, why? The web speakers are working correctly. Do I need to configure something in my application to use the work speakers?

I would also appreciate it if you could explain to me in human words what is the logic behind dividing the hero platform into web and working dinosaurs? I have read the documentation several times, but I still think I am missing the point of understanding this as I grew up in a world where you had your own storage limit, etc.

+3


source to share


1 answer


Workers are used for background processing like sending email, fetching data from some web service, in general, for any task that takes a long time and you don't want your user to wait until she sees the page. opinion to use for performance, because if you use web dynodes to send like 10 emails, then the time they don't respond to the user's request, so you can't handle that many users.

Taks must be queued and workers must check to see that the queue is doing the job!

So, your worker breaks down because you have no assignments, so he may be waiting for queues at that job. Check out this gem for information on how to set up job and queue tasks.

https://github.com/defunkt/resque

Another thing is that workers can be used to schedule some kind of task, for example, cron jobs. Here is a stone to help you with this.



https://github.com/javan/whenever

I highly recommend you watch this video on RailsCasts

http://railscasts.com/episodes/171-delayed-job

http://railscasts.com/episodes/271-resque

+2


source







All Articles