When you create or deploy an application in a Container Service Kubernetes cluster or serverless Kubernetes cluster, you can use Java startup parameters to configure the JVM memory, garbage collection (GC) policy, and service registration and discovery. A valid configuration of Java startup parameters helps you reduce the overhead of GC, decrease server response time (RT), and increase throughput.

Configure Java startup parameters when you create an application

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. On the Applications page, select a namespace in the upper part and click Create Application in the upper-left corner.
  3. In the Basic Information step, set Cluster Type and Application Runtime Environment, and click Next.
    Parameter Description
    Cluster Type Select Kubernetes Clusters.
    Application Runtime Environment Select Java. In the Select Application section, select a deployment method.
    • Custom: Select this option if you want to use a custom image to deploy the application to a Kubernetes cluster.
    • Java: Select this option if you want to use a universal JAR package to deploy the application as a Dubbo or a Spring Boot application. You can specify the Java Environment parameter after you select this option.
    • Tomcat: Select this option if you want to use a universal WAR package to deploy the application as a Dubbo or a Spring application. You can specify the Java Environment and Container Version parameters after you select this option.
    • EDAS-Container (HSF): Select this option if you want to use a WAR or FatJar package to deploy the application as a High-Speed Service Framework (HSF) application. You can specify the Java Environment, Pandora Version, and Ali-Tomcat Version parameters after you select this option.
  4. In the Configurations step, configure the environment information, basic information, deployment method, and resource parameters for the application, and click Next.
  5. In the Advanced Settings step, click Settings of Java Startup Parameters, click Edit next to Settings of Java Startup Parameters, and then set the following parameters as needed.
    Parameter Description
    Memory Configuration You can set the following parameters:
    • Initial Heap Size: the initial size of the heap memory, in MB. The value 0 indicates that the size is unlimited.
    • Maximum Heap Memory: the maximum size of the heap memory, in MB. Valid values: 0 to (0.85 × Maximum memory of the application container).
    • Initial Young Generation: the initial size of the young generation, in MB.
    • Maximum Young Generation Size: the maximum size of the young generation, in MB. The value max_uintx indicates that the memory size is unlimited.
    • Eden/Survivor Ratio: the ratio of the Eden space to the Survivor space.
    • Old/Young Generation Ratio: the ratio of the old generation to the young generation.
    • Initial Permanent Generation Memory: the initial size of the permanent generation, in MB.
    • Maximum Permanent Generation Size: the maximum size of the permanent generation, in MB.
    • Maximum Direct Memory Size: the maximum size of the non-blocking I/O (NIO) direct memory, in MB.
    • Thread Stack Size: the size of the thread stack, in KB.
    Applications You can set the following parameters for an HSF application:
    • Port: the port that is bound to start the HSF application. By default, the value is 12200.
    • Serialization: the serialization method of the HSF application. By default, the value is Hessian.
    • Min Pool Size: the minimum size of the thread pool of the HSF provider. By default, the value is 50.
    • Max Pool Size: the maximum size of the thread pool of the HSF provider. By default, the value is 720.
    GC Policy You can set the following parameters for a GC policy:
    • Young Generation GC Policy: the GC for the young generation.
    • Old Generation GC Policy: the GC for the old generation. Set Young Generation GC Policy before you set Old Generation GC Policy.
    • Concurrent GC Threads: the number of concurrent threads to be used by the GC.
    • Concurrent GC Threads: the number of concurrent threads to be used by the GC.
    Coprocess characteristics To enable coprocess characteristics, turn on the Coprocess characteristics switch.
    Note The parameter Coprocess characteristics is available only when you use Dragonwell Java Development Kit (JDK).
    Tool Specify Log Directory, Total Files, and File Size for the GC log files. Specify Dump File Path that is used when out-of-memory errors occur.
    Service Registration and Discovery If you want to use a self-managed Nacos registry, select this option. If you do not select this option, the system automatically uses the shared registry of EDAS.
    Custom If the preceding parameters do not meet your configuration requirements, you can set custom parameters. Separate parameters with spaces.
  6. Click Create Application.
  7. In the Creation Completed step, confirm the settings in Basic Information, Configurations, and Advanced Settings, and click Create Application.
    In the upper part of the Application Overview page, click View Details. On the Change List page, you can view the change process. Wait a few minutes until the application is deployed. After the change process is complete, view the running status of the instances in the Basic Information section of the Application Overview page. If the pod that runs the application is in the running state, the application is deployed.

Configure Java startup parameters when you update an application

You can set Java startup parameters when you create an application, or set or update them when you deploy an application.

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, click Applications. In the top navigation bar, select a region. On the Applications page, select a namespace in the upper part, and select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list. Then, find the application that you want to deploy, and click the application name.
  3. On the Application Overview or Basic Information page, choose Deploy > Deploy in the upper-right corner.
  4. On the Select Deployment Mode page, select a deployment mode and click Start Deployment in the upper-right corner of the specified deployment mode section.
  5. Set the application runtime environment and deployment package. Click Settings of Java Startup Parameters, click Edit next to Settings of Java Startup Parameters, and then set the parameters as needed. After the configuration is complete, click OK.
    Parameter Description
    Memory Configuration You can set the following parameters:
    • Initial Heap Size: the initial size of the heap memory, in MB. The value 0 indicates that the size is unlimited.
    • Maximum Heap Memory: the maximum size of the heap memory, in MB. Valid values: 0 to (0.85 × Maximum memory of the application container).
    • Initial Young Generation: the initial size of the young generation, in MB.
    • Maximum Young Generation Size: the maximum size of the young generation, in MB. The value max_uintx indicates that the memory size is unlimited.
    • Eden/Survivor Ratio: the ratio of the Eden space to the Survivor space.
    • Old/Young Generation Ratio: the ratio of the old generation to the young generation.
    • Initial Permanent Generation Memory: the initial size of the permanent generation, in MB.
    • Maximum Permanent Generation Size: the maximum size of the permanent generation, in MB.
    • Maximum Direct Memory Size: the maximum size of the non-blocking I/O (NIO) direct memory, in MB.
    • Thread Stack Size: the size of the thread stack, in KB.
    Applications You can set the following parameters for an HSF application:
    • Port: the port that is bound to start the HSF application. By default, the value is 12200.
    • Serialization: the serialization method of the HSF application. By default, the value is Hessian.
    • Min Pool Size: the minimum size of the thread pool of the HSF provider. By default, the value is 50.
    • Max Pool Size: the maximum size of the thread pool of the HSF provider. By default, the value is 720.
    GC Policy You can set the following parameters for a GC policy:
    • Young Generation GC Policy: the GC for the young generation.
    • Old Generation GC Policy: the GC for the old generation. Set Young Generation GC Policy before you set Old Generation GC Policy.
    • Concurrent GC Threads: the number of concurrent threads to be used by the GC.
    • Concurrent GC Threads: the number of concurrent threads to be used by the GC.
    Coprocess characteristics To enable coprocess characteristics, turn on the Coprocess characteristics switch.
    Note The parameter Coprocess characteristics is available only when you use Dragonwell Java Development Kit (JDK).
    Tool Specify Log Directory, Total Files, and File Size for the GC log files. Specify Dump File Path that is used when out-of-memory errors occur.
    Service Registration and Discovery If you want to use a self-managed Nacos registry, select this option. If you do not select this option, the system automatically uses the shared registry of EDAS.
    Custom If the preceding parameters do not meet your configuration requirements, you can set custom parameters. Separate parameters with spaces.
    Notice The application is restarted after you click OK. We recommend that you perform this operation during off-peak hours.

Verify the result

  • Method 1

    In the left-side navigation pane of the application details page, click Change List to view the application change details. If the value in the Change Status column is Succeeded, the application is deployed and the configuration takes effect.

  • Method 2

    On the Application Overview page, click Running Pods (Click View) next to Running Status. In the Pod section of the panel that appears, check the Status column of the pod. If a green dot appears, the application is in the running state. This means that the application is deployed as expected and the configuration takes effect.