If you use WAR files to deploy applications, you can configure custom Java Tomcat parameters. For example, you can configure custom application ports, application access paths, and maximum number of threads. This topic describes how to configure and modify Java Tomcat parameters in the SAE console.
Prerequisites
The Application Deployment Method parameter is set to Deployment with WAR Packages.Procedure
Configure Java Tomcat when you create applications
- Log on to the SAE console.
- In the left-side navigation pane, click Applications. In the top navigation bar, select a region. Then, click Create Application.
- In the Basic Information step, configure the parameters and click Next: Application Deployment Configurations.
- In the Deployment Configurations step, configure the Technology Stack Programming Language and Application Deployment Method parameters and the corresponding settings.
- In the Java Tomcat Settings section, select Custom Configuration and click Edit.
- In the Edit Java Tomcat Configuration panel, configure the parameters and click OK.
Parameter Description Application Port The port number used by the application. Valid values: 1024 to 49151. Default value: 8080. Tomcat Context The application access path. Valid values: - Package Name: The name of the WAR file is used. You do not need to configure this parameter. This setting is supported only if you set the File Upload Method parameter to Upload WAR Package.
- Root Directory: The application access path is /.
- Custom: Specify an application access path in the Custom Path field.
Maximum Threads The maximum number of threads that concurrently process requests. Valid values: 10 to 1024. Default value: 400. Important The value of the Maximum Threads parameter affects the application performance. Exercise caution when you configure this parameter.Tomcat Encoding The encoding format for Tomcat. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. Default value: ISO-8859-1. Use Body Encoding for URL By default, this feature is enabled. In this case, you can use the character set of the HTTP request body to decode query parameters (QueryString). - Click Next: Confirm Specifications.
- In the Specification Confirmation step, view the details of the application and the fee for the selected specifications. Then, click Confirm. The Creation Completed step appears. You can click Application Details to go to the Basic Information page of the application.
- Check whether the configurations have taken effect.
- Method 1:
In the left-side navigation pane of the Basic Information page, click Change Records. On the Change Records page, view the change details. If Executed is displayed in the Change Status column, the application is deployed and the configurations have taken effect.
- Method 2:
On the Basic Information page, click the Instance Deployment Information tab to view the Status of the instances. If Running is displayed in the Status column, the application is deployed and the configurations have taken effect.
- Method 1:
Configure Java Tomcat when you deploy applications
The procedure that can be performed to update an application varies based on the number of instances in the application. This section provides an example on how to configure the required features for an application in which the number of instances is greater than or equal to 1. For information about how to update an application in which the number of instances is 0, see Update an application.
- Log on to the SAE console.
- In the left-side navigation pane, click Applications. In the top navigation bar, select a region. Then, click the name of an application.
- In the upper-right corner of the Basic Information page, click Deploy Application.
- In the Java Tomcat Settings section, select Custom Configuration and click Edit.
- In the Edit Java Tomcat Configuration panel, configure the parameters and click OK.
Parameter Description Application Port The port number used by the application. Valid values: 1024 to 49151. Default value: 8080. Tomcat Context The application access path. Valid values: - Package Name: The name of the WAR file is used. You do not need to configure this parameter. This setting is supported only if you set the File Upload Method parameter to Upload WAR Package.
- Root Directory: The application access path is /.
- Custom: Specify an application access path in the Custom Path field.
Maximum Threads The maximum number of threads that concurrently process requests. Valid values: 10 to 1024. Default value: 400. Important The value of the Maximum Threads parameter affects the application performance. Exercise caution when you configure this parameter.Tomcat Encoding The encoding format for Tomcat. Valid values: UTF-8, ISO-8859-1, GBK, and GB2312. Default value: ISO-8859-1. Use Body Encoding for URL By default, this feature is enabled. In this case, you can use the character set of the HTTP request body to decode query parameters (QueryString). - After you configure the settings, click Confirm.
Modify a Java Tomcat configuration file by using a ConfigMap
If the preceding Java Tomcat parameters provided in the SAE console cannot meet your business requirements, or if you want to modify your Java Tomcat configuration file, you can create a ConfigMap.
After you deploy your application in SAE by using a WAR file, the server.xml file is saved in the /home/admin/apache-tomcat-8.5.42/conf directory. In this section, the server.xml file is used as an example to describe how to modify a Java Tomcat configuration file by using a ConfigMap.
- Modify the server.xml file.
- Create a ConfigMap. Note The namespace of a ConfigMap that you want to create must be the same as the namespace of the application for which you want to create the ConfigMap.After you create a ConfigMap, the ConfigMap is displayed on the ConfigMaps page.
- Deploy the application and mount the ConfigMap.