我应该使用哪个环境变量向 Tomcat 添加更多 RAM?
JAVA_OPTS="-Xmx1024m -Xms256m"
或者
CATALINA_OPTS="-Xmx1024m -Xms256m"
?
Either will work. However, from skill-guru...
Note that CATALINA_OPTS is a better place than JAVA_OPTS. The former is only used when actually starting the Tomcat instance. JAVA_OPTS is also used to start JVMs that only interact with Tomcat (for example the JVM instance that is used to send the shutdown-message to a running Tomcat instance).
When you'll use CATALINA_OPTS then it's clear that this option is related to Tomcat server. Also when you'll use JAVA_OPTS then any other application could use this settings, and that isn't something that you probably intentionally want to achieve.
JAVA_OPTS。您正在为 java 命令提供选项,而不是 catalina 选项(它是一个 shell 脚本)。