Giter Site home page Giter Site logo

Slow loading about gstore-node HOT 11 CLOSED

sebelga avatar sebelga commented on June 5, 2024
Slow loading

from gstore-node.

Comments (11)

shaunc869 avatar shaunc869 commented on June 5, 2024 1

I think I found the fix for this, in the file model.js there is a line at the top that reads:

var gcloud = require('google-cloud');

While I have a limited understanding of Node at this point, my assumption is this sucks in all libraries inside Google Cloud which is quite large and seems to take a long time to get through, if I change that line to:

var gcloud = require('google-cloud/datastore');

it seems to skip everything except the datastore which is all we need I think? I've done basic testing and this seems to work fairly well.

I did not have NPM v3 so this may account for a lot of this as well, but if it's true that we only need the datastore component from the google-cloud library I think this could be a useful update.

from gstore-node.

micaww avatar micaww commented on June 5, 2024

Try changing out your gcloud dependency with google-cloud first. gstore relies on the latter. This may fix your problem because your google dependency may be cached for gstore to use.

Does that solve your problem?

from gstore-node.

shaunc869 avatar shaunc869 commented on June 5, 2024

Nope, it looks like even swapping it google-cloud makes it slow by itself. Just to give some more information I am starting the server with this command:

/usr/local/bin/node --debug-brk=55023 --expose_debug_as=v8debug

And just doing this creates the issue:

var gcloud = require('google-cloud')(configGcloud);

My configGcloud looks like this:

{
"projectId": "myproject",
"credentials": {
"client_email": "xxxxxdeveloper.gserviceaccount.com",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQI.....
}
}

Could this be causing my issue? Thanks for the help!

from gstore-node.

micaww avatar micaww commented on June 5, 2024

May I ask which npm and node version you are using? NPM 3 automatically
flattens dependencies google-cloud has an absolute ton. This should help it
load what it needs to with less looking around.

Also have you tried just running it line by line through the Node REPL?
Just to be sure that that specific line is taking so long and not debugger
attachment or anything external.

On Sep 26, 2016 1:49 PM, "Shaun" [email protected] wrote:

Nope, it looks like even swapping it google-cloud makes it slow by itself.
Just to give some more information I am starting the server with this
command:

/usr/local/bin/node --debug-brk=55023 --expose_debug_as=v8debug

And just doing this creates the issue:

var gcloud = require('google-cloud')(configGcloud);

My configGcloud looks like this:

{
"projectId": "myproject",
"credentials": {
"client_email": "xxxxxdeveloper.gserviceaccount.com",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQI.....
}
}

Could this be causing my issue? Thanks for the help!


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#16 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGOnw0OdqIgcGIV4qw8Z2cgQ5j-uOi78ks5quAWOgaJpZM4KGHu8
.

from gstore-node.

micaww avatar micaww commented on June 5, 2024

Nice catch. Although I highly recommend upgrading NPM anyways! :-)

@sebelga can you verify this?

from gstore-node.

shaunc869 avatar shaunc869 commented on June 5, 2024

Looks like we also need to change the references to gcloud.datastore to maybe just datastore, for example on line 287 we have:

if (info.moreResults !== gcloud.datastore.NO_MORE_RESULTS) {

but this needs to be changed to:

if (info.moreResults !== gcloud.NO_MORE_RESULTS) {

since gcloud is now the datastore or perhaps the variable should be renamed to datastore wholesale to avoid confusion.

from gstore-node.

sebelga avatar sebelga commented on June 5, 2024

Hi,
I will have a look into this, and yes I will make the change to only require the datastore library and not the whole package :)
@micaww thanks for looking into this. and @shaunc869 thanks for reporting!

from gstore-node.

sebelga avatar sebelga commented on June 5, 2024

Hi, just updated the library with the dependency now only on "@google-cloud/datastore". Could you check if this solves your loading problem? thanks!

from gstore-node.

shaunc869 avatar shaunc869 commented on June 5, 2024

It does solve the slow loading issue, thanks for that!

On Mon, Oct 3, 2016 at 11:23 AM, Sébastien Loix [email protected]
wrote:

Hi, just updated the library with the dependency now only on
"@google-cloud/datastore". Could you check if this solves your loading
problem? thanks!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#16 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AFyjMsUdO0u308-VOzjou3wehIdk32y3ks5qwUgEgaJpZM4KGHu8
.

from gstore-node.

sebelga avatar sebelga commented on June 5, 2024

Happy to hear that! :)

from gstore-node.

wiliame avatar wiliame commented on June 5, 2024

I had the same issue in the past, changed the reference and gone fine. If I remember, I think it was the google logging require.

from gstore-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.