helper icon indicating copy to clipboard operation
helper copied to clipboard

Thread Pool size

Open PedroMPagani opened this issue 3 years ago • 4 comments

Hey, the async option from the Executors doesn't limit the number of threads that can be used in the pool, users have to be very careful when using that to not get an out of memory, a proper usage of it would be to limit the number of threads.

PedroMPagani avatar Aug 16 '22 11:08 PedroMPagani

If I’m not mistaken helper’s asynchronous executor uses a cached thread pool which should remove unused threads after a certain period of time. So unless you’re running an extremely large number of long and intensive tasks, it should be fine.

connorruesch avatar Aug 19 '22 16:08 connorruesch

You're not mistaken, that is correct, but when executing many things at the same time will end up in our of memory, don't you think that there should be a max limit? Specially for developers, people tend to think that just running async will fix any lag issue.

PedroMPagani avatar Aug 20 '22 08:08 PedroMPagani

Perhaps just give callers the choice of dropping their own executor instance if wanted to? Similarly to how CompletableFuture allows it with its factory methods CompletableFuture::runAsync and CompletableFuture::supplyAsync.

conclube avatar Aug 20 '22 09:08 conclube

That sounds more like an open idea, good thinking!

PedroMPagani avatar Aug 20 '22 09:08 PedroMPagani