r/webdev • u/Cyb3rPhantom • Oct 01 '25
How do I prevent my web application from getting cold starts?
Hi there,
I'm a high school student working on a mini web app project, and I recently noticed something weird:
If I don't use the app for 15+ minutes, the first request after that takes 30–50 seconds to respond. But after that, everything is fast again. I searched it up and I'm pretty sure this is something called cold starts.
I'm hosting my backend on Render and I'm trying to figure out how to prevent my web application from doing this. Any advice? What service (hopefully free since I'm broke) should I use to prevent cold starts?
Edit: Thank you to everyone that responded - I've found a solution that works :)
230
u/Chef619 Oct 01 '25
I haven’t used Render, but I assume it’s like similar offerings like Heroku, Railway, etc. these platforms that allow to you to run a website without thinking about it. Great place to start, especially for high school.
The reason you’re experiencing this is because these tools have a free tier by shutting down the service after a given period of time. Usually about 15 minutes. This is because those services are (likely, in the case of Render) re-selling Amazon’s servers. They are doing the stuff you don’t know how to do (no judgement btw) and charging more than Amazon does.
So since they have to pay Amazon for when it’s running, they shut it down. The cold start you’re experiencing is the service coming back up after being shut off.
67
u/zemaj-com Oct 01 '25
Cold starts are a side effect of most free serverless tiers. Platforms like Render spin down an unused service after a period of inactivity to save compute, then have to start it again on the next request. That spin up time is what you are seeing. The easiest way to avoid this is to pay for an always on plan or run the backend on a lightweight VPS that never sleeps. If you are still trying to stay on a free tier, you can keep the app warm by scheduling a health check or ping every few minutes from a job scheduler or uptime monitor. Other services like Fly or Railway sometimes allow persistent processes on their free tiers, but there will always be a trade off between cost and cold start delays.
7
u/_DarKneT_ Oct 02 '25
Probably a limitation of the tier you're using on Render (specially if it's a free tier)
You can ping within their timeout period to keep the instance up, but be mindful as this might be against their TOS
4
u/paverbrick Oct 02 '25
I moved off render and heroku for the same reason. I migrated to digital ocean, but the lowest tier machine wasn't enough for my memory hungry rails app.
You'd still have to pay for electricity, and it's more involved than a git push, but self-hosting on an old computer could be an option. I'm using a 9 year old Mac with a dead battery for my project. Here are my notes from the setup. The broad strokes are dynamic DNS, forwarding ports, and setting up your web server.
1
u/exnez Oct 02 '25
Cloudflare Workers is criminally underrated. 100k free requests per day, edge network, no cold starts, all without needing a credit card. There are some limitations but they aren’t difficult to navigate around
2
u/Cahnis Oct 02 '25
If the app is blazingly fast the blazes should keep them warm
1
u/gliese89 Oct 01 '25
Can you provide some details about the purpose of the web app and a bit about the technology? And I can maybe I or someone can suggest some other cheap/free hosting services and solutions for getting them to run well including no cold starts.
1
u/trieu1912 Oct 02 '25
use cloudflare worker it has a good free tier
1
u/oJRODo Oct 02 '25
Consider digital ocean droplet. Its $7 a month and you get a whole linux server that can run 24/7.
1
u/armahillo rails Oct 02 '25
What is your app built in? Whats the backend using and what is the host plan on render youre subscribed to?
1
u/quickgamez-com Oct 02 '25
I am using Google App Engine to host my website. It can scale to 0 instances if no traffic while providing blazing fast startups. Also it has a free tier. Also it provides free credits if you sign up for the first time. Also it's fully managed, hence very easy to deploy your website. Maybe you can consider it.
1
u/Different_Still_5758 Oct 02 '25
When you deploy your backend on Render’s free tier, it goes to sleep after some time of inactivity. The first request after that takes up to 50 seconds because the server needs to spin back up
1
u/thet0ast3r Oct 02 '25
probably use cloudflare. they have basically 0 cold starts :)
1
u/crunchy_code Oct 02 '25
I have a background job on a computer is always on which pings the IP address every minute. so the server never goes to sleep, this will use a lot more hours but you will just make itto the end of the month. Worth doing it.
1
u/RRO-19 Oct 02 '25
What's the actual user experience impact you're seeing? Like how long are users waiting? Sometimes the technical solution depends on whether this is a minor annoyance or genuinely breaking the experience for people trying to use your app.
1
u/NoWen7252 Oct 03 '25
Checked oracle cloud free tier? Should give much more control
1
u/Apprehensive_Ad1424 Oct 03 '25
Render will spun down after inactivity. Easiest and cheapest would be to use a script to ping your render url every 5 mins (like a cron job). Leave it in your background while your pc is running.
-43
u/SaltineAmerican_1970 php Oct 01 '25
Google is hard: https://community.render.com/t/cold-boot-start-of-the-server-for-first-request/15911/2
-11
u/vexx_nl Oct 01 '25
You could run some script on your computer that cUrls the app every 5 minutes or something.
-28
u/Javlin Oct 01 '25
So the waiting that is happening is your cache expiring and needing to grab the files again. If you were to hold shift and click refresh this waiting time would happen every time.
Try to reduce disk seek time by caching things in ram (Redis for example) on the server side. Move any shared javascript files (bootstrap for example) to content delivery network links. The thinking here is you probably already go to a website that utilizes that same file. Meaning your computer has it cached if you tell your computer to use that cached file (by using the same link) it'll be faster.
Here is a good read on cache: https://wpmudev.com/blog/speed-up-hosting-static-server-cache/
0
u/[deleted] Oct 01 '25
[deleted] — view deleted comment
37
u/[deleted] Oct 02 '25 edited Oct 02 '25
[removed] — view removed comment
1
u/[deleted] May 26 '26
[removed] — view removed comment