6 Easy Ways to Prevent Your Heroku Node App From Sleeping

sleeping cat

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.

Read More

Heroku’s Cedar Stack will kill your Resque workers

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.

Don't let the kitten die.

Read More

Faking Regex-Based Cache Keys in Rails

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...

Read More