Welcome!
Important information
-- Spectre and Meltdown vulnerabilities
-- Change in MX sources

News
-- MX Linux on social media: here
-- Mepis support still here

Current releases
-- MX-17.1 Final release info here
-- antiX-17 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

F2FS filesystem performance. Improve read speed.

Post Reply
Message
Author
clicktician
Forum Regular
Forum Regular
Posts: 195
Joined: Sat May 02, 2015 4:35 pm

F2FS filesystem performance. Improve read speed.

#1 Post by clicktician » Mon Oct 15, 2018 6:13 pm

I've been experimenting with Samsung's file system for NAND devices called "F2FS" ever since Google started using it. (It's now the default in the Pixel 3). When I compare its performance on large sequential files, I'm encouraged by the write speeds, but I'd like to get the same read performance that exFAT and NTFS have.

I used my slowest Sandisk USB-C thumb drive to exaggerate the test differences. The windows file systems were formatted on a Win 10 box, and Ext4/F2FS were formatted on MX. All of the tests were performed on MX. I used:

Code: Select all

time nocache cp <source> <dest>
The file size was 4.0 GB (3,984,549,242 bytes)
I just copied the 4GB file to the drive for write and copied it back for read.

Using nocache should negate any caching differences, so I'm guessing there is some significance to the cluster size. Windows allows setting the cluster size (called "Allocation Size"). But mkfs.f2fs has no such options.
There is a -O option that is used to set features, but I can't find any documentation on what those would be.

The approx 4x read performance smells like Windows is using 4x the cluster size of 4096KB which is probably the default of Ext4 and F2FS.

Anyone have experience with F2FS? Any ideas on how to tune this? Unfortunately, Win 10 doesn't support F2FS so I can't discern any obvious formatting differences.

Code: Select all

4.0 GB (3,984,549,242 bytes)
time nocache cp <source> <dest>

FAT32
Write 431.171s     9.241MB/s
Read   32.820s   121.688MB/s

exFAT
Write 400.677s     9.944MB/s
Read   10.301s   398.056MB/s

NTFS
Write 407.518s     9.777MB/s
Read   10.286s   387.375MB/s

Ext4
Write 426.842s     9.334MB/s
Read   34.918s   114.111MB/s

F2FS
Write 397.540s    10.023MB/s
Read   31.983s   124.583MB/s
Son, someday all this will belong to your ex wife.

User avatar
timkb4cq
Forum Veteran
Forum Veteran
Posts: 4421
Joined: Wed Jul 12, 2006 4:05 pm

Re: F2FS filesystem performance. Improve read speed.

#2 Post by timkb4cq » Mon Oct 15, 2018 8:47 pm

Should be much improved when the 4.19 kernels arrive.
https://www.phoronix.com/scan.php?page= ... T-Read-Fix
MSI 970A-G43 MB, AMD FX-6300 (six core), 16GB RAM, GeForce 730, Samsung 850 EVO 250GB SSD, Seagate Barracuda XT 3TB

User avatar
oops
Forum Regular
Forum Regular
Posts: 421
Joined: Tue Apr 10, 2018 5:07 pm

Re: F2FS filesystem performance. Improve read speed.

#3 Post by oops » Tue Oct 16, 2018 3:13 am

As a suggestion:
Maybe some accurate tests should be more pertinents (spectrum 4k to 1M) ... with fio
Seen here:
https://askubuntu.com/questions/87035/h ... erformance

....If you want accuracy, you should use fio. It requires reading the manual (man fio) but it will give you accurate results. Note that for any accuracy, you need to specify exactly what you want to measure. Some examples:

Sequential READ speed with big blocks (this should be near the number you see in the specifications for your drive):

fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=read --size=500m --io_size=10g --blocksize=1024k --ioengine=libaio --fsync=10000 --iodepth=32 --direct=1 --numjobs=1 --runtime=60 --group_reporting

Sequential WRITE speed with big blocks (this should be near the number you see in the specifications for your drive):

fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=write --size=500m --io_size=10g --blocksize=1024k --ioengine=libaio --fsync=10000 --iodepth=32 --direct=1 --numjobs=1 --runtime=60 --group_reporting

Random 4K read QD1 (this is the number that really matters for real world performance unless you know better for sure):

fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=randread --size=500m --io_size=10g --blocksize=4k --ioengine=libaio --fsync=1 --iodepth=1 --direct=1 --numjobs=1 --runtime=60 --group_reporting

Mixed random 4K read and write QD1 with sync (this is worst case number you should ever expect from your drive, usually 1-10% of the number listed in the spec sheet):

fio --name TEST --eta-newline=5s --filename=fio-tempfile.dat --rw=randrw --size=500m --io_size=10g --blocksize=4k --ioengine=libaio --fsync=1 --iodepth=1 --direct=1 --numjobs=1 --runtime=60 --group_reporting

Increase the --size argument to increase the file size. Using bigger files may reduce the numbers you get depending on drive technology and firmware. Small files will give "too good" results for rotational media because the read head does not need to move that much. If your device is near empty, using file big enough to almost fill the drive will get you the worst case behavior for each test. In case of SSD, the file size does not matter that much.

Note that fio will create the required temporary file on first run. It will be filled with random data to avoid getting too good numbers from devices that cheat by compressing the data before writing it to permanent storage. The temporary file will be called fio-tempfile.dat in above examples and stored in current working directory. So you should first change to directory that is mounted on the device you want to test.
timkb4cq wrote:
Mon Oct 15, 2018 8:47 pm
Should be much improved when the 4.19 kernels arrive.
https://www.phoronix.com/scan.php?page= ... T-Read-Fix
Interesting.
$ inxi -Fxxxz : System: Host:XEON ... Distro: MX-17.1_x64 Horizon

clicktician
Forum Regular
Forum Regular
Posts: 195
Joined: Sat May 02, 2015 4:35 pm

Re: F2FS filesystem performance. Improve read speed.

#4 Post by clicktician » Tue Oct 16, 2018 9:07 am

timkb4cq wrote:
Mon Oct 15, 2018 8:47 pm
Should be much improved when the 4.19 kernels arrive.
https://www.phoronix.com/scan.php?page= ... T-Read-Fix
Ok, my fingers are crossed. I know Samsung has been making improvements and Google has contributed some also. It's still new, so it may be just a matter of waiting it out.
oops wrote:
Tue Oct 16, 2018 3:13 am
As a suggestion:
Maybe some accurate tests should be more pertinent (spectrum 4k to 1M) ... with fio
Thank you for the suggestion. It's fascinating to read about the exhaustive tests people do on disks. There's obviously a ton of tedious analysis that goes into the development and eval of a file system.

Fortunately, I just have 1 simple use case: how long do I have to wait for a 4GB file to be moved to and from a flash drive? I do this function daily.
I have tried several file systems in search of a shorter wait-time.

That's not very useful or pertinent for the rest of the forum. It's really only specific to what I'm doing.
But, I time every one of these file transfers, and I can assure you that they are painfully accurate. Hahaha! Painfully, so. :snooze:
Son, someday all this will belong to your ex wife.

User avatar
oops
Forum Regular
Forum Regular
Posts: 421
Joined: Tue Apr 10, 2018 5:07 pm

Re: F2FS filesystem performance. Improve read speed.

#5 Post by oops » Tue Oct 16, 2018 12:20 pm

FI: With fio,fio_generate_plots "Sequential-Test" , "fio2gnuplot -b -g" it is also possible to build some graphics - sample r-w on ext4 hdd here:
You do not have the required permissions to view the files attached to this post.
$ inxi -Fxxxz : System: Host:XEON ... Distro: MX-17.1_x64 Horizon

clicktician
Forum Regular
Forum Regular
Posts: 195
Joined: Sat May 02, 2015 4:35 pm

Re: F2FS filesystem performance. Improve read speed.

#6 Post by clicktician » Tue Oct 16, 2018 3:21 pm

oops wrote:
Tue Oct 16, 2018 12:20 pm
FI: With fio,fio_generate_plots "Sequential-Test" , "fio2gnuplot -b -g" it is also possible to build some graphics - sample r-w on ext4 hdd here:
I installed Fio and did something really simple. I formatted the USB drive with exFat on a Win 10 box. Then I ran 2 easy Fio tests. A 4Gig write and a 4Gig read:

Code: Select all

#Test read a 4Gig file
fio --name=writefile --size=4G --filesize=4G \
--filename=/media/clicktician/EC97-7192/writefile.fio --bs=1M --nrfiles=1 \
--direct=1 --sync=0 --randrepeat=0 --rw=write --refill_buffers --end_fsync=1 \
--iodepth=200 --ioengine=libaio

#Test read a 4Gig file
fio --name=readfile --size=4G --filesize=4G \
> --filename=/media/clicktician/EC97-7192/readfile.fio --bs=1M --nrfiles=1 \
> --direct=1 --sync=0 --randrepeat=0 --rw=read --refill_buffers --end_fsync=1 \
> --iodepth=200 --ioengine=libaio
The write test results looked reasonable and very similar to my copy tests for exFat only a bit slower. I expected it to be faster because Fio is not reading a file from my hard drive, it is simply creating random data to write.

Code: Select all

Run status group 0 (all jobs):
  WRITE: io=4096.0MB, aggrb=8459KB/s, minb=8459KB/s, maxb=8459KB/s, mint=495781msec, maxt=495781msec
But the read test results are laughably incorrect. I must be doing something very wrong. I expected them to be quite a bit faster since it didn't have to read the flash drive AND write to my hard drive. But they're ridiculous.

Code: Select all

Run status group 0 (all jobs):
   READ: io=4096.0MB, aggrb=2784.6MB/s, minb=2784.6MB/s, maxb=2784.6MB/s, mint=1471msec, maxt=1471msec
The maximum read speed of this flash drive is 400MB/s. It is physically impossible to read it at 2.7GB/s. Obviously, there is a mistake in the Fio read test I created. Lol.
Son, someday all this will belong to your ex wife.

User avatar
oops
Forum Regular
Forum Regular
Posts: 421
Joined: Tue Apr 10, 2018 5:07 pm

Re: F2FS filesystem performance. Improve read speed.

#7 Post by oops » Tue Oct 16, 2018 4:09 pm

clicktician wrote:
Tue Oct 16, 2018 3:21 pm
...But the read test results are laughably incorrect.
Do you have tryed with : " --fsync=10000" (or buffered=0) ?

Or for ssd, this kind of config ?
https://itpeernetwork.intel.com/how-to- ... isualizer/
$ inxi -Fxxxz : System: Host:XEON ... Distro: MX-17.1_x64 Horizon

clicktician
Forum Regular
Forum Regular
Posts: 195
Joined: Sat May 02, 2015 4:35 pm

Re: F2FS filesystem performance. Improve read speed.

#8 Post by clicktician » Wed Oct 17, 2018 12:28 pm

oops wrote:
Tue Oct 16, 2018 4:09 pm
Do you have tried with : " --fsync=10000" (or buffered=0) ?
Thanks for the suggestion. Those really affect write tests. After a ton of research (ugh - Haha), I figured out I'm not using the read tests correctly.
Fio is designed to exercise a device for N-number of seconds and then report the results. So, the correct arguments are not obvious for my use case of: "how long does it take to read a file?"
The read duration is configured with the --runtime argument. To read the entire file you need to enter the file size and guess at a duration long enough to exceed the amount of time to read it.
Like this:

Code: Select all

fio --name=readfile --size=4G --filesize=4G \
 --filename=/media/clicktician/EC97-7192/testfile.fio --bs=1M --nrfiles=1 \
 --direct=1 --sync=0 --randrepeat=0 --rw=read --refill_buffers --end_fsync=1 --runtime=60\
 --iodepth=200 --ioengine=libaio
In this case, I told it to read my 4GB testfile for no more than 60 seconds, knowing from my previous test with "time nocache cp..." that it only takes about 30 seconds to read the file. So, now I got these results:

Code: Select all

   READ: io=4096.0MB, aggrb=139582KB/s, minb=139582KB/s, maxb=139582KB/s, mint=30049msec, maxt=30049msec
These look realistic to me, and are consistent with all my other tests.

The problem I now have is wildly inconsistent test results. Check out the differences between these two write tests done 1 hour apart on the same device with the exFat:

Code: Select all

  WRITE: io=4096.0MB, aggrb=8459KB/s, minb=8459KB/s, maxb=8459KB/s, mint=495781msec, maxt=495781msec
  WRITE: io=4096.0MB, aggrb=6904KB/s, minb=6904KB/s, maxb=6904KB/s, mint=607448msec, maxt=607448msec
18% variance is not acceptable for me. But, again, it's almost certain that I'm doing something wrong which is resulting in this error.

All in all, I've decided I'm not intelligent enough to use Fio to get constructive results. It's obviously way above my pay grade. These tests can take 15 minutes each to run, so hours easily go by only to get disappointing results. It requires root, which I usually reserve for system maintenance work, and I don't commonly use that for simply reading and writing files on a flash drive. So, that's probably a good clue I'm applying the wrong tool.
I think I'll try iozone and gnome-disks. They may be built more for my competence level.
Son, someday all this will belong to your ex wife.

User avatar
oops
Forum Regular
Forum Regular
Posts: 421
Joined: Tue Apr 10, 2018 5:07 pm

Re: F2FS filesystem performance. Improve read speed.

#9 Post by oops » Wed Oct 17, 2018 1:24 pm

I agree fio is not so easy to use, but it still interesting in some cases (benchmarks) ... fio needs to be used into a quiet system, without some heavy background process like clamd antivirus deamon in use, synaptic xapian index in use, etc...
$ inxi -Fxxxz : System: Host:XEON ... Distro: MX-17.1_x64 Horizon

clicktician
Forum Regular
Forum Regular
Posts: 195
Joined: Sat May 02, 2015 4:35 pm

Re: F2FS filesystem performance. Improve read speed.

#10 Post by clicktician » Sat Oct 20, 2018 7:25 pm

Now that I'm an expert on Fio... Hahahaha -- not!

I think I've found my new file system. I understand why Google is Gaga over it and burned it into the Pixel 3.

F2FS varies widely on the drives I've tried. It consistently outperforms exFat, but some drives appear to respond better than others (on USB-C 3.0 at least).

My patriot drive write speed jumped 88%.
patriot_chart.jpg
You do not have the required permissions to view the files attached to this post.
Son, someday all this will belong to your ex wife.

Post Reply

Return to “Hardware /Configuration”