Using an optimal packet size and chunk size