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

Add JAVA_OPTS to helm chart #995

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion helm/bootzooka/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "1.0"
description: "A Helm chart for Bootzooka"
name: bootzooka
version: 0.2.1
version: 0.2.2
type: application
keywords:
- scala
Expand Down
1 change: 1 addition & 0 deletions helm/bootzooka/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: ConfigMap
metadata:
name: {{ include "bootzooka.fullname" . }}-config
data:
JAVA_OPTS: "{{ .Values.bootzooka.javaOpts }}"
SMTP_ENABLED: "{{ .Values.bootzooka.smtp.enabled }}"
SMTP_HOST: "{{ .Values.bootzooka.smtp.host }}"
SMTP_PORT: "{{ .Values.bootzooka.smtp.port }}"
Expand Down
1 change: 1 addition & 0 deletions helm/bootzooka/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ bootzooka:
username: "server.example.com"
from: "[email protected]"
password: "bootzooka"
javaOpts: "-XX:ActiveProcessorCount=2 -XX:MaxRAMPercentage=60"
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't the processor count be determined from the allocated resources?

Copy link
Author

Choose a reason for hiding this comment

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

In kubernetes, while specifying the cpu request: 100m and the limit: 1000m the JVM pod will always see only 1 core. By combining resources requests/limits with -XX:ActiveProcessorCount=2 we can keep the requests/limits lower and make the pod see 2 cores to prevent cpu throttling.

Copy link
Member

Choose a reason for hiding this comment

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

is this request/limit configuraton somehow centrlised? I can't see it in this file.

And why 2, not 4? Is there some formula to calculate this?

Copy link
Author

Choose a reason for hiding this comment

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

The default values for resource request/limits are not defined in Helm Chart - we overwrite them in Flux configuration in another repository where we have all the apps for the infrastructure defined.
Also, the javaOpts will be overwritten in the same way - probably won't ever be used since we always overwrite those values - but has to be defined just in case someone forgets to set them later.
From now on, for each deployment the javaOpts and resource request/limits have to be configured according to the requirements.

Copy link
Member

Choose a reason for hiding this comment

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

shouldn't we define default requests/limits here as well, then?

and why 2, not 4? ;)

Copy link
Author

Choose a reason for hiding this comment

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

At this point, in this repo you don't know where the app will be deployed - whether it will be the test, dev or prod environment and how many resources your app can use in this specific environment - so requests/limits by default are unnecessary because they are connected to the resources of the environment itself.

So the 2 was the minimal possible value that could be applied to take effect. The main reason I specified the default value was that I thought it could be overwritten by any value.
But after giving some thought and doing research I found out that the ActiveProccessorAccount has higher priority than request/limits, for example even if we specify the cpu limit: 4 and ActiveProccessorAccount=2, the cpu would be 2 because of the ActiveProccessorAccount=2. So it’s not safe to specify the default value and also we don’t know the environment similarly as for requests/limits - I will remove the ActiveProccessorAccount from the defaults.

Copy link
Member

Choose a reason for hiding this comment

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

ok, thanks for the explanation :)


image:
repository: softwaremill/bootzooka
Expand Down