Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top