balance workers and threads