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

Server-side memory usage reported as "twice the size of Pleroma" #971

Closed
nolanlawson opened this issue Feb 13, 2019 · 2 comments · Fixed by #973
Closed

Server-side memory usage reported as "twice the size of Pleroma" #971

nolanlawson opened this issue Feb 13, 2019 · 2 comments · Fixed by #973
Labels
performance Related to speed or responsiveness

Comments

@nolanlawson
Copy link
Owner

That seems out of whack; there may be a way to reduce server-side memory usage.

@nolanlawson nolanlawson added the performance Related to speed or responsiveness label Feb 13, 2019
@nolanlawson
Copy link
Owner Author

nolanlawson commented Feb 13, 2019

So based on the total RSS (Resident Set Size) running on Linux, the out-of-the-box usage of yarn start is around 300MB, which definitely seems high:

screenshot from 2019-02-12 20-57-07

Just by reducing some of those "npm scripts calling other npm scripts" or wrapper scripts like cross-env, we get down to 123MB, which is an improvement:

screenshot from 2019-02-12 20-57-52

Interestingly, though, we are still running two Node processes: one for yarn and one for the main node server. Using npm instead of yarn uses slightly less, but it's still around 92MB:

screenshot from 2019-02-12 21-00-30

The only way to get this down is to call node __sapper__/build directory, rather than using an npm/yarn script, which gets us down to 48.6MB:

screenshot from 2019-02-12 20-59-32

I did some research, but the only thing I've come across is this blog post, which basically concludes that the npm start pattern is an inherent waste of RAM because it uses about twice as much memory as calling node directly. Unless I'm missing something, I'm seeing the exact same results.

The author does note that the parent npm process seems to decrease in memory over time, and after 48 hours is negligible. Perhaps yarn has the same behavior; without running it for 48 hours, I'm not sure.

@nolanlawson
Copy link
Owner Author

nolanlawson commented Feb 13, 2019

So according to man ps RSS lists the memory usage in kilobytes, not bytes. So this is actually me reducing memory usage from 300MB to 48.6MB. Updated the comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Related to speed or responsiveness
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant