Configure Java startup parameters

更新时间:
复制 MD 格式

When you create or deploy an application in a Container Service for Kubernetes (K8s) cluster or a Serverless K8s cluster, you can use Java startup parameters to configure JVM memory, garbage collection (GC) policy, service registration, and discovery. Properly configuring Java startup parameters helps reduce GC overhead, shorten server response time, and increase throughput.

Configure Java startup parameters when you create an application

  1. Log on to the EDAS console. In the left-side navigation pane, choose Application Management > Applications. The Applications page appears. In the top navigation bar, select a region. In the upper part of the page, select a namespace. In the upper-left corner, click Create Application.

  2. On the Basic Information tab, select a cluster type and an application runtime environment. Then, click Next at the bottom of the page.
    ParameterDescription
    Cluster typeSelect Kubernetes Cluster.
    Application runtime environmentSelect the Java application type and then select a deployment method.
    • Custom: Use this option to deploy an application in a K8s cluster using a custom image.
    • Java: Supports deployment from a generic JAR package. This option is suitable for Dubbo and Spring Boot applications. After you select this option, you can change the Java environment.
    • Tomcat: Supports deployment from a generic WAR package. This option is suitable for Dubbo and Spring applications. After you select this option, you can change the Java environment and container version.
    • EDAS-Container (HSF): Use this option to deploy a High-Speed Service Framework (HSF) application from a WAR or FatJar package. After you select this option, you can change the Java environment, Pandora version, and Ali-Tomcat version.
  3. In the Configurations step, configure the environment information, basic information, and deployment method for the application, set the related resource parameters, and then click Next.

  4. On the Advanced Settings tab, expand Java Startup Parameter Settings. Click Edit to the right of Java Startup Parameter Settings and configure the following parameters as needed.
    ParameterDescription
    Memory configurationYou can configure the following parameters:
    • Initial heap memory: The initial heap size in MB. A value of 0 means the size is not limited.
    • Maximum heap memory: The maximum heap size in MB. The value can range from 0 to 0.85 × the memory limit of the application container.
    • Initial young generation space: The initial size of the young generation space in MB.
    • Maximum young generation space: The maximum size of the young generation space in MB. If you enter max_uintx, the memory usage is not limited.
    • Eden/Survivor ratio: The ratio of the Eden space size to the Survivor space size.
    • Old/Young generation ratio: The ratio of the old generation space size to the young generation space size.
    • Initial permanent generation: The initial size of the permanent generation space in MB.
    • Maximum permanent generation: The maximum size of the permanent generation space in MB.
    • Maximum direct memory: The maximum size of direct memory for non-blocking I/O (NIO) in MB.
    • Thread stack size: The thread stack size in KB.
    ApplicationFor an HSF application, you can configure the following information:
    • Bound port: The port that is bound to start the HSF service. The default value is 12200.
    • Serialization method: The serialization method for HSF. The default value is hessian.
    • Minimum thread pool size: The minimum size of the server-side thread pool for HSF. The default value is 50.
    • Maximum thread pool size: The maximum size of the server-side thread pool for HSF. The default value is 720.
    GC policyYou can configure the following garbage collection policies:
    • Young generation GC policy: The garbage collector for the young generation space.
    • Old generation GC policy: The garbage collector for the old generation space. You must configure the young generation garbage collector first.
    • Concurrent GC threads: The number of threads that are used for concurrent GC.
    • Parallel GC threads: The number of threads that are used for parallel GC.
    Coroutine featureTo use the coroutine feature, turn on the Coroutine feature switch.
    Note The Coroutine feature configuration item appears only when you select Dragonwell as the JDK.
    ToolsSet the Log directory, Number of files, and File size for GC log files, and the Dump path for memory overflow.
    Service registration and discovery configurationIf you want to use a self-managed Nacos registry, check this configuration item. If this option is not selected, the system automatically uses the shared EDAS registry.
    CustomIf the preceding parameters do not meet your requirements, you can configure custom parameters. Separate multiple parameters with spaces.
  5. Click Create Application.

  6. On the Creation Completed page, check the information in the Basic Information, Configurations, and Advanced Settings sections. Then, click Create Application.

    In the upper part of the Application Overview page, click View Details. On the Change List page, view the application change process. Wait several minutes until the application is deployed. After the application change process is complete, view the status of the instance in the Basic Information section of the Application Overview page. If the status shows that a pod is running, the application is deployed.

Configure Java startup parameters when you update an application

You can configure Java startup parameters when you create an application or when you deploy or update it.

  1. Log on to the EDAS consoleEDAS console.

  2. In the left-side navigation pane, click Application Management > Applications. In the top navigation bar, select a region. In the upper part of the page, select a namespace. 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 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. After you set the environment and deployment package information for the application, expand Java Startup Parameter Settings. Click Edit to the right of Java Startup Parameter Settings, configure the parameters as needed, and then click OK.
    ParameterDescription
    Memory configurationYou can configure the following parameters:
    • Initial heap memory: The initial heap size in MB. A value of 0 means the size is not limited.
    • Maximum heap memory: The maximum heap size in MB. The value can range from 0 to 0.85 × the memory limit of the application container.
    • Initial young generation space: The initial size of the young generation space in MB.
    • Maximum young generation space: The maximum size of the young generation space in MB. If you enter max_uintx, the memory usage is not limited.
    • Eden/Survivor ratio: The ratio of the Eden space size to the Survivor space size.
    • Old/Young generation ratio: The ratio of the old generation space size to the young generation space size.
    • Initial permanent generation: The initial size of the permanent generation space in MB.
    • Maximum permanent generation: The maximum size of the permanent generation space in MB.
    • Maximum direct memory: The maximum size of direct memory for non-blocking I/O (NIO) in MB.
    • Thread stack size: The thread stack size in KB.
    ApplicationFor an HSF application, you can configure the following information:
    • Bound port: The port that is bound to start the HSF service. The default value is 12200.
    • Serialization method: The serialization method for HSF. The default value is hessian.
    • Minimum thread pool size: The minimum size of the server-side thread pool for HSF. The default value is 50.
    • Maximum thread pool size: The maximum size of the server-side thread pool for HSF. The default value is 720.
    GC policyYou can configure the following garbage collection policies:
    • Young generation GC policy: The garbage collector for the young generation space.
    • Old generation GC policy: The garbage collector for the old generation space. You must configure the young generation garbage collector first.
    • Concurrent GC threads: The number of threads that are used for concurrent GC.
    • Parallel GC threads: The number of threads that are used for parallel GC.
    Coroutine featureTo use the coroutine feature, turn on the Coroutine feature switch.
    Note The Coroutine feature configuration item appears only when you select Dragonwell as the JDK.
    ToolsSet the Log directory, Number of files, and File size for GC log files, and the Dump path for memory overflow.
    Service registration and discovery configurationIf you want to use a self-managed Nacos registry, check this configuration item. If this option is not selected, the system automatically uses the shared EDAS registry.
    CustomIf the preceding parameters do not meet your requirements, you can configure custom parameters. Separate multiple parameters with spaces.
    Important After you click OK, the application restarts. Perform this operation during off-peak hours.

View the results

  • Method one:

    On the Change Record page of the application, view the details of the application change. If the change is successful, the deployment is successful and the configuration has taken effect.

  • Method two:

    On the Application Overview page, click the pod status link to the right of Running Status. In the Container Group (Pod) section, view the Status of the pod. If a green circle appears, indicating that the pod is running, the deployment is successful and the configuration has taken effect.

DingTalk group for ACK and Serverless Kubernetes clusters

If you have questions or suggestions about using Container Service for Kubernetes (ACK) and Serverless Kubernetes clusters in EDAS, you can join the DingTalk group by searching for the ID 23197114 in DingTalk.