通過設定Weblogic設定執行緒數提高系統併發
阿新 • • 發佈:2018-12-30
使用Weblogic版本:Weblogic 11g(10.3.6)
設定Weblogic的執行緒數有兩種方法,
第一種,通過啟動引數設定:
-Dweblogic.threadpool.MinPoolSize=1000 -Dweblogic.threadpool.MaxPoolSize=1000
可以加在setDomainEnv.sh檔案JAVA_OPTIONS下面;
第二種,通過config.xml配置檔案:
<server> <name>AdminServer</name> <self-tuning-thread-pool-size-min>1000</self-tuning-thread-pool-size-min> <self-tuning-thread-pool-size-max>1000</self-tuning-thread-pool-size-max> </server>
Window環境下設定完應該直接重新啟動就可以生效,Linux下,有可能會出現以下錯誤:
Attempting to allocate 4G bytes
There is insufficient native memory for the Java
Runtime Environment to continue.
Possible reasons:
The system is out of physical RAM or swap space
In 32 bit mode, the process size limit was hit
Possible solutions:
Reduce memory load on the system
Increase physical memory or swap space
Check if swap backing store is full
Use 64 bit Java on a 64 bit OS
Decrease Java heap size (-Xmx/-Xms)
Decrease number of Java threads
Decrease Java thread stack sizes (-Xss)
Disable compressed references (-XXcompressedRefs=false)
java.lang.OutOfMemoryError: Resource temporarily unavailable in tsStartJavaThread (lifecycle.c:1097).
Attempting to allocate 4G bytes
There is insufficient native memory for the Java
Runtime Environment to continue.
Possible reasons:
The system is out of physical RAM or swap space
In 32 bit mode, the process size limit was hit
Possible solutions:
Reduce memory load on the system
Increase physical memory or swap space
Check if swap backing store is full
Use 64 bit Java on a 64 bit OS
Decrease Java heap size (-Xmx/-Xms)
Decrease number of Java threads
Decrease Java thread stack sizes (-Xss)
Disable compressed references (-XXcompressedRefs=false)
出現這個原因的問題可能是因為Linux下系統對使用者的預設執行緒數做了限制,可以通過:
ulimit -a
命令進行檢視:
core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 515223 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 1024 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
其中
max user processes (-u) 1024
表示當前系統允許的最大執行緒數,可以把此引數設大一些。
ulimit -u 5000
設定當前系統使用者最大允許的執行緒數,只對本次會話有效,如果想要永久生效,可以通過修改:
$ cat /etc/security/limits.d/90-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
只需要將1024改成你需要的值即可,設定完需要重啟系統已生效。
最後歡迎大家訪問我的個人網站:1024s