Replies: 1 comment 4 replies
-
Without the syncs it’s just testing how quick it can write to caches, system or SSD dram. Perhaps there would be benefits if the file was opened with a combination of O_DIRECT and O_SYNC, to make it more like your dd tests. O_DIRECT = direct memory access, try to avoid caches. Opening with O_SYNC would remove the need for the fsync calls and losing time in python code. Could also try tightening the loop and using better time measurements. For some ideas: https://gist.github.com/mnightingale/8d2b2ce5181783e2ee29e640a8daa2da |
Beta Was this translation helpful? Give feedback.
-
When we do the speed test we open file, then loop write line of data + flush, repeat until 0.5 sec then close file. and use counter on how big the data written would be..
I've always wondered why this speed test was not ever as close to other drive benchmarks.. and why any io wait just tanks its performance... I finally got around to adding a newer m2 drive in my box and saw the speed test go down when it technically is a faster drive with faster specs and nego at a faster speed.
lspci -vv
for both drives so I could fact check what their cap/speed is:/downloads -- 1TB Samsung 980 Pro (PCIe 4.0 x4 nvme m.2 drive)
/download-970 -- 1TB Samsung 970 EVO Plus (PCIe 3.0 x4 nvme m.2 drive)
Using same sabnzbd container, mounting both m2 drives into docker and running diskspeed to each with nothing else going on.
loading up sabnzbd docker from linuxserver.io, dropping sab git repo in a folder so I could access diskspeed from sab util.
logged into that docker to run various tests. box has linux kernel 6.1.79
/download-970 -- 1TB Samsung 970 EVO Plus (PCIe 3.0 x4 nvme m.2 drive)
/downloads -- 1TB Samsung 980 Pro (PCIe 4.0 x4 nvme m.2 drive)
Can see that newer m2 that has higher specs is getting slower speed per this test.
Commenting out the fsync line,
re-running test, can see they both get roughly 2,550 MB/s
which then were closer aligned to just doing dd:
Debated if how we are doing the speed test is optimal and if we were purposely flushing to disk to not skew things with buffers or what. So I redid it using with open, and did the normal recommendation of flush + fsync.. and showing file size of each run:
can see that even with flushing buffers this newer method yields 2x the speed (but still shows the older drive is still slightly faster):
and if I comment out doing the flush+fsync on this method:
Both drives use btrfs and have discard=async, but still ran trim on both drives just in case. No change.
Running the test longer (0.5 -> 1.0 / 3.0 / 5.0 / 10.0), just results in slightly slower speed as things prob normalize a bit.
So got me curious, when we save data from article cache to the drive, it does not look like we flush/sync to disk after writing:
https://github.com/sabnzbd/sabnzbd/blob/develop/sabnzbd/filesystem.py#L1128
So then why do we do it for the diskspeed test?
Doing the extra step causes io strain, which will cause suboptimal setups to rear their head.. which I see all the time with people using horrible paths that go through virtual overlay/filesystems or slow external drives / remote mounts.
Beta Was this translation helpful? Give feedback.
All reactions