-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add the containerV2
flag to compute initial heap percentage using processor count, and disable setting the ActiveProcessorCount
JVM option
#361
Merged
bulldozer-bot
merged 26 commits into
develop
from
pmarupaka/updateActiveProcessorCountFlagAndInitialHeapPct
Nov 16, 2023
Merged
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0381bc3
Add the UseProcessorAwareInitialHeapPercentage and set the initial he…
9885551
Update integration test file
2a25467
add a comment
8047f50
Round percentage to 2 decimal places
694c0c5
Update heap pct calculation
b5311e2
update flag name
cd02b48
round to 1 decimal place
f2c041a
Add generated changelog entries
svc-changelog b311ee5
review changes
c4f02cb
Merge branch 'pmarupaka/updateActiveProcessorCountFlagAndInitialHeapP…
3c7b572
fix computation
52908f8
review changes p2
7b517e5
wip: adding test
b0b7776
wip tests
9a09312
update integration tests
2c28dd7
Add generated changelog entries
svc-changelog b3649aa
integration test: check for existence of keys
6890a1a
add test for ComputeJVMHeapSizeInBytes
89c0f6e
update TestComputeJVMHeapSize test case
8489e7a
Autorelease 1.93.0-rc1
carterkozak 17043f5
review changes: rename flag to containerV2 and fallback to setting in…
5d68069
Add generated changelog entries
svc-changelog d11eaf4
review changes: add comment justifying fallback. heapLimit -> memoryL…
1a34acf
remove check for containerV2 in 'ensureActiveProcessorCount' and move…
03480a1
update comment
ad969c4
review comments: update readme. Don't needlessly propagate a nil error
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
type: improvement | ||
improvement: | ||
description: When the experimental `containerV2` is set, 1) compute the heap percentage | ||
as 75% of the heap minus 3mb per processor, with a minimum value of 50%, and 2) | ||
don't set the -XX:ActiveProcessorCount JVM option. | ||
links: | ||
- https://github.com/palantir/go-java-launcher/pull/361 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...n_test/testdata/launcher-custom-experimental-container-v2-with-initial-ram-percentage.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
configType: java | ||
configVersion: 1 | ||
jvmOpts: | ||
- '-XX:InitialRAMPercentage=70.0' | ||
experimental: | ||
containerV2: true |
6 changes: 6 additions & 0 deletions
6
...ation_test/testdata/launcher-custom-experimental-container-v2-with-max-ram-percentage.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
configType: java | ||
configVersion: 1 | ||
jvmOpts: | ||
- '-XX:MaxRAMPercentage=70.0' | ||
experimental: | ||
containerV2: true |
3 changes: 2 additions & 1 deletion
3
...r-custom-experimental-processor-count.yml → ...imental-container-v2-with-xms-and-xmx.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
configType: java | ||
configVersion: 1 | ||
jvmOpts: | ||
- '-Xms1g' | ||
- '-Xmx1g' | ||
experimental: | ||
overrideActiveProcessorCount: true | ||
containerV2: true |
5 changes: 5 additions & 0 deletions
5
integration_test/testdata/launcher-custom-experimental-container-v2.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
configType: java | ||
configVersion: 1 | ||
jvmOpts: [] | ||
experimental: | ||
containerV2: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright 2023 Palantir Technologies, Inc. | ||
mpritham marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package launchlib | ||
|
||
import ( | ||
"io" | ||
"io/fs" | ||
"os" | ||
"path/filepath" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
const ( | ||
memGroupName = "memory" | ||
memLimitName = "memory.limit_in_bytes" | ||
) | ||
|
||
type MemoryLimit interface { | ||
MemoryLimitInBytes() (uint64, error) | ||
} | ||
|
||
var DefaultMemoryLimit = NewCGroupMemoryLimit(os.DirFS("/")) | ||
|
||
type CGroupMemoryLimit struct { | ||
pather CGroupPather | ||
fs fs.FS | ||
} | ||
|
||
func NewCGroupMemoryLimit(filesystem fs.FS) MemoryLimit { | ||
return CGroupMemoryLimit{ | ||
pather: NewCGroupV1Pather(filesystem), | ||
fs: filesystem, | ||
} | ||
} | ||
|
||
func (c CGroupMemoryLimit) MemoryLimitInBytes() (uint64, error) { | ||
memoryCGroupPath, err := c.pather.Path(memGroupName) | ||
if err != nil { | ||
return 0, errors.Wrap(err, "failed to get memory cgroup path") | ||
} | ||
|
||
memLimitFilepath := filepath.Join(memoryCGroupPath, memLimitName) | ||
memLimitFile, err := c.fs.Open(convertToFSPath(memLimitFilepath)) | ||
if err != nil { | ||
return 0, errors.Wrapf(err, "unable to open memory.limit_in_bytes at expected location: %s", memLimitFilepath) | ||
} | ||
memLimitBytes, err := io.ReadAll(memLimitFile) | ||
if err != nil { | ||
return 0, errors.Wrapf(err, "unable to read memory.limit_in_bytes") | ||
} | ||
memLimit, err := strconv.Atoi(strings.TrimSpace(string(memLimitBytes))) | ||
if err != nil { | ||
return 0, errors.New("unable to convert memory.limit_in_bytes value to expected type") | ||
} | ||
return uint64(memLimit), nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to clarify that this case only applies when cgroup memory limits aren't detected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may also be fair to exclude the fallback info from the documentation as it shouldn't be reachable in rubix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it to specify that the fallback is used when we're not able to get the cgroup memory limit.