I have 5 Firebase Functions allocating 2GB of RAM each.
My question is simple: Does the Cold Start gets affected by the amount of RAM selected?
All my Firebase Functions NEVER exceed the 400MB ram, so, I could get the 2GB down to 1Gb or 512MB without any problem. If this improves the startup/cold-start time, I would do it.
Problem is that I can't measure it, due to there is no way to measure Cold Start time in Firebase Functions :/
CodePudding user response:
Firstly, there is a way to measure cold start time. Simply redeploy your function, and the next invocation will start cold on a new server instance. Old server instances can not be reused to execute new code. This is covered in the documentation. You can also use a web search to find out how others have made measurements.
Memory size does not directly affect cold start time. It is simply the amount of memory available to the server instance after it's started. However, note that more memory comes with better CPU, which in theory should reduce cold start time depending on how much code application code must load and execute on that first invocation. You should, of course, measure this in order to find out what the actual benefit is for your application, if any.