buffer sizing algorithm