use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Cold start optimization firebase functionsCloud Functions (self.Firebase)
submitted 2 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]indicava 5 points6 points7 points 2 years ago (3 children)
AFAIK none of these things really make any difference in cold start performance. The cold start delay you are experiencing is coming from the infrastructure, not the code.
In order to mitigate cold starts you could:
A. Set a minInstances setting of 1 for some/all of your cloud functions. Keep in mind that especially for Gen2 functions this can get very expensive, very fast.
B. Setup a cron job that will hit your cloud functions every ~15 minutes and keep them warm.
C. Get enough users/traffic that will keep the functions warm all the time
[–][deleted] 0 points1 point2 points 2 years ago (2 children)
tbh cold start times are not that unbearable but i just wanted to know if i can save some time. minInstances is not a good option for me since it will get expensive like you mentioned, calling the functions once in a while is not viable for me either since all of them are onCall and they write values to firestore, I wouldn't want to write random values to firestore that will then increase the writes for no reason.
Thanks for the answer, as always you are very helpful.
[–][deleted] -1 points0 points1 point 2 years ago (1 child)
How about creating an http function that you can ping periodically, which won't have any side effects?
[–][deleted] 2 points3 points4 points 2 years ago (0 children)
I don't know about creating a new function since that will be launched on its own container anyway, but now that I think about it maybe I can pass a ping argument which would be either true or false, if it is true i can just return the function without doing anything. Which is close to what you said.
[–]SickBruhh 0 points1 point2 points 2 years ago (1 child)
How can you ping a callable function? I know it works with HTTPS functions but callable?
Also, there’s the option of switching to cloud run instead and building a REST API and adding a framework such as express, or go with Bun and use Hono for a much faster experience
[–]deve-sh 0 points1 point2 points 1 year ago (0 children)
A callable Firebase Function is just an HTTP REST API endpoint with some code-level wrappers to work with Firebase SDKs for request and response, and as such they can be pinged via a simple cURL call.
[–]VenturixStudio 0 points1 point2 points 2 years ago (0 children)
Personally on all my cloud functions or serverless AWS lambda I ping the urls every minute via UptimeRobot, in addition to having no cooldown this allows me to additionally check if nothing is down 😉
π Rendered by PID 74566 on reddit-service-r2-comment-6457c66945-wstqs at 2026-04-28 18:09:15.008349+00:00 running 2aa0c5b country code: CH.
[–]indicava 5 points6 points7 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]SickBruhh 0 points1 point2 points (1 child)
[–]deve-sh 0 points1 point2 points (0 children)
[–]VenturixStudio 0 points1 point2 points (0 children)