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

Parse Server memory usage #2482

Closed
benishak opened this issue Aug 8, 2016 · 9 comments
Closed

Parse Server memory usage #2482

benishak opened this issue Aug 8, 2016 · 9 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@benishak
Copy link
Contributor

benishak commented Aug 8, 2016

Env:

Parse Server 2.2.16
Parse SDK 1.9.0
AWS

Problem

Consider this code run on the Client

var Query = new Parse.Query("Books");
Query.limit(10000);
Query.find().then(
   function(books){
         // do something with books
        books = [] // clean up RAM
   }
)

in this example the moment the result is returned to the client, the memory at the client side hike to 800MB, but when the line books = [] execute the memory usage back to normal around 70MB.

The situation in Parse Server (server side) : the moment I request the result, the memory usage hikes also to 1GB in this example but the difference is that it never goes back to normal till I have to restart the node.

Is there any workaround to fix such issue?

@hramos
Copy link
Contributor

hramos commented Aug 8, 2016

Does this happen on version 2.2.17, which is the latest as of this issue's creation?

@benishak
Copy link
Contributor Author

benishak commented Aug 8, 2016

Yes

@joeyslack
Copy link

Also seeing huge memory spikes.

@benishak
Copy link
Contributor Author

this could be a problem with node itself because of a bug in V8 Engine, I was using v4.4.2, now I upgraded to v4.5.0 and will come back later with results

source: https://nodejs.org/en/blog/vulnerability/june-2016-security-releases/

@benishak
Copy link
Contributor Author

After running for a week I can say it was NodeJS issue because of the old V8 CG bug in node < 4.5
I'm now using node 6.4 in cluster mode, things are acceptable,

But the top example still causing a memory leak,
I install memwatch-next and inside the callback of leak event I put some logs and i got the following

"growth":9919040,"reason":"heap growth over 5 consecutive GCs (1m 2s) - 549.26 mb/hr"}

I still not sure what cause this leak, but I disable all our cloud code to make sure that it is not because of our code ...

A work around was to force CG to run when the leak happen so I put something like this

memwatch.on('leak', function(info) { memwatch.gc() });

memwatch.gc() will force CG to run immidiately instead of waiting it to run by itself

@flovilmart
Copy link
Contributor

A workaround is nice but a fix is better. Do you want to tackle that issue?

@hramos hramos added the type:bug Impaired feature or lacking behavior that is likely assumed label Sep 6, 2016
@benishak
Copy link
Contributor Author

benishak commented Dec 1, 2016

@hramos @flovilmart I think the issue turns out to be related to Cache somehow, after switching to Redis Cache, this become ok, but I'm still testing ....

@flovilmart
Copy link
Contributor

Alirght :) flushing the cash would be nice indeed, or using a LRU cache or with timeout would be nice too.

@benishak
Copy link
Contributor Author

benishak commented May 8, 2017

redis fixed this issue

@benishak benishak closed this as completed Jun 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

4 participants