Skip to content

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

Merged
gaoyan1998 merged 1 commit intoDataLinkDC:devfrom
zhuxt2015:feature/jvm-opts-from-env
Apr 20, 2026
Merged

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

Conversation

@zhuxt2015
Copy link
Copy Markdown
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:

@zhuxt2015 zhuxt2015 force-pushed the feature/jvm-opts-from-env branch from b18e0fa to 57b3999 Compare March 23, 2026 01:23
Copy link
Copy Markdown
Contributor

@gaoyan1998 gaoyan1998 left a comment

Choose a reason for hiding this comment

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

LGTM

@gaoyan1998 gaoyan1998 merged commit f3497e3 into DataLinkDC:dev Apr 20, 2026
22 checks passed
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.

2 participants