在 Debian 系统上运行 WebLogic Server 时,优化通常分为 操作系统层、JVM 层、WebLogic 配置层、应用层 四个方向。下面给你一套比较实用、可落地的优化思路(以 WebLogic 12c/14c 为例,适用于生产环境)。
WebLogic 对连接数敏感,必须调高:
# 查看
ulimit -n
# 修改 /etc/security/limits.conf
weblogic soft nofile 65535
weblogic hard nofile 65535
并确保:
session required pam_limits.so
net.core.somaxconn = 65535
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 600
vm.swappiness = 10
应用:
sysctl -p
firewalld(若用 iptables)avahi、bluetooth 等无关服务systemd 管理 WebLogic 启动USER_MEM_ARGS="-Xms4g -Xmx4g -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m"
原则:
-Xms = -Xmx(避免动态扩容)JDK 8(推荐 Parallel / G1)
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
JDK 11+
-XX:+UseG1GC
-XX:+AlwaysPreTouch
-XX:ThreadStackSize=256k
WebLogic 默认自动调节,但可限制:
Initial Capacity = 10
Max Capacity = 50~100
Min Capacity = 10
Inactive Connection Timeout = 60
Test Connections On Reserve = true
-Dweblogic.nio.EnableDirectByteBuffer=true
确认:
WebLogic Server started in RUNNING mode (Native IO enabled)
服务器 → 协议 → HTTP
KeepAlive: true
Duration: 30
WARNINGjstat -gcutiljstack-Xms4g -Xmx4g
-XX:+UseG1GC
-XX:MaxMetaspaceSize=512m
-Dweblogic.nio.EnableDirectByteBuffer=true
如果你愿意,可以告诉我:
我可以给你一套 针对性配置模板。