Large File Experiment

In this “weekend” experiment I’ll write large file (16 GB in my case), then read it back with different buffer size and threads and check the performance.

The result is more or less predictable — each drive have a given throughput limit, and we can’t read faster than drive and interface will allow, but there are some interesting points which I would like to share.

To avoid read from cache I will create file, which is equal to RAM’s Size. In my case test laptop equipped with 16GB RAM, so I’ll write 16 GB File.

Write Experiment

Writing speed measurement is slightly out of scope, but anyway I will check how fast this will take.

I will write test file with 1MB blocks:

Now the results. for 16 GB it takes 86,7 seconds, means 189 MB/s average speed:

image-20240519065650323

Interesting point that the first GB was written very fast — around 2GB/s. Of course my SSD (which Samsung 750 EVO) can’t hold this speed. There are three factors — first, I have Samsung Magician software with enabled RAPID mode, then, second, obviously we have OS file write cache, and third, SSD’s cache. All three together resulted that the fist GB written to RAM, then dropped to SSD. This is what happened after first GB:

image-20240519070725791

Theoretically I can turn off Rapid Mode, as well as write caching, but this experiment is slightly out of scope (expected some performance drop anyway).

Read Experiment

Before starting with LabVIEW just check reading speed to \?\nul\ in Far Manager:

OK, 509 MB/s. Now we will read large file back with standard LabVIEW’s File I/O functions. There are two parameters which can be changed — block size to be read in single operation and amount of threads. My test laptop have 4 cores, so I’ll check from single to 4 threads and iterate over different block sizes starting from from 512 bytes:

And the results (measured in MB/s), Samsung 870 EVO on i7-7700:

1 Thread2 Threads3 Threads4 Threads
512 B94,68125,0170,0489,04
2 KB356,69105,70153,52185,32
8 KB400,14323,52379,25411,00
32 KB394,29445,07311,05410,40
128 KB461,78403,30439,52523,10
512 KB484,78499,46531,30531,77
2 MB462,56530,17531,63531,53
8 MB475,75529,21530,33530,14

This measurement can be different on different SSDs and PC Configurations, of course.

But in general this is expected results, the same can be obtained with traditional benchmark, for example:

image-20240519092710162

With larger amount of the threads we can reach “saturation” limit earlier with smaller buffer. And for better performance the buffer should be large enough - 256 KB - 1 MB.