{"id":3,"date":"2010-02-09T02:44:27","date_gmt":"2010-02-09T02:44:27","guid":{"rendered":"http:\/\/blog.railsware.com\/?p=3"},"modified":"2023-11-01T15:54:19","modified_gmt":"2023-11-01T12:54:19","slug":"background-jobs-evolution","status":"publish","type":"post","link":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/","title":{"rendered":"Background jobs evolution: Rake, custom daemons, Resque"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Background Rake tasks<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When we start one of our projects there&nbsp;is always&nbsp;the need for some&nbsp;background tasks: updating online\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.<br>The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their&nbsp;use using Cron. It is easy to implement, easy to test (just run a Rake task), and we used a perfect <a href=\"http:\/\/github.com\/javan\/whenever\">Whenever<\/a> gem for defining those Cron jobs with a clean Ruby syntax.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As our&nbsp;projects progressed, the&nbsp;number of background tasks increased. Most of our Rake tasks had one great disadvantage: they were dependent on Rails itself, and so every time we launched those tasks new Rails instances were initialized. It was&nbsp;OK for us to have Rake jobs, each of which takes, let&#8217;s say, 5-7 seconds and 100mb of RAM to initialize Rails and then less than a few seconds for doing the job itself, because we had just 2-3 jobs per hour.<br>Once we got about 3-4 different tasks running, each 5-10 seconds for every job, Rails initialization time and its memory consumption became a problem. So we had to use find a thriftier solution.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Custom Ruby daemons<\/h3>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\">Custom Ruby daemons (as were shown in <a href=\"http:\/\/railscasts.com\/episodes\/129-custom-daemon\">Railscast<\/a> by Ryan Bates) seemed a good alternative to the Rake and Cron combination. We just moved scheduling from Cron to daemon classes and pulled task calls there from Rake tasks. So we ended up with a few daemons, each for a group of background tasks (it&#8217;s possible to put all the tasks into a single daemon, but this will complicate daemon logic dramatically). We also found it useful to&nbsp;use Cron for restarting deamons a few time per day as&nbsp;a way to fight Ruby memory bloats.<br>This solution was quite resource-friendly, but brought a lot of drawbacks:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Daemons gem (or its launcher) was quite buggy. For example, it didn&#8217;t restart daemons properly: after each restart previous daemons were not unloaded from the memory.<\/li>\n\n\n\n<li>Debugging these daemons is hard as hell!<\/li>\n\n\n\n<li>Sometimes daemons died or become frozen unexpectedly, so we had to use a <a href=\"https:\/\/betterstack.com\/community\/comparisons\/cloud-monitoring-tools\/\" title=\"monitoring tool\">monitoring tool<\/a> (God) for checking daemon health and restarting it when needed, instead of general Cron restarts.<\/li>\n\n\n\n<li>It was impossible to check job progress and statistics without implementing additional logic in daemon and\/or web app.<\/li>\n\n\n\n<li>The solution was not scalable out of the box, and&nbsp;we had to implement&nbsp;a type&nbsp;of job queue logic if we wanted to distribute daemons into different server nodes.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">But still&nbsp;we were a manly men: we struggled, we fought the bugs and found some workarounds, we were even ready to build statistics support and a job queue into our daemons.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/www.flickr.com\/photos\/le_haricot\/132869163\/\"><img decoding=\"async\" src=\"\/\/farm1.static.flickr.com\/51\/132869163_3a547ea876.jpg\" alt=\"Job Queue\"\/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Yet, soon our project required a different type of asynchronous tasks \u2014 nonscheduled ones. I mean nonrecurring tasks that have to be addressed&nbsp;ASAP. Usually&nbsp;this means&nbsp;slow controller actions that can be offloaded from Rails to speed up request handling, for example actions that require remote API calls for rendering a page part.<br>That was a turning point, because we decided to stop just being manly men and to start being a little smarter. We had to improve our daemons or pick a solution that didn&#8217;t require us to reinvent the wheel, for example, by&nbsp;taking existing background jobs solutions like Workling or Delayed Job.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Resque rescued us from pain<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Luckily, Github at about that time released their Resque tool inspired by Delayed Job (but more advanced) and based on Redis database&nbsp;for its&nbsp;job queue. Resque suited our needs very well. We picked it instead of a custom daemon and finally become happy!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">So, why do we love resque so much?<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>It just works!<\/li>\n\n\n\n<li>It uses Redis as the job queue storage, and&nbsp;Redis is blazing fast.<\/li>\n\n\n\n<li>It supports multiple job queues and queue priorities.<\/li>\n\n\n\n<li>Horizontal scaling is a peace of cake: you can just spread the workers over your server nodes.<\/li>\n\n\n\n<li>Resque is lightweight, and the code is extremely well documented. So there is always no mystification about &#8220;why it work this way, not that way?&#8221; \u2014 you can analyze all the Resque source code in less than an hour.<\/li>\n\n\n\n<li>It has a nice rack-compatible application for tracking jobs and workers&#8217; statistics built in. In addition you can just plug in&nbsp;HopToad (using instructions in the Resque source code) to track worker errors.<\/li>\n\n\n\n<li>As&nbsp;previously mentioned,&nbsp;Resque is lightweight and extremely well documented, so it is easy to extend! Just fork it on to GitHub and do whatever you want.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">OK, I see. So, what&#8217;s bad about Resque?<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li>It uses Redis&nbsp;for the job queue storage. There is no clean way of using Redis as a cluster database at this moment, just a master-slave replication. So Redis may&nbsp;constitute a&nbsp;single point of failure unless you have additional failover logic in your application.<\/li>\n\n\n\n<li>Workers are pure Ruby. So you still need to deal with its monitoring with God, Monit or another monitoring tool.<\/li>\n\n\n\n<li>And as a pure Ruby tool Resque is not quite suited for multi-technology enterprise environments where you&#8217;ll prefer setting tasks as huge XML documents. Anyway, you can achieve this weird stuff with some small workarounds &#8230; remember? Resque is easy to extend!<\/li>\n\n\n\n<li>It doesn&#8217;t have any scheduling mechanism for scheduling task processing for specific times or time periods. Again, you can fix this&nbsp;by using cron and adding a few lines of code to your app. I&#8217;ll show you.<\/li>\n<\/ol>\n\n\n\n<h4 class=\"wp-block-heading\">How do we use it?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">There are two types of tasks settings. The&nbsp;first one is for non-reccuring tasks: workers are using Rails, and tasks are queued&nbsp;directly from the rails app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The second&nbsp;type of tasks are recurring tasks that&nbsp;need to&nbsp;be scheduled. We use a special Rails controller for putting tasks outside of the main application. Restful HTTP client (launched as a Cron job) enqueues tasks on Resque. However, some people may&nbsp;consider this overengineering,&nbsp;since even&nbsp;a&nbsp;CURL-based client may be enough.<br>Whenever gem is used for managing Cron schedules of reccuring tasks. [Not sure about the logic of this sentence. The use of Gem triggers Cron scheduling for recurring tasks? Can we clarify? Thanks.]<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Resque and PostgreSQL<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There is an issue if you use PostgreSQL database and access it via ActiveRecord from Resque workers. It looks like Resque forks its workers and tries&nbsp;to reuse the same PostgreSQL connection, while PostgreSQL does not allow&nbsp;the use of&nbsp;the same connection from different processes. Of course, you can modify the Resque source code or tweak its workers but we found&nbsp;a much&nbsp;easier workaround: <a href=\"http:\/\/pgpool.projects.postgresql.org\/\">PgPool-II<\/a> for PostgreSQL connection pooling.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What are the&nbsp;alternatives?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Guys at a Ratepoint have much higher loads and require more flexibility. So they implemented their own amqp-consuming daemons based on a Daemon-kit Gem, Nanite and RabbitMQ as a job queue. And I know that&nbsp;they are quite happy with this custom solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Background Rake tasks When we start one of our projects there&nbsp;is always&nbsp;the need for some&nbsp;background tasks: updating online\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their&nbsp;use using Cron. It is easy to implement,&#8230;<\/p>\n","protected":false},"author":1,"featured_media":3764,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[3],"tags":[],"coauthors":["admin"],"class_list":["post-3","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development"],"acf":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Background Rake tasks When we start one of our projects there is always the need for some background tasks: updating online\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their use using Cron. It is easy to implement,\" \/>\n\t<meta name=\"robots\" content=\"max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n\t<meta name=\"author\" content=\"admin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/railsware.com\/blog\/background-jobs-evolution\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"| Blog on Engineering, Product Management, Transparency, Culture and many more...\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Background jobs evolution: Rake, custom daemons, Resque | Railsware Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Background Rake tasks When we start one of our projects there is always the need for some background tasks: updating online\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their use using Cron. It is easy to implement,\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/railsware.com\/blog\/background-jobs-evolution\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2010\/02\/queue.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2010\/02\/queue.png\" \/>\n\t\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2010-02-09T02:44:27+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2023-11-01T12:54:19+00:00\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#article\",\"name\":\"Background jobs evolution: Rake, custom daemons, Resque | Railsware Blog\",\"headline\":\"Background jobs evolution: Rake, custom daemons, Resque\",\"author\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/02\\\/queue.png\",\"width\":150,\"height\":150},\"datePublished\":\"2010-02-09T02:44:27+03:00\",\"dateModified\":\"2023-11-01T15:54:19+03:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#webpage\"},\"articleSection\":\"Engineering, rwwpadmin\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/railsware.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"name\":\"Engineering\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"position\":2,\"name\":\"Engineering\",\"item\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#listItem\",\"name\":\"Background jobs evolution: Rake, custom daemons, Resque\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#listItem\",\"position\":3,\"name\":\"Background jobs evolution: Rake, custom daemons, Resque\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/category\\\/development\\\/#listItem\",\"name\":\"Engineering\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\",\"description\":\"Blog on Engineering, Product Management, Transparency, Culture and many more...\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/11\\\/Logo-circle.png\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#organizationLogo\",\"width\":3137,\"height\":1054,\"caption\":\"Railsware logo\"},\"image\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#organizationLogo\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/admin\\\/\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/abf28f86197874db174d645f9b5e5556ddf31ab51cb9f63f2d8b6c954729937f?s=96&d=https%3A%2F%2Frailsware.com%2Fblog%2Fwp-content%2Fuploads%2F2025%2F03%2Fdefault-avatar.png&r=g\",\"width\":96,\"height\":96,\"caption\":\"admin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#webpage\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/\",\"name\":\"Background jobs evolution: Rake, custom daemons, Resque | Railsware Blog\",\"description\":\"Background Rake tasks When we start one of our projects there is always the need for some background tasks: updating online\\\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their use using Cron. It is easy to implement,\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/author\\\/admin\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/wp-content\\\/uploads\\\/2010\\\/02\\\/queue.png\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#mainImage\",\"width\":150,\"height\":150},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/background-jobs-evolution\\\/#mainImage\"},\"datePublished\":\"2010-02-09T02:44:27+03:00\",\"dateModified\":\"2023-11-01T15:54:19+03:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/railsware.com\\\/blog\\\/\",\"description\":\"Blog on Engineering, Product Management, Transparency, Culture and many more...\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/railsware.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Background jobs evolution: Rake, custom daemons, Resque | Railsware Blog","description":"Background Rake tasks When we start one of our projects there is always the need for some background tasks: updating online\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their use using Cron. It is easy to implement,","canonical_url":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/","robots":"max-snippet:-1, max-image-preview:large, max-video-preview:-1","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#article","name":"Background jobs evolution: Rake, custom daemons, Resque | Railsware Blog","headline":"Background jobs evolution: Rake, custom daemons, Resque","author":{"@id":"https:\/\/railsware.com\/blog\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/railsware.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2010\/02\/queue.png","width":150,"height":150},"datePublished":"2010-02-09T02:44:27+03:00","dateModified":"2023-11-01T15:54:19+03:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#webpage"},"isPartOf":{"@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#webpage"},"articleSection":"Engineering, rwwpadmin"},{"@type":"BreadcrumbList","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/railsware.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","name":"Engineering"}},{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","position":2,"name":"Engineering","item":"https:\/\/railsware.com\/blog\/category\/development\/","nextItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#listItem","name":"Background jobs evolution: Rake, custom daemons, Resque"},"previousItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#listItem","position":3,"name":"Background jobs evolution: Rake, custom daemons, Resque","previousItem":{"@type":"ListItem","@id":"https:\/\/railsware.com\/blog\/category\/development\/#listItem","name":"Engineering"}}]},{"@type":"Organization","@id":"https:\/\/railsware.com\/blog\/#organization","description":"Blog on Engineering, Product Management, Transparency, Culture and many more...","url":"https:\/\/railsware.com\/blog\/","logo":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2020\/11\/Logo-circle.png","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#organizationLogo","width":3137,"height":1054,"caption":"Railsware logo"},"image":{"@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#organizationLogo"}},{"@type":"Person","@id":"https:\/\/railsware.com\/blog\/author\/admin\/#author","url":"https:\/\/railsware.com\/blog\/author\/admin\/","name":"admin","image":{"@type":"ImageObject","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/abf28f86197874db174d645f9b5e5556ddf31ab51cb9f63f2d8b6c954729937f?s=96&d=https%3A%2F%2Frailsware.com%2Fblog%2Fwp-content%2Fuploads%2F2025%2F03%2Fdefault-avatar.png&r=g","width":96,"height":96,"caption":"admin"}},{"@type":"WebPage","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#webpage","url":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/","name":"Background jobs evolution: Rake, custom daemons, Resque | Railsware Blog","description":"Background Rake tasks When we start one of our projects there is always the need for some background tasks: updating online\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their use using Cron. It is easy to implement,","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/railsware.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#breadcrumblist"},"author":{"@id":"https:\/\/railsware.com\/blog\/author\/admin\/#author"},"creator":{"@id":"https:\/\/railsware.com\/blog\/author\/admin\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2010\/02\/queue.png","@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#mainImage","width":150,"height":150},"primaryImageOfPage":{"@id":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/#mainImage"},"datePublished":"2010-02-09T02:44:27+03:00","dateModified":"2023-11-01T15:54:19+03:00"},{"@type":"WebSite","@id":"https:\/\/railsware.com\/blog\/#website","url":"https:\/\/railsware.com\/blog\/","description":"Blog on Engineering, Product Management, Transparency, Culture and many more...","inLanguage":"en-US","publisher":{"@id":"https:\/\/railsware.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"| Blog on Engineering, Product Management, Transparency, Culture and many more...","og:type":"article","og:title":"Background jobs evolution: Rake, custom daemons, Resque | Railsware Blog","og:description":"Background Rake tasks When we start one of our projects there is always the need for some background tasks: updating online\/offline user counts, doing some remote API calls, fetching a fresh version of GeoIP database, etc.The easiest and most straightforward solution was the creation of appropriate Rake tasks and scheduling their use using Cron. It is easy to implement,","og:url":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/","og:image":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2010\/02\/queue.png","og:image:secure_url":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2010\/02\/queue.png","og:image:width":150,"og:image:height":150,"article:published_time":"2010-02-09T02:44:27+00:00","article:modified_time":"2023-11-01T12:54:19+00:00"},"aioseo_meta_data":{"post_id":"3","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":{"id":"aioseo-article-6385f5afbec5a","slug":"article","graphName":"Article","label":"Article","properties":{"type":"BlogPosting","name":"#post_title","headline":"#post_title","description":"#post_excerpt","image":"","keywords":"","author":{"name":"#author_name","url":"#author_url"},"dates":{"include":true,"datePublished":"","dateModified":""}}},"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"}}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-01-04 12:44:07","updated":"2025-09-26 11:11:39","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/railsware.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/railsware.com\/blog\/category\/development\/\" title=\"Engineering\">Engineering<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tBackground jobs evolution: Rake, custom daemons, Resque\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/railsware.com\/blog"},{"label":"Engineering","link":"https:\/\/railsware.com\/blog\/category\/development\/"},{"label":"Background jobs evolution: Rake, custom daemons, Resque","link":"https:\/\/railsware.com\/blog\/background-jobs-evolution\/"}],"reading_time":"4 min read","categories_data":[{"name":"Engineering","link":"https:\/\/railsware.com\/blog?category=development"}],"post_thumbnails":"https:\/\/railsware.com\/blog\/wp-content\/uploads\/2010\/02\/queue.png","article_background":"","amp_enabled":true,"_links":{"self":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/3","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/comments?post=3"}],"version-history":[{"count":21,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/3\/revisions"}],"predecessor-version":[{"id":16643,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/posts\/3\/revisions\/16643"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media\/3764"}],"wp:attachment":[{"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/media?parent=3"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/categories?post=3"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/tags?post=3"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/railsware.com\/blog\/wp-json\/wp\/v2\/coauthors?post=3"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}