Archive for March, 2017

Useful command to test speed of a container, vm, or system

Monday, March 6th, 2017

I’ll be breaking down the following command part by part:

time dd if=/dev/zero of=test.dat bs=1024 count=100000

 

What does time do? It runs a process and then captures how long it took to execute.

What about DD? Well, it’s a command that copies data from a standard input to a standard output.

What about the params if, of, bs, and count?

“if”: It’s decently obvious, but “if” specifies the input, in this case we’re taking input from a special file that provides as many null characters as there are read from it; an infinity file of sorts.

“of”: It’s the output file.

“bs”: Byte size

“count”: the number of blocks

So all together, the command writes 100,000 blocks of 1,024 bytes of binary zeroes into the file of “test.dat”. In other words, generates a 100 MB file. This command allows you to generate a 100 MB file and test the  IO performance of a system. As we move towards a world we’re optimizing the crap out of everything, this is a very useful command to know.