多次列出的 Tomcat 进程

多次列出的 Tomcat 进程

我的 Centos 7 上有一个运行着 Tomcat 9 服务器。

当我发出htop命令时,我有一个 tomcat 进程被列出多次,我想了解为什么它会出现多次

 PID USER      PRI  NI  VIRT   RES   SHR S CPU% MEM%   TIME+  Command
   18 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:07.27 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    1 root       20   0 5517M 1264M 13248 S  0.0 10.9  1:16.08 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   20 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:01.05 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   33 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.25 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   36 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.36 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   17 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:34.36 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   38 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.86 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   21 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.08 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   42 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.70 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   58 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.22 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   13 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.95 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   35 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.39 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   40 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.31 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   34 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.85 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   37 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.37 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   24 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.09 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   10 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:21.94 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   11 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.90 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   12 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.93 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   14 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.01 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   15 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.02 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   16 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.00 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   19 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.06 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   22 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.02 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   23 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.00 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   25 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.06 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   28 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.00 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   29 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.00 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   31 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.04 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   32 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.04 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   39 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.74 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   41 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.25 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   44 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.12 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   45 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.02 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
   46 root       20   0 5517M 1264M 13248 S  0.0 10.9  0:00.00 /docker-java-home/jre/bin/java -Djava.util.logging.config.file=/usr/local/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

/etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat Web Application Container
Wants=network.target
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b10-0.el8_0.x86_64/jre

Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1G -Djava.net.preferIPv4Stack=true'
Environment='JAVA_OPTS=-Djava.awt.headless=true'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
SuccessExitStatus=143

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

使 Tomcat 服务在系统启动时自动启动。

systemctl enable tomcat

答案1

您可能需要检查 tomcat home 中以下文件的内容:$CATALINA_HOME/conf/server.xml(如果您不确定它在哪里,只需定位 server.xml)并检查文件中的 maxThreads 和 minSpareThreads 设置。

基本上它主要用于高负载/高并发用户 - tomcat 设置。该设置只是告诉 tomcat 处理 http 请求所需/可以产生的线程的最小值和最大值。

希望这能回答你的问题

相关内容