How can I keep Google Cloud Functions warm?

前端 未结 5 1992
自闭症患者
自闭症患者 2020-11-30 08:48

I know this misses the point of using Cloud Functions in the first place, but in my specific case, I\'m using Cloud Functions because it\'s the only way I can bridge Next.js

5条回答
  •  孤城傲影
    2020-11-30 09:26

    With all "serverless" compute providers, there is always going to be some form of cold start cost that you can't eliminate. Even if you are able to keep a single instance alive by pinging it, the system may spin up any number of other instances to handle current load. Those new instances will have a cold start cost. Then, when load decreases, the unnecessary instances will be shut down.

    There are ways to minimize your cold start costs, as you have discovered, but the costs can't be eliminated.

    If you absolutely demand hot servers to handle requests 24/7, then you need to manage your own servers that run 24/7 (and pay the cost of those servers running 24/7). As you can see, the benefit of serverless is that you don't manage or scale your own servers, and you only pay for what you use, but you have unpredictable cold start costs associated with your project. That's the tradeoff.

提交回复
热议问题