How to increase MetaspaceSize for Java/Spring apps in TAP (Tanzu Application Platform)
search cancel

How to increase MetaspaceSize for Java/Spring apps in TAP (Tanzu Application Platform)

book

Article ID: 395396

calendar_today

Updated On:

Products

VMware Tanzu Application Platform

Issue/Introduction

Sometimes users might encounter MetaspaceSize insufficiency issue and have need to increase this to a bigger value in TAP (Tanzu Application Platform).

Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx353333K -XX:MaxMetaspaceSize=99222K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 6G, Thread Count: 260, Loaded Class Count: 15555, Headroom: 0%)

Resolution

Users can assign --env JAVA_TOOL_OPTIONS="XX:MaxMetaspaceSize=<val>" when creating a workload.

tanzu apps workload create APP-NAME --env JAVA_TOOL_OPTIONS="XX:MaxMetaspaceSize=<val>"

Or manually edit the workload to make this variable to take effect. 

apiVersion: carto.run/v1alpha1
kind: Workload
...
spec:
  env:
  - name: JAVA_TOOL_OPTIONS
    value: "XX:MaxMetaspaceSize=<val>"
...