optimize performance in batch consuming