This answer shares some insight. You can increase the request.timeout.ms producer configuration which will allow the client to queue batches for longer before expiring.
You might also want to look into the batch.size and linger.ms configurations and find the optimal that works in your case.