Java 堆栈空间与最大服务器请求线程数 [英] Java stack space versus maximum server request threads

查看:39
本文介绍了Java 堆栈空间与最大服务器请求线程数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

服务器中的 Java 堆栈空间和最大请求​​线程数是否相互关联?

Are Java stack space and maximum number of request threads in a server related to each other?

它们之间的关系会不会导致服务器不响应请求而挂掉?

Can the relationship between them result in the server not responding to requests and hanging?

推荐答案

线程在分配时每个都有自己的堆栈,并且每个堆栈可以达到的最大大小(取决于 VM 实现).因此,例如,您的堆栈大小可能设置为 1MB,但您可能有 1000 个线程,它们之间总共可以使用 1GB 的最大堆栈.

Threads are each given their own stack when allocated, and there is a maximum size that each stack can reach (depending on the VM implementation). So, your stack size may be set at 1MB, for example, but you might have 1000 threads giving you a total of 1GB maximum stack use between them.

如果堆栈溢出,通常会出现异常.我想如果你有很多线程在堆栈上保存了很多状态,它们没有完成,也没有溢出,那么你可能会耗尽你的内存并看到类似挂起的东西.

If a stack overruns, typically you get an exception. I suppose if you have a whole lot of threads holding a lot of state on the stack, that are not completing, and not overrunning, then you might exhaust your memory and see something resembling a hang.

这个问题https://stackoverflow.com/a/20030999/857994有一些有趣的信息,如果你想看看那个.

This question https://stackoverflow.com/a/20030999/857994 has some interesting information if you want to take a look at that.

这篇关于Java 堆栈空间与最大服务器请求线程数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆