<tfoot id='L0Rhd'></tfoot>

      <i id='L0Rhd'><tr id='L0Rhd'><dt id='L0Rhd'><q id='L0Rhd'><span id='L0Rhd'><b id='L0Rhd'><form id='L0Rhd'><ins id='L0Rhd'></ins><ul id='L0Rhd'></ul><sub id='L0Rhd'></sub></form><legend id='L0Rhd'></legend><bdo id='L0Rhd'><pre id='L0Rhd'><center id='L0Rhd'></center></pre></bdo></b><th id='L0Rhd'></th></span></q></dt></tr></i><div id='L0Rhd'><tfoot id='L0Rhd'></tfoot><dl id='L0Rhd'><fieldset id='L0Rhd'></fieldset></dl></div>
    1. <small id='L0Rhd'></small><noframes id='L0Rhd'>

      <legend id='L0Rhd'><style id='L0Rhd'><dir id='L0Rhd'><q id='L0Rhd'></q></dir></style></legend>

      • <bdo id='L0Rhd'></bdo><ul id='L0Rhd'></ul>

      如何增加最大 JVM 线程数(Linux 64 位)

      How to increase maximum number of JVM threads (Linux 64bit)(如何增加最大 JVM 线程数(Linux 64 位))
      • <tfoot id='llSmc'></tfoot>

          <bdo id='llSmc'></bdo><ul id='llSmc'></ul>
          <legend id='llSmc'><style id='llSmc'><dir id='llSmc'><q id='llSmc'></q></dir></style></legend>
            <tbody id='llSmc'></tbody>

            <small id='llSmc'></small><noframes id='llSmc'>

              1. <i id='llSmc'><tr id='llSmc'><dt id='llSmc'><q id='llSmc'><span id='llSmc'><b id='llSmc'><form id='llSmc'><ins id='llSmc'></ins><ul id='llSmc'></ul><sub id='llSmc'></sub></form><legend id='llSmc'></legend><bdo id='llSmc'><pre id='llSmc'><center id='llSmc'></center></pre></bdo></b><th id='llSmc'></th></span></q></dt></tr></i><div id='llSmc'><tfoot id='llSmc'></tfoot><dl id='llSmc'><fieldset id='llSmc'></fieldset></dl></div>

              2. 本文介绍了如何增加最大 JVM 线程数(Linux 64 位)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我不能在 15G 内存的 Linux 机器上创建超过 32k 的 Java 线程.

                I cannot create more than 32k Java threads in Linux machine with 15G memory.

                推荐答案

                你可以使用 示例程序来找出当前线程限制.

                You can use a sample program to find out the current threads limit.

                如果您遇到 Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread,请检查:

                If you encounter Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread, check these:

                1. 在小型内存机器中

                1. In small memory machines

                每个 Java 线程都消耗自己的堆栈内存.默认堆栈大小为 1024k (= 1M).您可以像 java -Xss512k ... 那样减小堆栈大小.如果堆栈太小,JVM 将无法启动.

                Every Java thread consume its own stack memory. Default stack size is 1024k (= 1M). You can reduce the stack size like java -Xss512k .... JVM cannot be started if the stack size is too low.

                注意堆内存配置:(初始)-Xms 和(最大)-Xmx.分配给堆的内存越多,堆栈的可用内存就越少.

                And beware heap memory configurations: (initial) -Xms and (maximum) -Xmx. The more memory is allocated to heap, the less available memory for stack.

                系统限制

                ulimit -a 中的某些值会影响线程限制.

                Some values in ulimit -a can affect a thread limit.

                • 最大内存大小 - 在大多数 64 位机器上无限制
                • max user processes - linux 将线程视为进程
                • 虚拟内存 - 在大多数 64 位机器上无限制.-Xss 配置增加了虚拟内存使用量(默认 1024k)
                • max memory size - unlimited on most 64bit machines
                • max user processes - linux treats threads like processes
                • virtual memory - unlimited on most 64bit machines. virtual memory usage is increased by -Xss configuration (default 1024k)

                您可以通过(临时)运行 ulimit 命令或(永久)编辑 /etc/security/limits.conf 来更改这些值.

                You can change these values by (temporal) running ulimit command or (permanent) editing /etc/security/limits.conf.

                sys.kernel.threads-max

                这个值是系统全局(包括非JVM进程)的最大线程数.检查cat/proc/sys/kernel/threads-max,必要时增加.

                This value is the system-global (including non-JVM processes) maximum number of threads. Check cat /proc/sys/kernel/threads-max, and increase if necessary.

                回显 999999 >/proc/sys/kernel/threads-max

                /etc/sysctl.conf 中的 sys.kernel.threads-max = 999999 永久更改.

                sys.kernel.pid_max

                如果 cat/proc/sys/kernel/pid_max 类似于电流限制,则增加它.Linux 将线程视为进程.

                If cat /proc/sys/kernel/pid_max is similar to current limit, increase this. Linux treats threads like processes.

                回显 999999 >/proc/sys/kernel/pid_max

                /etc/sysctl.conf 中的 sys.kernel.pid_max = 999999 永久更改.

                您可能还需要增加 sys.vm.max_map_count.

                sys.vm.max_map_count

                cat/proc/sys/vm/max_map_count 至少应为 (2 x thread-count).

                cat /proc/sys/vm/max_map_count should be at least (2 x thread-count).

                尝试保护堆栈保护页面失败.OpenJDK 64 位服务器 VM 警告:尝试解除分配堆栈保护页面失败. JavaThread 发出错误消息::create_stack_guard_pages(),它调用 os::guard_memory().在 Linux 中,这个函数是 mprotect().

                Attempt to protect stack guard pages failed. and OpenJDK 64-Bit Server VM warning: Attempt to deallocate stack guard pages failed. error messages are emitted by JavaThread::create_stack_guard_pages(), and it calls os::guard_memory(). In Linux, this function is mprotect().

                回显 1999999 >/proc/sys/vm/max_map_count

                /etc/sysctl.conf 中的 sys.vm.max_map_count = 1999999 永久更改.

                这篇关于如何增加最大 JVM 线程数(Linux 64 位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Bytecode features not available in the Java language(Java 语言中不可用的字节码功能)
                ClassCastException because of classloaders?(ClassCastException 因为类加载器?)
                How can I add a Javaagent to a JVM without stopping the JVM?(如何在不停止 JVM 的情况下将 Javaagent 添加到 JVM?)
                Cannot load 64-bit SWT libraries on 32-bit JVM ( replacing SWT file )(无法在 32 位 JVM 上加载 64 位 SWT 库(替换 SWT 文件))
                Encourage the JVM to GC rather than grow the heap?(鼓励 JVM 进行 GC 而不是增加堆?)
                Why a sawtooth shaped graph?(为什么是锯齿形图形?)
              3. <small id='j1q0B'></small><noframes id='j1q0B'>

                  <tbody id='j1q0B'></tbody>
                  • <bdo id='j1q0B'></bdo><ul id='j1q0B'></ul>
                  • <legend id='j1q0B'><style id='j1q0B'><dir id='j1q0B'><q id='j1q0B'></q></dir></style></legend>
                    <tfoot id='j1q0B'></tfoot>

                      <i id='j1q0B'><tr id='j1q0B'><dt id='j1q0B'><q id='j1q0B'><span id='j1q0B'><b id='j1q0B'><form id='j1q0B'><ins id='j1q0B'></ins><ul id='j1q0B'></ul><sub id='j1q0B'></sub></form><legend id='j1q0B'></legend><bdo id='j1q0B'><pre id='j1q0B'><center id='j1q0B'></center></pre></bdo></b><th id='j1q0B'></th></span></q></dt></tr></i><div id='j1q0B'><tfoot id='j1q0B'></tfoot><dl id='j1q0B'><fieldset id='j1q0B'></fieldset></dl></div>