reduce memory footprint by splitting the upload in small batches