在 CentOS 上调优 WebLogic,通常从 操作系统层(CentOS)、JVM 层、WebLogic 自身配置 三个维度来做。下面按实战顺序说明。
WebLogic 是网络密集型应用,重点关注 TCP、文件句柄、内存。
# 文件描述符
fs.file-max = 6815744
# TCP 连接
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 300
net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
# 内存(大页可选)
vm.swappiness = 10
执行:
sysctl -p
WebLogic 用户(如 weblogic):
weblogic soft nofile 65535
weblogic hard nofile 65535
weblogic soft nproc 65535
weblogic hard nproc 65535
systemctl stop firewalld
systemctl disable firewalld
# 或配置白名单
mount -o remount,noatime /
WebLogic 默认使用 HotSpot JVM(JDK 8 常见)。
路径示例:
$DOMAIN_HOME/bin/setDomainEnv.sh
-Xms4g
-Xmx4g
-XX:MetaspaceSize=512m
-XX:MaxMetaspaceSize=512m
-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-Xloggc:/app/logs/gc.log
建议:
- 堆内存 = 物理内存的 50%~70%
- Xms = Xmx(避免动态扩容)
WebLogic 默认自动调优,一般不需要手动改,但可限制上限:
<server>
<max-threads-constraint>
<name>maxThreads</name>
<count>200</count>
</max-threads-constraint>
</server>
Initial Capacity: 20
Max Capacity: 100
Min Capacity: 20
Statement Cache Size: 50
Administration Console
Server → Configuration → Tuning
Accept Backlog = 65535
Server → Configuration → General
Enable Native IO = true
top
vmstat 1
iostat -x 1
netstat -an | grep 7001 | wc -l
-Xms8g
-Xmx8g
-XX:+UseG1GC
Max Threads = 200
JDBC Max = 100
Accept Backlog = 65535
如果你能提供:
我可以给你一套 精准参数模板。