vdbench OutOfMemoryError无法创建新的本机线程

时间:2014-07-15 16:53:41

标签: jvm out-of-memory

在运行具有高队列深度(256)的多个并发vdbench实例时,我遇到了JVM错误。

localhost-0.stdout.html:

的输出
19:49:13.281 19:49:13.281 Started 1 Workload Generator threads.
19:49:13.345 19:49:13.345 Out of memory:
19:49:13.345
19:49:13.345             modify the vdbench script and increase the '-Xmx512m' value where 512m equals the java heap size requested.
19:49:13.345 19:49:13.345 If the error message says 'unable to create new native thread' modify the vdbench script adding '-Xss256k' or lower value for the java thread stack size.
19:49:13.345
19:49:13.345
19:49:13.345 19:49:13.345 Examples are for Solaris. For other platforms see the Java provider's documentation
19:49:13.346 19:49:13.345 Memory total Java heap:  253.000 MB; Free:  221.013 MB; Used:   31.987 MB;
19:49:13.346 java.lang.OutOfMemoryError: unable to create new native thread
19:49:13.346    at java.lang.Thread.start0(Native Method)
19:49:13.347    at java.lang.Thread.start(Thread.java:713)
19:49:13.347    at Vdb.SlaveWorker.StartIoThreads(SlaveWorker.java:329)
19:49:13.347    at Vdb.SlaveWorker.doRegularWorkload(SlaveWorker.java:211)
19:49:13.347    at Vdb.SlaveWorker.run(SlaveWorker.java:129)
19:49:13.347 java.lang.OutOfMemoryError: unable to create new native thread
19:49:13.347    at java.lang.Thread.start0(Native Method)
19:49:13.347    at java.lang.Thread.start(Thread.java:713)
19:49:13.347 19:49:13.347 common.failure(): System.exit(-99)
19:49:13.347    at Vdb.SlaveWorker.StartIoThreads(SlaveWorker.java:329)
19:49:13.347    at Vdb.SlaveWorker.doRegularWorkload(SlaveWorker.java:211)
19:49:13.347    at Vdb.SlaveWorker.run(SlaveWorker.java:129)

虽然我尝试使用'-Xmx512m,-Xss256k(最小可能),-Xms256m'更改_JAVA_OPTIONS中的值,但错误仍然存​​在。有没有人有这方面的经验?

1 个答案:

答案 0 :(得分:1)

我找到了解决方法。以防任何人去哪儿。

队列深度或线程数限制为系统允许的最大用户进程(普通用户默认为1024)。在Linux中,您可以通过以下方式检查最大用户进程限制:

# ulimit -a 
core file size          (blocks, -c) 0 
data seg size           (kbytes, -d) unlimited 
file size               (blocks, -f) unlimited 
pending signals                 (-i) 8191 
max locked memory       (kbytes, -l) 32 
max memory size         (kbytes, -m) unlimited 
open files                      (-n) 1024 
pipe size            (512 bytes, -p) 8 
POSIX message queues     (bytes, -q) 819200 
stack size              (kbytes, -s) 8192 
cpu time               (seconds, -t) unlimited 
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited 
file locks                      (-x) unlimited 

提高此限制解决了我的问题。 您可以通过发出以下内容来提高限额:

ulimit -u 4096

或者您使用的是CentOS,请编辑 /etc/security/limits.d/90-nproc.conf 并将该行更改为:

<强> * soft nproc 4096