Search code examples
linuxperformanceperformance-testingethernet

How to measure data transfer rate between two nodes on Linux Server ? Must ignore the effect of disk


At first , I use scp to copy a file from node9 to node10 .But this method does not satisfied with my purposes.Cause scp will be affected by the disk.Result in unexpected result.So , What should I do ? My ethernet is 10Gbit/s.


Solution

  • Two things... firstly, scp is encrypted and also takes time therefore to encrypt, so consider using nc or netcat which is installed on most Linux distros. Secondly, you can use /dev/zero to generate data very fast. So...

    Generate data fast

    Let's generate 10 GBytes of data from /dev/zero and discard to /dev/null to check how fast we can generate data:

    dd if=/dev/zero bs=1024k count=10000 > /dev/null
    10000+0 records in
    10000+0 records out
    10485760000 bytes transferred in 0.573830 secs (18273282446 bytes/sec)
    

    None too shabby at 18 GBytes/sec.

    Transfer across network

    Now, on node10, prepare to receive the data by listening on port 8000, and then discarding the received data:

    nc -l 8000 > /dev/null
    

    And on, on node9, send the data and time it:

    dd if=/dev/zero bs=1024k count=10000 | nc node10 8000