打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
通过设置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. Attempting to allocate 4G bytes
  2. There is insufficient native memory for the Java
  3. Runtime Environment to continue.
  4. Possible reasons:
  5.   The system is out of physical RAM or swap space
  6.   In 32 bit mode, the process size limit was hit
  7. Possible solutions:
  8.   Reduce memory load on the system
  9.   Increase physical memory or swap space
  10.   Check if swap backing store is full
  11.   Use 64 bit Java on a 64 bit OS
  12.   Decrease Java heap size (-Xmx/-Xms)
  13.   Decrease number of Java threads
  14.   Decrease Java thread stack sizes (-Xss)
  15.   Disable compressed references (-XXcompressedRefs=false)
  16. java.lang.OutOfMemoryError: Resource temporarily unavailable in tsStartJavaThread (lifecycle.c:1097).
  17. Attempting to allocate 4G bytes
  18. There is insufficient native memory for the Java
  19. Runtime Environment to continue.
  20. Possible reasons:
  21.   The system is out of physical RAM or swap space
  22.   In 32 bit mode, the process size limit was hit
  23. Possible solutions:
  24.   Reduce memory load on the system
  25.   Increase physical memory or swap space
  26.   Check if swap backing store is full
  27.   Use 64 bit Java on a 64 bit OS
  28.   Decrease Java heap size (-Xmx/-Xms)
  29.   Decrease number of Java threads
  30.   Decrease Java thread stack sizes (-Xss)
  31.   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. *          soft    nproc    1024

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

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
剥下“java.lang.OutOfMemoryError: unable to create new native thread”的外衣
pthread之线程堆栈
Too many open files 问题的解决 - Linux - Tech - Ja...
HP_UNIX Java OutOfMemoryError unable to create new native thread
如何中断weblogic中stuck thread
WLS 的异常高CPU占用率
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服