-
Notifications
You must be signed in to change notification settings - Fork 605
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
Datastore access is slow #2284
Comments
My experience testing locally using this same script:
I believe what this would tell us is that the code in this library is capable of running in the range of 500-2000ms for this type of command, but the API response time and network conditions will decide where in that range it falls. Because of this, I don't think there is anything our library can do. If you feel the performance of Datastore, the service, is lacking, you can open an issue on the official tracker here and have a conversation with members of the Datastore team.
If you want to use this API directly, you can see the documentation on the expected request and response objects here: https://cloud.google.com/datastore/docs/reference/rest/. |
Thank you I tried to access 1 record by Kind + ID via HTTP and it takes 700-2000 ms, is it normal? |
Questions like those are better on the repo I linked above. We are just the client library that wraps the API. Consider that measuring the first request isn't always the best gauge of performance. There is the authentication step, where an access token is minted, which has to be run before the first API request. This step isn't repeated for future requests, which will show a better response time. |
Right, I didn't know that it makes multiple requests at first time. Is there a way to save credentials to make first request faster? I updated code: const async = require('async');
const Datastore = require('@google-cloud/datastore');
const ds = exports.ds = Datastore({
projectId: 'my-test',
keyFilename: './my-test-key.json'
});
async.timesSeries(20, (n, next) => {
console.time('query-' + n);
var query = ds.createQuery(['Cat']);
ds.runQuery(query, (error, entities, nextQuery) => {
console.timeEnd('query-' + n);
if (error) console.log(error);
next(error, entities);
});
}, function(err, cats) {
console.log(cats.length);
}); Output:
|
Not at this time. The access token management is done automatically, to handle auto-refreshing when it expires. |
Same here. RT is very slow (too slow for our usecase to be usable sadly) |
Access to datastore is slow, and even more slower when run on cloud functions.
Code example:
Output:
I ran many times, it's always 1.0 - 1.8 sec
Same code in ruby run in 0.7 seconds
Btw, how to use HTTP REST API for Datastore? I can't find how to insert or update data? Is there some example curl commands?
The text was updated successfully, but these errors were encountered: