question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow require times (between 2 to 3 seconds) of logging-bunyan when used with Firebase functions

See original GitHub issue

Environment 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:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ofrobotscommented, Nov 9, 2018

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.

0reactions
JustinBeckwithcommented, Feb 15, 2019

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: image

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found