Skip to content

Datastore access is slow #2284

@Paxa

Description

@Paxa

Access to datastore is slow, and even more slower when run on cloud functions.

Code example:

const Datastore = require('@google-cloud/datastore');

const ds = exports.ds = Datastore({
  projectId: 'my-test',
  keyFilename: './my-test-key.json'
});

console.time('query');
var query = ds.createQuery(['Cat']);
ds.runQuery(query, (error, entities, nextQuery) => {
  console.timeEnd('query');

  console.log(entities.length);
  console.log(entities);
});

Output:

query: 1156.979ms
8
[ { time: 2017-05-05T08:51:51.822Z,
    age: 123,
    name: 'miu',
    color: 'black' },
  { age: 123,
    name: 'miu',
    color: 'black',
    time: 2017-05-05T08:53:26.497Z },
... // 8 same objects

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?

Metadata

Metadata

Labels

api: datastoreIssues related to the Datastore API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions