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

Give pantsd more RAM by default. #18389

Merged
merged 1 commit into from
Mar 2, 2023

Conversation

benjyw
Copy link
Contributor

@benjyw benjyw commented Mar 2, 2023

1GiB turns out to be too low for even medium-sized repos. Several users have remarked on this on Slack (search for "pantsd_max_memory_usage" there to see those), and we've noticed it in the Toolchain repo.

Most developer laptops have plenty of RAM. So 4GiB seems like a decent default.

1GiB turns out to be too low for even medium-sized repos.
Several users have remarked on this on Slack, and we've
noticed it in the Toolchain repo.

Most developer laptops have plenty of RAM. So 4GiB seems
like a decent default.
Copy link
Contributor

@jsirois jsirois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this terrifying. Do we have any handles on this at all? Something like lines of code times X -> Y ram?

@benjyw
Copy link
Contributor Author

benjyw commented Mar 2, 2023

We don't have a handle on this, as far as I know, and I imagine it will be some function of number of source files (rather than LoC) and which plugins you've enabled.

That said, this is a maximum, so you'll only actually use that much RAM if you need it, in which case you probably want to use it?

@jsirois
Copy link
Contributor

jsirois commented Mar 2, 2023

Yes, the user wants it if they need it. The issue is we put them in that situation and the situation is seemingly ridiculous on its face. That's my concern, that we have no handle on this.

@kaos
Copy link
Member

kaos commented Mar 2, 2023

well yea.. that's an absurd amount of memory.. 🤔

@benjyw
Copy link
Contributor Author

benjyw commented Mar 2, 2023

Yeah, I have no idea what takes up all this memory. I assume it's mostly memoized rule invocations, but we'd have to measure to find out and potentially reduce. Maybe @stuhood has some intuitions here.

@benjyw benjyw merged commit bd84dd9 into pantsbuild:main Mar 2, 2023
@benjyw benjyw deleted the bump_default_pantsd_ram branch March 2, 2023 03:02
@sureshjoshi
Copy link
Member

Does the daemon release memory after usage, or only when it's killed/restarted? For example, I have a couple daemon's sitting around, each at 500MB. I'm sure the system would kill/purge/page them if it needed to recoup, but does the daemon do that on its own?

My policy during dev is, use all my memory while you're building/whatever (looking at you Android/Gradle), but then release most of it back.

@benjyw
Copy link
Contributor Author

benjyw commented Mar 5, 2023

I believe only when it's killed.

@stuhood
Copy link
Member

stuhood commented Mar 7, 2023

pantsd will hold 1 version of each Node at a time in memory, but it will currently never actually free a Node: so if you build A, and then switch to building B, a copy of A will stick around until the next restart. That issue is covered by #7675.

Yeah, I have no idea what takes up all this memory. I assume it's mostly memoized rule invocations, but we'd have to measure to find out and potentially reduce. Maybe @stuhood has some intuitions here.

As mentioned in the thread where this was last discussed: if users are seeing abnormal amounts of memory used, opening tickets with --stats-memory-usage output attached would be helpful. It reports which objects are using the most memory, including both the Python and Rust memory usage of Nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants