Using Batch Files to Record Network Throughput

In this video, Tony Fortunato demonstrates how to create batch files to help automate throughput analysis.

Tony Fortunato

May 1, 2017

3 Min Read
Network Computing logo

One of the toughest tasks is determining the throughput of your network. In actuality, the network is only one third of the throughput equation. Put simply, throughput or performance is the combination of the client, server and the network between them. When testing throughput, I always like to take a holistic approach by using a real client, server, application, and network.

In this video, I show you how to create and use batch files for recording throughput. As you'll see, the batch files help streamline the process.

For this lab, I use Microsoft’s Server Message Block (SMB) protocol that most corporate clients use for file-and-print access, then simply copy a file to my mapped drive. After copying a file, I want to measure when it starts to copy and when it ends to compare how long it takes. There's some mathematical reasoning when picking a file size for testing purposes. If you are very familiar with the interface specifications of your client and server hardware, you can use the lowest value. For most of us, that isn’t realistic, so I use the lowest network speed between the client and server for my bandwidth point of reference.

For a 10 Mb link, divide by 8 (bits in a byte) and you have 1.25 MB. In this article, I use Mb for megabit and MB for megabyte. It's important to realize that this is just the math to use as a point of reference. Therefore 100 Mb/s is 12.5 MB/s, etc. Now I simply multiply the MB by the duration of my test and I have the size.

For example, assume my server has a 100 Mb connection and I want to perform a 10-second test. The formula would be 12.5 MB x 10 seconds = 125 MB file. In this lab, I pretend that I'm not sure of the server network connection, so I will do the math assuming the server has a 100 Mb/s connection and a-20 second test. Therefore I would need a file size of 250 MB (12.5 MB/s x 20 seconds). I found a 211 MB video file, so that is close enough. Be aware that file types will matter for those of you that have WAN accelerators or compression devices.

Now that I know that the file size and approximately how long it should take, I can compare the actual results. This is when things get tricky, since there are many products out there that can measure this for you. There's also  the packet capture option, which involves reviewing the packets and calculating the throughput. I will assume you want a quick methodology to figure this out and don’t want to spend more money.

I know coding isn’t most analysts' strong point, so I pondered the easiest way to automate the process. Then it hit me: This is a perfect job for a batch file to record the start and end time to a file. Then I simply take the results of the batch file into my spreadsheet application and subtract the two times.  Once the file is setup, I can run the test as I change one variable or put this in a scheduler to measure throughput during 2 a.m. backups.

In this test, I compared my LAN with my 2.4 GHz and 5 GHz wireless network.


batch files chart.png

To save you some typing, here are the contents of my batch file for you to copy and paste into your favorite text editor.

del timedxcopy_results.csv

set start_time=%time%

echo Start Time, %start_time%

xcopy 206MB.mp4 v:

echo   End Time,  %time%

echo %start_time%,%time% >> timedxcopy_results.csv

del v:206MB.mp4


About the Author(s)

Tony Fortunato

Sr Network Performance Specialist

Tony Fortunato is a network performance expert who has been designing, implementing and troubleshooting networks since 1989. His company, The Technology Firm, provides clients of all sizes with services ranging from project management, network design, consulting, troubleshooting, designing custom-designed training courses, and assisting with equipment installation. Tony's experience in networking started with financial trading floor networks and ISPs, where he learned to integrate and support equipment from various vendors. Tony has taught and presented at numerous colleges and universities, public forums and private classes. He blogs frequently at NetworkDataPediaand has a popular YouTube channel.

Stay informed! Sign up to get expert advice and insight delivered direct to your inbox

You May Also Like

More Insights