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

What are the recommended values for directoryCacheMaxEntries and commandCacheMaxEntries? #1638

Open
DarkMatterV opened this issue Feb 19, 2024 · 4 comments

Comments

@DarkMatterV
Copy link

DarkMatterV commented Feb 19, 2024

Currently, I set the value of directoryCacheMaxEntries, commandCacheMaxEntries, digestToActionCacheMaxEntries, recentServedExecutionsCacheMaxEntries to 6553600. However, MAT shows that directoryCache and commandCache occupy a large amount of memory. I think it's because the size is set too large. Do you have any suggestions?

@werkt
Copy link
Member

werkt commented Feb 19, 2024

I'm not sure if we've exposed enough of the runtime metrics for those caches to make decisions from any externally observable measurements.
Pathologically, you want that cache to be large enough to keep the hottest values in without thrashing, and small enough where you only seek to populate when you will get a decent reuse benefit - i.e. it should follow the trends of your builds to incorporate or discard novel or old metadata sets, respectively.
FWIW there is not a lot of additional memory use on the server anyway, so if you're not using it for this, what else do you need it for?

@DarkMatterV
Copy link
Author

Currently, I set -Xmx256g and I've noticed that sometimes jvm_memory_bytes_used / jvm_memory_bytes_max goes up to 100% for a short period of time, and I'm not sure what's causing it yet.

Then, I use jmap -dump:live,format=b,file=heap.hprof {pid} dump heap file and MAT analyse it, and MAT shows that ShardInstance、directoryCache and commandCache occupy a large amount of memory. So I'm guessing it's because I set the size too high. Do you think I should reduce the size?

@DarkMatterV
Copy link
Author

Or do you have any suggestions for locating OOM-related problems?

@werkt
Copy link
Member

werkt commented Feb 20, 2024

I say, yes, reduce the size (of the caches). I bet that a good portion of them decay quickly (but again, I would need to have/add stats to say that for sure), and that a useful comparison will be a sentinel build of some sort with full execution, on a fresh server (twice, to see the impact of population), against one that has a reduced size. If your time is unaffected (and the builds are representative), then you're likely unaffected by thrash.

Dealing with OOMs is a matter of exactly what you're doing. jmap, object counts over time, perturbation of likely causes, and measuring the effects and timing of GC runs.

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

No branches or pull requests

3 participants