I need to communicate between elements (remote set) and find it difficult to determine between the number of packages to send and the size of a package.
For example in extremes, I could send many 'small' packages or a few 'gigantic' packages to another element.
What would be the benchmark of the number of packages and what would be the limited size of a single package?
Doing 4000 sets (1 set is already a group of instructions) in a loop feels like a load peak that could be reduced, but I don't want to impact something else (or miss data) by sending a package that is too large.
There is no single answer to this question. As you mentioned we need to balance the load vs the used memory. Both are linked to the setup. There's not real benchmarks for this.
Best practice would be to keep the number of remote calls to a minimum and at the same time avoid an out of memory exception.
As this is all linked to the setup and of course your use case (what data needs to be passed, how frequent, and should all data be send right away or is a buffer mechanism work to spread the load)
All I would say is to default to a minim amount of calls as a best practice and only consider changing that if and when you detect it is a problem.
This question has a very high risk of overcomplicating or over-engineering your code which can lead to a less stable setup that's difficult to maintain. So try to remember KISS, Keep it Simple & Stupid.
If you are still interested in making something more tailered to different setups. For example if you know you are making a highly re-usable and dynamic module or setup. Then you could build a configurable mechanism to send the data in batches.
This way you can at run-time still adapt according to the needs of the setup. e.g. reduce the consumed memory by sending more packages and perhaps in a broader time frame.
There's even options to make a self-regulating setup, where you monitor your own system and have the code automatically change the package sizes based on measured CPU Spikes...
But again, this is in most scenario's a bad idea, and overcomplicating your code.