use latency to determine the maximum number of partitions