Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Cold start latency of 5+ seconds even after using the preferRest option for firebase-admin #2195

Open
HarshitPersona opened this issue May 26, 2023 · 2 comments

Comments

@HarshitPersona
Copy link

HarshitPersona commented May 26, 2023

I was getting a cold start latency of 5+ seconds while using firestore database. I came across this age old issue- https://issuetracker.google.com/issues/158014637 and the solution here- #1901 but even after implementing the solution as mentioned, I am still getting a latency of 5-6 seconds.

"firebase-admin": "^11.8.0" is the only dependencies I have.

Please find below my code snippet-
``
const { initializeApp } = require("firebase-admin/app");

const { initializeFirestore } = require("firebase-admin/firestore");

if (!isAlreadyInitialized) {
  const app = initializeApp();
  db = initializeFirestore(app, { preferRest: true });
  isAlreadyInitialized = true;
}

const query = db.collection("apps").where("apiKey", "==", apiKey);

const querySnapshot = await query.get();

``
Do let me know in case of any other queries.

@HarshitPersona
Copy link
Author

@alexander-fenster @lahirumaramba can you please help on this

@johnnyoshika
Copy link

I'm also still seeing slow cold starts (> 5 seconds) after implementing preferRest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants