The buffer's size influence on the transfer's speed.
843790Aug 13 2009 — edited Aug 15 2009Hey.
I have a server program in my virtual machine which transfers a 1GB file to my client program in my linux.
The server program and the client program both have a byte array, lets call him buff, that is responsible for storing the data.
The server reads from the file using the .read(buff) method and writes buff to the socket, and the client reads from the sockets again, through the .read(buff) method.
When buff's size was 1024(i.e. 1KB) the transfer's speed was slow. When I changed buff's size to 1048576 (i.e. 1MB), the transfer's speed has been increased drastically. Then, I changed buff's size to 50MB and then to 100MB, but the transfer's speed was the same as it's speed when buff's size was 1MB. I can't figure out why when buff's size has been changed from 1KB to 1MB, the transfer's speed has been increased, but when buff's size has been changed from 1MB to 50 or 100MB, the speed hasn't change at all.
I asked a few friends, they say that it may be because a sort of bottleneck, maybe some factor in the OS or something in the VM drivers limits the transfer's speed, I am not totally sure about that.
Maybe increasing buff's size and then compress the data before sending it through the socket may help?
Thanks in advance!