在 Debian 系统上运行 WebLogic Server(通常运行在 Oracle JDK/JRockit 上) 时,优化主要从 操作系统层、JVM 层、WebLogic 配置层、应用层 四个方面入手。下面给你一个实用、可落地的优化清单。
WebLogic 是高并发服务,默认 1024 太小。
# 查看
ulimit -n
# 修改(临时)
ulimit -n 65536
# 永久(/etc/security/limits.conf)
weblogic soft nofile 65536
weblogic hard nofile 65536
并确保:
/etc/pam.d/common-session
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
systemctl disable bluetooth
systemctl disable cups
示例(8G 内存服务器):
-Xms4g
-Xmx4g
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=512m
✅ 建议:
-Xms = -Xmx(避免动态扩容)-XX:+UseG1GC
-XX:MaxGCPauseMillis=200
-XX:+PrintGCDetails
-XX:+PrintGCDateStamps
-Xloggc:/opt/weblogic/logs/gc.log
WebLogic 默认自动调节,一般 不要手动写死线程数。
优化点:
<server>
<max-open-sock-count>65535</max-open-sock-count>
</server>
# 管理控制台
Server → Configuration → Tuning
Accept Backlog = 1024
常见错误是连接池太小。
建议:
Initial Capacity = 20
Max Capacity = 100
Min Capacity = 20
Inactive Connection Timeout = 300
Server → Configuration → General
✅ Enable Native IO
(Linux 下性能明显更好)
<session-config>
<session-timeout>30</session-timeout>
</session-config>
Nginx → WebLogic
Nginx 示例:
proxy_read_timeout 60s;
proxy_buffering on;
top
vmstat 1
iostat -x 1
jstack
jstat -gcutil
| 场景 | 优化点 |
|---|---|
| 高并发 | 文件句柄 + Accept Backlog |
| 响应慢 | GC + JDBC 连接池 |
| CPU 高 | 线程池 + 应用阻塞 |
| OOM | Metaspace + 堆 |
你可以告诉我:
我可以给你一套 针对性配置模板。