Some quick and easy tips for making your README's pop!
Heroku is an excellent application platform that I personally use for all my Ruby and Node projects. Their free tier is enough to accomplish pretty much any task, but it comes with one giant limitation: your app will go to sleep after an hour of inactivity.
When your app is asleep, the next user to access any of its resources will have to wait while the app spins up, resulting in a suboptimal user experience. Here are a few ways to get around this limitation and keep your Heroku app awake.
Heroku is an invaluable resource for quickly deploying apps without having to do the dev-ops heavy lifting, allowing development to move fast. One of Heroku's great features is on-demand scaling of dynos (additional processes). To take advantage of those dynos, there are many job queueing gems available, the most popular being Resque. Heroku's ease of scaling up dynos combined with Resque's ease of using those dynos make the two a match made in heaven. Unfortunately, that's not the case.
So what's the problem?
The issues that we've encountered lie within Heroku's Cedar Stack, the most popular stack for Rails apps (now Heroku's new default!). Simply put, Heroku will kill your Resque workers.
There are many ways to cache data in a Rails application. (The official Rails Guide explains the different approaches well.) Heroku allows you to easily take advantage of Rails caching by connecting your application to Memcached servers through the Dalli client gem.
This drop in solution is simple, but there's one glaring problem. Memcache does not support expiring cache keys with regex. This means if you need to delete keys beginning with "user-1" but not keys beginning with "user-2", you're out of luck. Or so it seems...
A little known fact about Heroku's cedar platform is that it's capable of even more than advertised (and that's already a long list: Ruby, Node.js 0.4.7, Scala, Java, Clojure, Python/Django, etc). Here's how to customize a cedar "buildpack" to compile the latest version of Node.
- ← Previous
- Next →