limit size of thread pool

default of 1000 threads uses too much memory, as the threads keep running.