使用Weblogic版本:Weblogic 11g(10.3.6) java
設置Weblogic的線程數有兩種方法, web
第一種,經過啓動參數設置: ide
1
|
-Dweblogic.threadpool.MinPoolSize=1000 -Dweblogic.threadpool.MaxPoolSize=1000
|
能夠加在setDomainEnv.sh文件JAVA_OPTIONS下面; spa
第二種,經過config.xml配置文件: 線程
1
2
3
4
5
|
<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下,有可能會出現如下錯誤: server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
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下系統對用戶的默認線程數作了限制,能夠經過: xml
1
|
ulimit -a
|
命令進行查看: blog
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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
|
其中 ip
1
|
max user processes (-u) 1024
|
表示當前系統容許的最大線程數,能夠把此參數設大一些。 ci
1
|
ulimit -u 5000
|
設置當前系統用戶最大容許的線程數,只對本次會話有效,若是想要永久生效,能夠經過修改:
1
2
3
4
5
6
|
$ 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改爲你須要的值便可,設置完須要重啓系統已生效。