Parse server doesn't free up memory

I just realized this. Parse server uses ram (which is normal) but doesnt release used ram when not using it.

For example this is my parse instances.
rsz_screenshot_from_2020-10-23_22-18-00

CPU usage is 0 or 1 percent most. Parse server is idling (dont know if this is correct word. What I mean is parse server do nothing it just waits).

I dont want my parse app to throw Out of Memory error and restrat itself. Is this expected behaviour?

Also I enabled directAccess. I’ve read somewhere that when enabled directaccess ram goes high but cant remember where I read.

Anyway is this normal?

Edit: Additional information.
Parse doesn’t start with this much ram. When I start parse, it uses 100mb per instance.

There are some caches inside Parse Server that may be resulting in a larger memory consumption. It can be also something related to your cloud code or any module you have installed. And, of course, it can also be a memory leak at Parse Server that we would need to investigate.

You may also want to trace your app with an agent like New Relic to potentially pin down a memory leak. It could be something as simple as a promise in your Cloud Code that is never resolved.

Do you think if I setup a redis cache, this can be resolved? I’ve read that internal caching system has memory leaks. If It doesnt solve the issue, then I will trace memory leaks with new relic.

Also I dont think I have an unresolved promise. My code either resolves or throws error. But I will look at that again.

The memory can be increasing for many different reasons and depending on the reason the redis cache can help. I’d first try to understand why it is happening.

I tried redis cache. When using redis, memory usage never went higher than 400Mb per instance. And when job done(query or cloud code) memory immediatly released. But when using parse internal cache system, memory goes high(like 800Mb or even 1gb) and its keeping that as long as there is more memory to use. But It still releases memory when new cloud code or query executed. It drops 500Mb from 800Mb etc. So Internal cache system doesnt release objects when idling. But free up memory eventually.

This is my observation.

1 Like