4 ms·
Why didn't the Firebase minInstances work for you? I found amazing performance benefits, but at a $ cost. I actually forgot[1] a function to set a minInstance a
by gbourne 5y ago
Why didn't the Firebase minInstances work for you? I found amazing performance benefits, but at a $ cost. I actually forgot[1] a function to set a minInstance and a user complained that this particular functionality was slow (compare to the rest of the site). However, it isn't cheap.
You also want to be sure your code is optimized[2]. For example, don't require module packages unless the function needs it, else you're loading unnecessary packages. I usually set a global variable `let fetch;` and in the function that requires fetch initialize it `fetch = fetch ?? require("node-fetch);`.
[1] https://www.ayrshare.com/a-firebase-cloud-functions-cold-start-solution/ https://www.ayrshare.com/a-firebase-cloud-functions-cold-sta...
[2] https://firebase.google.com/docs/functions/tips https://firebase.google.com/docs/functions/tips
- tenaciousDaniel 5y agoNo idea why. Yeah we're trying all the usual techniques.