Factors that affect speed are:

/dev/sd*

 * are cached (cache has a 3GB cap presently since the DMA pushback
   diff not was experienced as stable and therefore rolled back), which
   may make access appear faster

 * I think the underlying hardware access is always split to 512B (or
   in certain cases 4096B) accesses by the file/IO subsystem, this
   together with serialization via the kernel biglock and subsystem
   design gives you a system-global cap of about 120MB/sec independent
   of actual hardware.

/dev/rsd* is

 * not cached

 * i think underlying hardware access here depends on the size of the
   read operations, so for dd(1) this would be the size of the "bs"
   argument. For normal SSD:s the internal block size of 16KB (or any
   even multiple of 16KB) would give you the highest performance, for
   an SSD this would be about 500MB/sec in both sequential and random
   access.


I see as the *highest priority* in OpenBSD to make the disk/file IO
subsystem parallelized all down to the point of using the hardware's
multiqueing feature.

Currently, parallel disk/file accesses in software are all serialized.

Modern SSD:s all give you about 80MB/sec access in normal sequential
read mode. As you parallelize it you will see an linear speed increase
with higher number of threads up to approx 10 threads, where a SATA SSD
will give you about 500MB/sec and a PCIe NVMe SSD will give you about
900MB/sec.

The last file/disk IO related matter to remind of is that mmap() IO not
can be combined with file IO presently.

On June 15, 2018 9:10 AM, Maximilian Pichler <maxim.pich...@gmail.com> wrote:
> I'm getting much faster read speeds from an SD card when mounting the
> card and reading files (~50MB/s) than when reading the raw device
> rsd1c (~25MB/s). If anything, shouldn't it be the other way round,
> given that the file system has some overhead?
> 
> Here are the measurements when mounting and reading files:
> 
> $ doas mount /dev/sd1i /card
> $ mount | grep card
> /dev/sd1i on /card type msdos (local)
> $ cat /card/DCIM/100MSDCF/* | pv -bra -Ss500m | sha1
> 500MiB [49.2MiB/s] [49.2MiB/s]
> e823304263649ee4aff5c4563878cd9111cffebf
> 
> For the raw device (rsd1c):
> 
> $ doas cat /dev/rsd1c | pv -bra -Ss500m | sha1
> 500MiB [25.5MiB/s] [25.5MiB/s]
> ca17bdb9a657bbcf654a60057861be8fe02df0b1
> 
> For what it's worth, the block device (sd1c):
> 
> $ doas cat /dev/sd1c | pv -bra -Ss500m | sha1
> 500MiB [8.53MiB/s] [8.53MiB/s]
> ca17bdb9a657bbcf654a60057861be8fe02df0b1
> 
> The card was previously formatted with "newfs_msdos -s 8000000 sd1c"
> and then files were written on it by a camera.
> 
> Here is the card reader's dmesg bit:
> 
> umass0 at uhub0 port 13 configuration 1 interface 0 "Generic USB3.0
> Card Reader" rev 3.00/15.32 addr 5
> umass0: using SCSI over Bulk-Only
> scsibus2 at umass0: 2 targets, initiator 0
> sd1 at scsibus2 targ 1 lun 0: <Generic, STORAGE DEVICE, 1532> SCSI4
> 0/direct removable
> sd1: 488154MB, 512 bytes/sector, 999740416 sectors
> sd2 at scsibus2 targ 1 lun 1: <Generic, STORAGE DEVICE, 1532> SCSI4
> 0/direct removable

Reply via email to