Set number of connections according to number of threads.