Added max_masters option to help improve load balancing of masters.