Make Solr heap tunable via SOLR_HEAP (default 4g, no behavior change)#1309
Make Solr heap tunable via SOLR_HEAP (default 4g, no behavior change)#1309vidiecan wants to merge 1 commit into
Conversation
Default stays 4g, so no behavior change unless SOLR_HEAP is set. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Docker Compose configuration for the dspacesolr service is updated to make the Solr JVM heap size configurable. The startup command now accepts a ChangesConfigurable Solr Heap Size
🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
Make the Solr JVM heap configurable via a
SOLR_HEAPenvironment variable instead of the hardcoded-m 4gin thedspacesolrentrypoint.Default is unchanged (
4g) — with noSOLR_HEAPset, behavior is identical to today, so this is safe everywhere. This mirrors the pattern already used for the backend Tomcat heap in the same file (JAVA_OPTS: ${JAVA_OPTS:--Xmx4g}).Why
-m 4gmakes Solr start with-Xms4g -Xmx4g, and because the Solr image runs with-XX:+AlwaysPreTouch, the full 4 GB is committed at container start — regardless of how small the index actually is.On hosts that run a single stack this is fine. But on shared multi-stack dev boxes it is the dominant memory cost. Example:
dev-5.pcruns 6 DSpace stacks (customer-uk, zcu-pub, lindat, TUL, dspace-7_x, zcu-data) on 31 GB of RAM. Six Solr containers alone reserve 6 × 4 GB = 24 GB, which pushes the box permanently above 90% memory and into heavy swap — and trips the NewRelic RAM alerts continuously.There is currently no way to lower the Solr heap without editing the tracked compose file, which the CI deploy re-checks-out and reverts on every run. This change provides a proper, persistent knob: low-RAM/dev hosts can set
SOLR_HEAPin their--env-file(e.g./opt/dspace-envs/.env.dspace.dev-5.*→SOLR_HEAP=1g) while production deployments keep the 4g default.How to use
In the deploy env file for an instance:
start.shalready passes--env-file, so compose interpolates it into the entrypoint atuptime. Verified locally on dev-5.pc (instance 6):-m 1g→ Solr RSS dropped from ~2.2 GB to ~430 MB.Backport
This is a single, non-breaking line and should be backported to all
customer/*branches so every customer deployment gains the knob (labelled accordingly).Summary by CodeRabbit