How can I track the recurring rake tasks performed by the hero planner?

I just got a heroin score last month, and the planned rake tasks were a relatively heavy burden. We are very early in the development process, so we just developed some rake tasks to do the job recently, and didn't really care about optimizing them.

Now we want to improve their performance and use them to use the hero’s clock. We use New Relic to monitor webapp performance, but apparently this type of rake task is ignored by default, and it's not clear how to override this.

Has anyone had a similar problem? How can I track planned tasks in close proximity to real time to monitor performance, optimize and not get surprises?

+4
source share
4 answers

While you cannot really control the tasks of rake, you can do a few little things. One of them is the use of a magazine. The start and end times for the output of tasks for logs, and you can see what happens for a long time. If you combine this with something like the Papertrail supplement, you can continue the additional interrogation.

As for starting the tasks themselves, there are several ways to start background processes, which depend on how they should be performed:

If you need to run tasks on a schedule, there are several options available. Firstly, the Heroku scheduler, which is pretty good, but does not guarantee that the execution will be completed. Typically, you would use this to run a rake task that will cause a one-time dynamic for the duration of the task, so you need to ensure that these tasks are as efficient as possible in development.

Alternatively, if you are looking at tasks that require a bit more control or use a clock process. In fact, it is a working 24/7 dinosaur that does nothing but launch other tasks at given intervals and time. This is usually done using a clockwork. The disadvantage of this approach is that you have to pay for the clock process all the time.

The third approach, and one that can work, is a delay with the runat task, which allows you to queue a task that will be launched in the future (and tasks can be reordered themselves). There are several problems with this, that failure can kill the whole chain, and you need a full-time job working to process them.

Therefore, to minimize your scores, make sure your rake tasks are just as efficient and reliable, and then choose the right planning option. If you look at schedules, as well as user-created events, delayed_job might be the best option. If you are viewing several tasks performed periodically, go to the scheduler. If you regularly gain a lot of time on important tasks, go with the clockwork.

In any case, you should be able to limit sufficient processing to only one or two processes, depending on your approach.

+7
source

when you work on a cedar hero, there is a way to get a free setup for your workers. this is not the answer to your monitoring question, but it can be interesting anyway: http://blog.nofail.de/2011/07/heroku-cedar-background-jobs-for-free/

0
source

You can force a new Relic agent in your rake tasks and report your performance data.

0
source

Not an answer to a specific question, but ... One of the ways to reduce overhead is to use the Unicorn server to attract several workers working on the same dino. It depends on your setup, but most people who have spent time testing it can comfortably get 3-4 workflows at a time. This is a huge boost in eliminating cues or tasks. Just be careful not to maximize the allocated memory for dyno.

0
source

Source: https://habr.com/ru/post/1394762/


All Articles