Slow require times (between 2 to 3 seconds) of logging-bunyan when used with Firebase functions
See original GitHub issueEnvironment details
- OS: Firebase functions
- Node.js version: 6.11.5
- npm version: yarn 1.9.4
@google-cloud/logging-bunyan
version: 0.8.2
Steps to reproduce
I am seeing particularly long cold start times consistently with Firebase functions and so did some basic instrumentation about which requires were the most time consuming. I’m seeing the time needed to require logging-bunyan
to be consistently between 2 and 3 seconds when deployed to Firebase, but when running in local emulator to be around 200ms.
I’ve also seen some intermittent errors causing the function to crash due to Error: 14 UNAVAILABLE: TCP Read failed
https://github.com/GoogleCloudPlatform/google-cloud-node/issues/2438#issuecomment-412200264
Not sure if they’re related but I’m wondering if there’s some underlying connectivity issue causing these long require times on firebase.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Firebase cloud functions is very slow - node.js - Stack Overflow
js app, hosted on appengine container. The time has come down to 2-3 seconds. I have been comparing many of the features of...
Read more >Quotas and limits | Cloud Functions for Firebase - Google
Quotas for Google Cloud Functions encompass 3 areas: ... The maximum amount of time a function can run before being forcibly terminated, 540...
Read more >How to monitor errors and performance in Cloud Functions ...
Cloud Functions for Firebase makes it easy to build and deploy a serverless backend for your app. But did you know that Cloud...
Read more >Long cold start times for Node.js programs with gRPC ...
My use case is straightforward just a Firebase project using cloud functions, in a function that onlyt returns a timestamp I'm getting cold...
Read more >How to stop restarting Firebase Functions each request?
I'm developing Actions on Google and use Firebase Functions to host Node.js ... in the app between session (what took about 2-3 seconds)....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did a require-time profile of this library (v0.9.4) using require-so-slow. It seems that the library takes 344ms to require. 340ms out of that spend requiring
@google-cloud/logging
. Profile can be viewed here.I am going to move this issue over to the logging library.
Good news! We’ve cut this down ever further. We’re now down to about 250ms of time to load. As we move towards a native http2 implementation in grpc in the next few months, it will get even better:
One thing you want to be really careful about - how do you instantiate your logging objects? Where you instantiate the client (inside of the function or outside) makes a VERY bug difference on how long it will take to first load.
Given the fact that we’re down pretty low on the require time, with a plan to improve more, I’m going to close this out for now. If folks are still seeing something you want us to look into - please let me know!