2

I am having issues with firebase function's long cold starts. I am using firebase function to server render the website but it is taking 20+ seconds to render the page when cold starting. Is there a specific duration for which the function is kept active before it is put to sleep so that I can use another scheduled function to activate this function periodically to prevent it from being put to sleep?

Akbar E K
  • 82
  • 7
  • 1
    The time-period that Cloud Functions keeps a contain warm is not explicitly defined but can be as short as a couple of minutes. Also see https://stackoverflow.com/q/48280187, https://medium.com/firebase-developers/organize-cloud-functions-for-max-cold-start-performance-and-readability-with-typescript-and-9261ee8450f0, https://mikhail.io/serverless/coldstarts/gcp/ – Frank van Puffelen Jul 19 '20 at 22:00
  • 1
    And: https://stackoverflow.com/q/51782742, https://www.youtube.com/watch?v=IOXrwFqR6kY, https://www.reddit.com/r/Firebase/comments/9iumal/solving_the_latency_of_cloud_functions_by_just/ – Frank van Puffelen Jul 19 '20 at 22:08
  • That's disappointing as each new instance will have a cold start penalty. Thanks anyway. – Akbar E K Jul 19 '20 at 22:15
  • 1
    During development you're likely to see cold starts more than usual. Once you get a reasonable flow of traffic, cold starts will become fairly uncommon as your users will keep the instance(s) warm. – Frank van Puffelen Jul 19 '20 at 22:18

0 Answers0