You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extreme Latency when Using Google Cloud Functions and Cloud Datastore #2374
ghost changed the title [-]Extreme Latency when Using Google Cloud Functions[/-][+]Extreme Latency when Using Google Cloud Functions and Cloud Datastore[/+]on Jun 10, 2017
since when using cloud functions, the penalty is incurred on each http invocation the overhead is still very high (i.e. 0.8s per HTTP call).
Yes, unfortunately. I'll close the issue, as we can't do anything within the client library. If any ideas come to mind for how this can be addressed, feel free to discuss.
@stephenplusplus - We are running into the same issue. Datastore and Functions seem like the perfect combination, paying only a per-request cost. However the latency is much too high to be usable in real-world.
As was mentioned, it is related to the Auth.
This problem must be solvable, as other similar systems such as Lambda + DynamoDB don't under into this issue.
It seems unlikely to be implemented in node, but probably some setup on the function/lambda that is 'pre-authenticated' (AWS IAM roles?).
Who would be the correct team/repo to work on this issue?
Reacted by Tor Öhrn, Roberto, rdtr, Christof Haemmerle, Kristian Zhelyazkov, Ali Baharev, Filipe Tavares, Adam Bittlingmayer, Chris Barton, Arjun Mehta and 10 more
@ro-savage we were/are using app engine with datastore. we also did run in to big issues with the latency of the datastore. would love to hear some updates @google-admin about this issue.
A few weeks into development, we're finding Datastore to not be a viable solution for use in Functions due to the consistently poor performance on even very simple queries. 4000ms on first (authenticating) request, and then 800-1200ms afterwards.
Reacted by David Fierro, Kristian Zhelyazkov, Christof Haemmerle, Filipe Tavares, Adam Bittlingmayer, josecaodaglio, WaldoJeffers, EJB3927, Dima Dermanskyi, Chris Barton and 8 more
@lukesneeringer this seems to be a common problem. The most recent report shows 10 seconds spent on a query that should take in the tens of milliseconds. Worth considering, our Datastore API uses the REST endpoint (correction: our Datastore API uses common-grpc / manual proto loading with gRPC). There is a GAPIC layer that we will likely convert to during our repo extraction.
We use --memory=1024MB in order to get a faster machine (as recommended in the docs). We haven't tired any higher memory settings.
We see similar behaviour to @richardowright and its important to note that the mean latency is not the only problem; some requests can still take multiple seconds even when auth is hardcoded to give a lower mean latency. Similar behaviour is seen in App Engine Flex with Node.js i.e. some requests take > 1 sec even though the mean for reads is lower ~ 600ms.
I just did the same test against DynamoDB using a 1024MB Lambda behind API Gateway using Go and eawsy's aws-lambda-go-shim and the latency was ~490ms and pretty stable. This is all very rough and ready but seems there is no big difference between Go/AppEngine/Datastore compared to Go/API Gateway/Lambda/DynamoDB and so once Cloud Functions gets Go support I will be happy :)
Facing the very same issue with Google Cloud Functions and Firestore... First call takes several seconds, generally from 3 to 6 seconds. Subsequent calls half the latency. I have separate Functions talking to a MongoDB VM in Compute Engine, and the latency is < 1s, except on the first call where it's around 3-5 seconds.
I've moved some functions to AWS Lambda with DynamoDB where the latency is at most 1.5s, which is definitely doable in an end-user facing situation.... Sad.
So far I have ~500ms latency for a simple API request. Do you have a suggestion how to trace it and find the cause of the issue? Or, is it totally normal for Cloud Functions to have such latency?
Activity
[-]Extreme Latency when Using Google Cloud Functions[/-][+]Extreme Latency when Using Google Cloud Functions and Cloud Datastore[/+]stephenplusplus commentedon Jun 10, 2017
Can you see if subsequent calls also have a lag? The first request has to sort out the authentication details, so it's known to be slower.
stephenplusplus commentedon Jun 12, 2017
Yes, unfortunately. I'll close the issue, as we can't do anything within the client library. If any ideas come to mind for how this can be addressed, feel free to discuss.
ro-savage commentedon Aug 7, 2017
@stephenplusplus - We are running into the same issue. Datastore and Functions seem like the perfect combination, paying only a per-request cost. However the latency is much too high to be usable in real-world.
As was mentioned, it is related to the Auth.
This problem must be solvable, as other similar systems such as Lambda + DynamoDB don't under into this issue.
It seems unlikely to be implemented in node, but probably some setup on the function/lambda that is 'pre-authenticated' (AWS IAM roles?).
Who would be the correct team/repo to work on this issue?
reco commentedon Aug 28, 2017
@ro-savage we were/are using app engine with datastore. we also did run in to big issues with the latency of the datastore. would love to hear some updates @google-admin about this issue.
ahume commentedon Sep 26, 2017
A few weeks into development, we're finding Datastore to not be a viable solution for use in Functions due to the consistently poor performance on even very simple queries. 4000ms on first (authenticating) request, and then 800-1200ms afterwards.
ignaciovazquez commentedon Oct 3, 2017
We are also experiencing 60ms-200ms latencies on a lookup by key (runQuery is even worse) from GAE Flexible in node.
stephenplusplus commentedon Nov 6, 2017
Also reported in #2727
@lukesneeringer this seems to be a common problem. The most recent report shows 10 seconds spent on a query that should take in the tens of milliseconds.
Worth considering, our Datastore API uses the REST endpoint(correction: our Datastore API uses common-grpc / manual proto loading with gRPC). There is a GAPIC layer that we will likely convert to during our repo extraction.EJB3927 commentedon Nov 6, 2017
Thank you @stephenplusplus. I can confirm I'm having this issue with the following environment:
Additionally, I'm noticing the issue on Cloud Functions with the same node and NPM versions.
14 remaining items
lc-chrisbarton commentedon Dec 11, 2017
We use --memory=1024MB in order to get a faster machine (as recommended in the docs). We haven't tired any higher memory settings.
We see similar behaviour to @richardowright and its important to note that the mean latency is not the only problem; some requests can still take multiple seconds even when auth is hardcoded to give a lower mean latency. Similar behaviour is seen in App Engine Flex with Node.js i.e. some requests take > 1 sec even though the mean for reads is lower ~ 600ms.
lc-chrisbarton commentedon Dec 14, 2017
I just did the same test against DynamoDB using a 1024MB Lambda behind API Gateway using Go and eawsy's aws-lambda-go-shim and the latency was ~490ms and pretty stable. This is all very rough and ready but seems there is no big difference between Go/AppEngine/Datastore compared to Go/API Gateway/Lambda/DynamoDB and so once Cloud Functions gets Go support I will be happy :)
perf-lambda-go.txt
stephenplusplus commentedon Dec 16, 2017
This issue was moved to googleapis/nodejs-datastore#9.
lazharichir commentedon Jan 13, 2018
Facing the very same issue with Google Cloud Functions and Firestore... First call takes several seconds, generally from 3 to 6 seconds. Subsequent calls half the latency. I have separate Functions talking to a MongoDB VM in Compute Engine, and the latency is < 1s, except on the first call where it's around 3-5 seconds.
I've moved some functions to AWS Lambda with DynamoDB where the latency is at most 1.5s, which is definitely doable in an end-user facing situation.... Sad.
lc-chrisbarton commentedon Jan 13, 2018
@lazharichir you should probably add your comment here googleapis/nodejs-datastore#9 since this issue is closed
lc-chrisbarton commentedon Jan 13, 2018
@lazharichir you can significantly improve latency in AWS Lambda if you use a CloudWatch scheduled Lambda to keep your function warm
koistya commentedon Feb 26, 2018
So far I have ~500ms latency for a simple API request. Do you have a suggestion how to trace it and find the cause of the issue? Or, is it totally normal for Cloud Functions to have such latency?
https://firebase.reactstarter.com online demo + source code
karlbateman commentedon May 11, 2018
Can someone confirm whether or not using gRPC makes a notable difference?
chore(main): release 7.7.0 (#2374)
chore(deps): update dependency node to v22 (#2374)
chore(main): release 7.7.0 (googleapis#2374)