分享

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

 liang1234_ 2019-04-06

使用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改成你需要的值即可,设置完需要重启系统已生效。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多