add option for max pool size

Change-Id: Ida199e861c30f351df89c2f0ed62ac3e0015238a