Sabbatical dev

sabbatical devtechnical blog
 

Keep your serverless functions warm

With free cron jobs

Vercel is great IMHO, to get your start up off the ground. Vercel has serverless functions that have a free hobby option, meaning you can create your backend for free, but as you scale your backend can scale with you.

Whats not to love?

Well, with serverless functions comes the issue of the cold start

Excerpt From the post - "When a function in a cold state is invoked, the request will take additional time to be completed, because there’s a latency in starting up a new container. That’s the problem with cold starts: they make our application respond slower. In the “instant-age” of the 21st century, this could be a big problem"

If you have a application with many active users this really won't be much of an issue, but for a project where you are just getting off the ground, its likely your users will be hitting the function cold many times, problem being slow applications effect your user retention and bottom line

To fix this I decided to keep my functions warm by hitting my site with a request (I went with every 5 minutes, I seem to hardly ever hit a cold start with this rate) For this I needed a **cron job **

I started looking at solutions such as setting one up myself on render, but then stumbled across the focus of this post cron-job.org

A great free resource that allows you to set up a cron job in seconds, as many as you want for free!!

It also provides alerts for errors and for the next successful response sent to your email, keeping you in the loop of any issues.

Now my application is running warm and cosy.

Thanks cron-job.org,

If I manage to make money, ill be sending some your way!


Comments

Add a comment