温馨提示×

debian中weblogic如何调优

小樊
43
2026-09-20 16:25:23
栏目: 智能运维

在 Debian 上运行 WebLogic Server(WLS) 的调优,通常可以从 操作系统层、JVM 层、WebLogic 自身配置、应用层 四个维度来做。下面按实战角度说明。


一、Debian 系统层调优

1. 文件描述符(重要)

WebLogic 连接多,容易报 too many open files

# 查看
ulimit -n

# 临时
ulimit -n 65536

# 永久(/etc/security/limits.conf)
weblogic soft nofile 65536
weblogic hard nofile 65536

确保 PAM 启用:

# /etc/pam.d/common-session
session required pam_limits.so

2. 内核参数(TCP / 网络)

编辑 /etc/sysctl.conf

net.core.somaxconn = 65535
net.core.netdev_max_backlog = 65535
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
sysctl -p

3. 关闭 swap(如内存充足)

swapoff -a

(生产环境视情况)


二、JVM 调优(最关键)

1. 选择合适的 JDK

  • WebLogic 12c+ → JDK 8 / 11
  • 推荐使用 Oracle JDK 或 OpenJDK(HotSpot)

2. 设置 JVM 参数

修改:

$DOMAIN_HOME/bin/setDomainEnv.sh

示例(8G 内存):

USER_MEM_ARGS="-Xms4g -Xmx4g -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=512m"
export USER_MEM_ARGS

GC 推荐:

  • JDK8:
-XX:+UseG1GC -XX:MaxGCPauseMillis=200
  • JDK11:
-XX:+UseG1GC

3. JVM 监控

-XX:+PrintGCDetails -Xloggc:/logs/weblogic/gc.log

三、WebLogic Server 调优

1. 线程池(自调节线程池)

WebLogic 默认使用 自调节线程池,一般无需手动改,但可限制:

Administration Console
→ Servers → your_server → Tuning

建议:

  • Accept Backlog = 1000+
  • Login Timeout = 5s

2. JDBC 连接池

Services → JDBC → Data Sources → Connection Pool

配置建议:

  • Initial Capacity = 10
  • Max Capacity = 50~100(视 DB 能力)
  • Statement Cache Size = 50
  • Test Connections On Reserve = true

3. 启用 Native IO(重要)

确保:

Servers → your_server → Configuration → General
→ Enable Native IO = true

4. 关闭不必要的服务

  • WebLogic Tuxedo
  • IIOP(如不用)
  • EJB 容器(如不用)

四、应用与部署调优

1. Session 超时

<session-config>
  <session-timeout>30</session-timeout>
</session-config>

2. 使用生产模式

# 创建域时选择 Production Mode

3. 启用 Gzip(前端)

web.xml 或反向代理(Nginx)中开启。


五、常见性能问题定位

1. 线程阻塞

jstack <pid> > thread.txt

2. 内存泄漏

jmap -dump:live,format=b,file=heap.hprof <pid>

使用 MAT 分析。

3. 连接池耗尽

查看:

Console → JDBC → Monitoring → Active Connections

六、推荐组合(示例)

8C16G Debian + WebLogic 12c + JDK8

-Xms8g -Xmx8g
-XX:+UseG1GC
nofile=65536
Max Capacity=80
Accept Backlog=2000

如果你能提供:

  • WebLogic 版本
  • JDK 版本
  • 并发量 / 应用场景(ERP?接口?)

我可以给你一份 定制化调优方案

0