I have a rails application that currently includes a rake task that goes to a website and does some screen scraping and then creates several records in a table. When I run this particular script, it takes approximately 10 seconds to complete. This performance is too slow and doesn't meet my application requirements. (note: This performance was achieved running the rake task from the command line).

Question - If were to convert the rake task to a regular application method, should expect improved performance and if so, why?

有帮助吗?

解决方案

IMHO, split the rake task to regular runner apps would not improve the performance. It is because you still have to load up all components of rails and that's slow. I'd suggest you look into optimising your algorithmic logic.

If tasks that could not be run faster, you should run them as background jobs with DelayedJobs or Resque or cron.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top