Skip to content

Commit

Permalink
[feature]
Browse files Browse the repository at this point in the history
1.Limit the resource usage of hbase containers.
  • Loading branch information
linzehao committed Jun 23, 2023
1 parent 5fd6742 commit e977bdc
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 4 deletions.
12 changes: 10 additions & 2 deletions cloudeon-stack/EDP-1.0.0/hbase/k8s/hbase-master.yaml.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ spec:
value: "${runAs}"
- name: "HBASE_CONF_DIR"
value: "/opt/edp/${service.serviceName}/conf"
- name: MEM_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
image: "${dockerImage}"
imagePullPolicy: "Always"
readinessProbe:
Expand All @@ -56,8 +60,12 @@ spec:
timeoutSeconds: 2
name: "${roleServiceFullName}"
resources:
requests: {}
limits: {}
requests:
memory: "${conf['hbase.master.container.request.memory']}Mi"
cpu: "${conf['hbase.master.container.request.cpu']}"
limits:
memory: "${conf['hbase.master.container.limit.memory']}Mi"
cpu: "${conf['hbase.master.container.limit.cpu']}"
securityContext:
privileged: true
volumeMounts:
Expand Down
12 changes: 10 additions & 2 deletions cloudeon-stack/EDP-1.0.0/hbase/k8s/hbase-regionserver.yaml.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ spec:
value: "${runAs}"
- name: "HBASE_CONF_DIR"
value: "/opt/edp/${service.serviceName}/conf"
- name: MEM_LIMIT
valueFrom:
resourceFieldRef:
resource: limits.memory
image: "${dockerImage}"
imagePullPolicy: "Always"
readinessProbe:
Expand All @@ -56,8 +60,12 @@ spec:
timeoutSeconds: 2
name: "${roleServiceFullName}"
resources:
requests: {}
limits: {}
requests:
memory: "${conf['hbase.regionserver.container.request.memory']}Mi"
cpu: "${conf['hbase.regionserver.container.request.cpu']}"
limits:
memory: "${conf['hbase.regionserver.container.limit.memory']}Mi"
cpu: "${conf['hbase.regionserver.container.limit.cpu']}"
securityContext:
privileged: true
volumeMounts:
Expand Down
4 changes: 4 additions & 0 deletions cloudeon-stack/EDP-1.0.0/hbase/render/hbase-env.sh.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

# Set environment variables here.

<#assign ramPercentage = conf['hbase.heap.memory.percentage']?number>
export HBASE_HEAP_MEMORY=$[ $MEM_LIMIT / 1024 / 1024 * ${ramPercentage} / 100 ]M
export HBASE_MASTER_OPTS=" -Xmx$HBASE_HEAP_MEMORY -Xms$HBASE_HEAP_MEMORY $HBASE_MASTER_OPTS"
export HBASE_REGIONSERVER_OPTS=" -Xmx$HBASE_HEAP_MEMORY -Xms$HBASE_HEAP_MEMORY $HBASE_REGIONSERVER_OPTS"

# Uncomment and adjust to enable JMX exporting
# See jmxremote.password and jmxremote.access in $JRE_HOME/lib/management to configure remote password access.
Expand Down
65 changes: 65 additions & 0 deletions cloudeon-stack/EDP-1.0.0/hbase/service-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,70 @@ configurations:
description: "Region Server http 端口"
tag: "端口"

- name: hbase.heap.memory.percentage
description: "Hbase Master/RegionServer jvm堆内存占容器内存限额的百分比"
recommendExpression: 75
min: 10
max: 80
valueType: InputNumber
unit: ".0"
configurableInWizard: true
tag: "资源管理"

- name: hbase.master.container.limit.cpu
description: "Hbase Master容器的CPU使用限额"
recommendExpression: 1.0
valueType: InputNumber
configurableInWizard: true
tag: "资源管理"
- name: hbase.master.container.limit.memory
description: "Hbase Master容器的内存使用限额,单位MB"
recommendExpression: 2048
valueType: InputNumber
unit: Mi
configurableInWizard: true
tag: "资源管理"
- name: hbase.master.container.request.cpu
description: "Hbase Master容器的CPU请求量"
recommendExpression: 0.2
valueType: InputNumber
configurableInWizard: true
tag: "资源管理"
- name: hbase.master.container.request.memory
description: "Hbase Master容器的内存请求量,单位MB"
recommendExpression: 1024
valueType: InputNumber
unit: Mi
configurableInWizard: true
tag: "资源管理"

- name: hbase.regionserver.container.limit.cpu
description: "Hbase RegionServer容器的CPU使用限额"
recommendExpression: 1.0
valueType: InputNumber
configurableInWizard: true
tag: "资源管理"
- name: hbase.regionserver.container.limit.memory
description: "Hbase RegionServer容器的内存使用限额,单位MB"
recommendExpression: 2048
valueType: InputNumber
unit: Mi
configurableInWizard: true
tag: "资源管理"
- name: hbase.regionserver.container.request.cpu
description: "Hbase RegionServer容器的CPU请求量"
recommendExpression: 0.2
valueType: InputNumber
configurableInWizard: true
tag: "资源管理"
- name: hbase.regionserver.container.request.memory
description: "Hbase RegionServer容器的内存请求量,单位MB"
recommendExpression: 1024
valueType: InputNumber
unit: Mi
configurableInWizard: true
tag: "资源管理"




0 comments on commit e977bdc

Please sign in to comment.