Skip to content

[Feature] Support customizing JVM memory options via JVM_OPTS environment variable#4545

Open
zhuxt2015 wants to merge 1 commit intoDataLinkDC:devfrom
zhuxt2015:feature/jvm-opts-from-env
Open

[Feature] Support customizing JVM memory options via JVM_OPTS environment variable#4545
zhuxt2015 wants to merge 1 commit intoDataLinkDC:devfrom
zhuxt2015:feature/jvm-opts-from-env

Conversation

@zhuxt2015
Copy link
Contributor

Purpose of the pull request

Previously, JVM memory options in auto.sh were hardcoded as -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M, and the Dockerfile worked around this by using sed to replace
the values at image build time with container-aware settings (-XX:+UseContainerSupport).

This PR removes the sed hack and introduces a cleaner approach:

  • auto.sh now reads JVM options from the JVM_OPTS environment variable, falling back to the original hardcoded defaults if not set.
  • The Dockerfile declares JVM_OPTS as an ENV variable with container-aware defaults (-XX:+UseContainerSupport -XX:InitialRAMPercentage=70.0 -XX:MaxRAMPercentage=70.0).

Benefits:

  • Users can override JVM memory settings at runtime without rebuilding the image:
    docker run -e JVM_OPTS="-Xms1g -Xmx4g" dinky:latest
  • Non-container deployments retain the original default values when JVM_OPTS is not set.
  • Eliminates the fragile sed substitution that could silently fail if the hardcoded string changed.

Brief change log

Verify this pull request

This pull request is code cleanup without any test coverage.

(or)

This pull request is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

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

Successfully merging this pull request may close these issues.

1 participant