Java stack space versus maximum server request threads

这一生的挚爱 提交于 2019-12-11 12:41:50

问题


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?


回答1:


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.

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



来源:https://stackoverflow.com/questions/22308073/java-stack-space-versus-maximum-server-request-threads

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!