All Products
Search
Document Center

Enterprise Distributed Application Service:Configure Tomcat

Last Updated:Oct 24, 2023

When you create or deploy an application in a Container Service Kubernetes cluster or a ACK Serverless cluster by using a WAR or JAR package, you can configure parameters including the application port, the access path, and the maximum number of threads.

Configure Tomcat when you create an application

  1. Log on to the EDAS console.

  2. 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.

  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 the Java application type and deploy the application by using a JAR package or a WAR package.

    • Custom: Select this option if you want to use the Tomcat configuration of the application. If you select this option, you can use an image to deploy the application. If you select a custom runtime environment, Tomcat Configuration does not appear on the Advanced Application Settings tab.

    • 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, and deployment method for the application, set the related resource parameters, and then click Next.

  5. In the Advanced Settings step, click Tomcat Configuration, select Custom Configuration, and click Edit next to Custom Configuration. In the Application Settings dialog box, set the parameters in the following table, and click OK.

    Parameter

    Description

    Application Port

    The port range is 1024 to 65535. The admin permission is configured for the container, but the root permission is required to perform operations on ports with numbers less than 1024. Therefore, enter a value greater than 1024 within the range. If you do not specify this parameter, the default number 8080 is used.

    Tomcat Context

    Select an application access path:

    • Package Name: The application access path is the name of the JAR package or the WAR package. You do not need to enter a custom path.

    • Root Directory: The application access path is /. You do not need to enter a custom path.

    • Custom: If you select this option, you must set Custom Path to a custom path.

    Maximum Threads

    Specify the maximum number of connections in the connection pool. This parameter corresponds to the maxThreads parameter. The default value is 400.

    Warning

    This parameter has great impacts on the application performance. We recommend that you set this parameter under professional guidance.

    Tomcat Encoding

    Select an encoding format for Tomcat. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. If you do not specify this parameter, the default value ISO-8859-1 is used.

    Use Advanced Settings

    When the preceding parameter type and specific parameters cannot meet your requirements, select Use Advanced Settings to directly edit the server.xml file of Tomcat.

    Important

    This parameter is available only if a WAR package is used for deployment.

  6. Click Create Application.

  7. 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 Tomcat when you update an application

You can configure Tomcat when you create an application, or configure or update Tomcat when you deploy an application.

  1. Log on to the EDAS 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. Set the application environment and deployment package information. In the Advanced Application Settings step, click Tomcat Configuration, select Custom Configuration, and click Edit next to Custom Configuration. In the Edit Tomcat Configuration dialog box, set the parameters in the following table, and click OK.

    Parameter

    Description

    Application Port

    The port range is 1024 to 65535. The admin permission is configured for the container, but the root permission is required to perform operations on ports with numbers less than 1024. Therefore, enter a value greater than 1024 within the range. If you do not specify this parameter, the default number 8080 is used.

    Tomcat Context

    Select an application access path:

    • Package Name: The application access path is the name of the JAR package or the WAR package. You do not need to enter a custom path.

    • Root Directory: The application access path is /. You do not need to enter a custom path.

    • Custom: If you select this option, you must set Custom Path to a custom path.

    Maximum Threads

    Specify the maximum number of connections in the connection pool. This parameter corresponds to the maxThreads parameter. The default value is 400.

    Warning

    This parameter has great impacts on the application performance. We recommend that you set this parameter under professional guidance.

    Tomcat Encoding

    Select an encoding format for Tomcat. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. If you do not specify this parameter, the default value ISO-8859-1 is used.

    Use Advanced Settings

    When the preceding parameter type and specific parameters cannot meet your requirements, select Use Advanced Settings to directly edit the server.xml file of Tomcat.

    Important

    This parameter is available only if a WAR package is used for deployment.

    Important

    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 pods. 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.