How to transfer large file (File size > Heap/RAM Size) over the network ?
Lets say I have file (size 10GB) I want to transfer it machine a (RAM 512mb) to machine b
(RAM 512mb).
Want achieve this using java code.
First, is it possible ? Any recommendation on framework. If possible, can we speed this up using threading ? Important criteria: file’s data sequence needs to be maintained during transfer. Any example will be great help.
Sure it is possible. You just have to use streams. If threading will improve transfer speed depends on your network, I would say you can’t gain an improvement because you are implementing the sender and the receiver (and you won’t limit the bandwidth). So the limiting factor will be the network bandwidth which you can’t extend. But you can consider compressing your stream.
An example is hard to give without knowing your requirements. We are using RMIIO for example to transfer a file by RMI. But I wouldn’t recommend doing this if you are not forced to use RMI.