通过设置Weblogic设置线程数提高系统并发

使用Weblogic版本:Weblogic 11g(10.3.6)

设置Weblogic的线程数有两种方法,

第一种,通过启动参数设置:

-Dweblogic.threadpool.MinPoolSize=1000 -Dweblogic.threadpool.MaxPoolSize=1000

 

可以加在setDomainEnv.sh文件JAVA_OPTIONS下面;

第二种,通过config.xml配置文件:

 
  1. <server>

  2.     <name>AdminServer</name>

  3.     <self-tuning-thread-pool-size-min>1000</self-tuning-thread-pool-size-min>

  4.     <self-tuning-thread-pool-size-max>1000</self-tuning-thread-pool-size-max>

  5. </server>

 

 

Window环境下设置完应该直接重新启动就可以生效,Linux下,有可能会出现以下错误:

 
  1.  
  2. Attempting to allocate 4G bytes

  3.  
  4. There is insufficient native memory for the Java

  5. Runtime Environment to continue.

  6.  
  7. Possible reasons:

  8.   The system is out of physical RAM or swap space

  9.   In 32 bit mode, the process size limit was hit

  10.  
  11. Possible solutions:

  12.   Reduce memory load on the system

  13.   Increase physical memory or swap space

  14.   Check if swap backing store is full

  15.   Use 64 bit Java on a 64 bit OS

  16.   Decrease Java heap size (-Xmx/-Xms)

  17.   Decrease number of Java threads

  18.   Decrease Java thread stack sizes (-Xss)

  19.   Disable compressed references (-XXcompressedRefs=false)

  20.  
  21. java.lang.OutOfMemoryError: Resource temporarily unavailable in tsStartJavaThread (lifecycle.c:1097).

  22.  
  23. Attempting to allocate 4G bytes

  24.  
  25. There is insufficient native memory for the Java

  26. Runtime Environment to continue.

  27.  
  28. Possible reasons:

  29.   The system is out of physical RAM or swap space

  30.   In 32 bit mode, the process size limit was hit

  31.  
  32. Possible solutions:

  33.   Reduce memory load on the system

  34.   Increase physical memory or swap space

  35.   Check if swap backing store is full

  36.   Use 64 bit Java on a 64 bit OS

  37.   Decrease Java heap size (-Xmx/-Xms)

  38.   Decrease number of Java threads

  39.   Decrease Java thread stack sizes (-Xss)

  40.   Disable compressed references (-XXcompressedRefs=false)

 

出现这个原因的问题可能是因为Linux下系统对用户的默认线程数做了限制,可以通过:

ulimit -a

 

命令进行查看:

 
  1. core file size          (blocks, -c) 0

  2. data seg size           (kbytes, -d) unlimited

  3. scheduling priority             (-e) 0

  4. file size               (blocks, -f) unlimited

  5. pending signals                 (-i) 515223

  6. max locked memory       (kbytes, -l) 64

  7. max memory size         (kbytes, -m) unlimited

  8. open files                      (-n) 1024

  9. pipe size            (512 bytes, -p) 8

  10. POSIX message queues     (bytes, -q) 819200

  11. real-time priority              (-r) 0

  12. stack size              (kbytes, -s) 10240

  13. cpu time               (seconds, -t) unlimited

  14. max user processes              (-u) 1024

  15. virtual memory          (kbytes, -v) unlimited

  16. file locks                      (-x) unlimited

 

其中

max user processes              (-u) 1024

 

表示当前系统允许的最大线程数,可以把此参数设大一些。

ulimit -u 5000

 

设置当前系统用户最大允许的线程数,只对本次会话有效,如果想要永久生效,可以通过修改:

 
  1. $ cat /etc/security/limits.d/90-nproc.conf 

  2. # Default limit for number of user's processes to prevent

  3. # accidental fork bombs.

  4. # See rhbz #432903 for reasoning.

  5.  
  6. *          soft    nproc    1024

 

只需要将1024改成你需要的值即可,设置完需要重启系统已生效。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值