If you've been building stuff on web for a while now, you've probably heard of HEROKU and NETLIFY
Just-In-Case you haven't heard about it
Quick Intro on Heroku and Netlify
- Heroku: A free PaaS (Platform as a Service), basically a cloud service that let's you host and share your web apps.
- Netlify: A free hosting service for static sites, basically react, vanilla javascript, etc projects.
NETLIFY is Usually Used on Frontend Projects.
HEROKU is Usually Used on Backend Projects.
The Problem with Heroku
Pro's:
- Heroku is Easy to Use.
- Heroku is Free.
Con's:
- Heroku has Premium
Heroku's free tier uses dynos (Stuff That Hosts Your Code) that sleeps after 30 mins of inactivity
Once a dyno falls asleep, It takes time for it to awaken.
So the initial response is slow and the damage is already done.
Work Around
Re-Read This Line
Heroku's free tier uses dynos (Stuff That Hosts Your Code) that sleeps after 30 mins of inactivity
If You Haven't Got It Yet, Re-Read It Again
Heroku's free tier uses dynos (Stuff That Hosts Your Code) that sleeps after 30 mins of inactivity
💡Light Bulb💡
30 mins of inactivity
All We Need To Do is Do Something Every 30mins.
Nah 15mins to be on the safer side
For node.js dev(s) Out There
// Run Every 15 mins => 900 secs => 900000 ms
setInterval(()=>console.log("😂😜🤣🤓"),900000)
GGWP,
@LucidMach
✌
Your solution looks promising.
Although you didn't account for the pool of hours that your free-tier dyno has. This pool is limited to 550 hours per months. This seems big, but in fact it only represents a little more than 9 days. Largely before the end of the month though.
What this means is that by keeping the dyno constantly activated as you are suggesting, you will be running out of free dyno in 9 days.
If your application only has use for the first 9 days of each month this is a great solution though.
Worth noticing that you can increase this free-tier dyno pool by another 450 hours by adding a valid credit card. This will grant you a constant 16.5 days per month.
You better weight the pros and cons: sometimes, having a little more uptime is better than running out of free dyno and not having any uptime at all.
Just wanted to point that out but your technique is great for the other use-cases like a constant 9/16 days uptime per month.