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

Set better defaults for Solr max heap size to prevent OOMs #547

Open
seanhamlin opened this issue Aug 30, 2022 · 1 comment
Open

Set better defaults for Solr max heap size to prevent OOMs #547

seanhamlin opened this issue Aug 30, 2022 · 1 comment

Comments

@seanhamlin
Copy link
Contributor

seanhamlin commented Aug 30, 2022

Whenever Solr runs out of heap space, the result is fairly catastrophic:

Caused by: java.lang.OutOfMemoryError: Java heap space

2022-08-29 23:06:21.232 WARN  (qtp1543148593-73) [   x:core] o.e.j.s.HttpChannel /solr/core/select
java.lang.OutOfMemoryError: Java heap space

The pod enters a weird endless cycle of the solr process being killed by Java, which in turn causes the health check to fail, so the pod is restarted, which leads to consuming all the RAM (again) ... on and on.

The defaults for the environment variable are from the upstream Solr image https://solr.apache.org/guide/7_0/taking-solr-to-production.html#memory-and-gc-settings

SOLR_JAVA_MEM="-Xmx512m"

Proposed change

Where there is not an override, to default the environment variable to

SOLR_JAVA_MEM="-Xms128m -Xmx2g"

Perhaps something like this in an entrypoint?

DEFAULT_SOLR_JAVA_MEM="-Xms128m -Xmx2g"
SOLR_JAVA_MEM="${SOLR_JAVA_MEM:-$DEFAULT_SOLR_JAVA_MEM}" 

So a minimum of 128MB, and a max of 2GB RAM.

If there is an environment variable override, to prefer that (similar to now).

@nicksantamaria
Copy link
Contributor

nicksantamaria commented Oct 26, 2023

According to the docs there should be a variable SOLR_JAVA_MEM which I can not find anywhere in this repo. Is there some magic that uses this variable, or are the docs incorrect?

Upon more reading it looks like this envvar is consumed by solr itself, and isn't specific to the container image.

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

No branches or pull requests

2 participants