Managing the number of threads by available memory in Java

How to control the number of threads regarding available memory in Java. This means that I want to control the number of running threads, by encoding, relative to the memory available on the server. Any suggestions, tips, tutorials, libraries are welcome.

+4
source share
1 answer

Yes use the executorService function. In Java Concurrency, in practice, it is recommended to set the number of threads based on the number of processors. I think the formula was the number of threads = the number of processors + one, but I may remember wrong ...

+2

Source: https://habr.com/ru/post/1534986/


All Articles