Testing NAS speeds

So, recently I had reason to try bench-marking an off the shelf NAS server against an Opensource alternative and I wanted to ensure the tests would be as fair as possible (and quick to implement).

As an aside, I thought that because it has been literally YEARS since I’d publicly documented any of my IT related antics, that I’d post this in case it helps others trying to do something similar.

I settled on writing a quick and dirty batch script which would, from a hard wired LAN client, map network drives to the two devices and copy a 1GB file to each. Prerequisites were;

  • Use a 1GB binary file (as binaries are the predominate file type transported in the environment).
  • Windows 10 native applications/commands only
  • Be as ‘pure’ as possible in measuring the raw IO of the devices being tested
  • Measurement needs to be granular enough to determine which device was performing the fastest.
@ECHO OFF
REM This script creates drive mappings to NAS devices
REM A 1GB file is written to NAS each in turn and timings are recorded
REM ------------------------------------------------------------------

REM Setup NAS Drive Mappings

NET USE S: \\123.45.67.89\WritableShare /WRITETHROUGH /PERSISTENT:NO
ECHO Existing NAS Mapped to S:

NET USE T: \\123.45.67.90\WritableShare /WRITETHROUGH /PERSISTENT:NO
ECHO Existing NAS Mapped to T:

PAUSE
REM ------------------------------------------------------------------

ECHO Start Measure NAS-1 %Time% > C:\Users\myusername\Desktop\TestNAS_IO.log
ROBOCOPY C:\Users\myusername\Desktop\1GB S:\zTEST *
ECHO End Measure NAS-1 %Time% >> C:\Users\myusername\Desktop\TestNAS_IO.log

ECHO Start Measure NAS-2 %Time% >> C:\Users\myusername\Desktop\TestNAS_IO.log
ROBOCOPY C:\Users\myusername\Desktop\1GB T:\zTEST *
ECHO End Measure NAS-2 %Time% >> C:\Users\myusername\Desktop\TestNAS_IO.log

REM ------------------------------------------------------------------
Echo Destroying Drive Mappings
NET USE S: /DELETE
NET USE T: /DELETE

Pause

In the script above, we initially create drive mappings to writable shares on each of the two devices.

The switch /WRITETHROUGH is a new function in Windows 10 which forces writes to go from client to the destination without getting caught up in any Windows (or other in-the-middle) caching in-between. The same tests can be re-run omitting the /WRITETHROUGH during drive mapping to see what (if any) effect caching has on the file copy process.

On our test client, we have created a directory (labelled 1GB) in which we have downloaded our 1GB binary file.

Prior to initiating the copy (or, in this case ROBOCOPY) command, we write the current time to a log file stored on the Windows Desktop of the test client.

Finally, like any good script, we return the environment to its former state (by deleting the network shares) prior to exiting the batch file.


Posted

in

by

Tags: