Re: measuring swap partition speed

From: void <void_at_f-m.fm>
Date: Fri, 22 Dec 2023 16:59:10 UTC
My assessment of the "system being inactive while testing" may have
been inaccurate. By "being inactive" I was looking at avg load being
1% or less, and for swap use being 0. Maybe the initial "inactive" test 
should have been in single user mode [1] because the tests in this mode
show no (I mean much less) of a speed issue. Apologies for not considering 
single user mode till now. The results in single user mode seem to me to 
infer that there is no problem with the hardware.

I have been able to reliably create the problem by rebooting the
computer, then running something that does not need to be one huge chunk of data,
that doesn't load the system that much, so ran 'make installworld' and in another 
terminal ran the write-to-swap-partition test [2]. It shows in this context 
that writing to the filesystem effectively blocks writing to swap. 
507 kB/s compared to 16 MB/s. I don't know if this is unique to arm64 or 
if it's also the case on other arches, but it seems suboptimal to me.

[1] single user mode test across various blocksizes:

Enter root password, or ^D to go multi-user
Password:
Enter full pathname of shell or RETURN for /bin/sh: 
root@:/ # dd if=/dev/urandom of=/dev/da0p7 bs=4k conv=sync status=progress
dd: /dev/da0p7: end of device2040 MiB) transferred 223.000s, 9591 kB/s

524289+0 records in
524288+0 records out
2147483648 bytes transferred in 223.905183 secs (9591040 bytes/sec)

root@:/ # dd if=/dev/urandom of=/dev/da0p7 bs=8k conv=sync status=progress
dd: /dev/da0p7: end of device2045 MiB) transferred 131.001s, 16 MB/s

262145+0 records in
262144+0 records out
2147483648 bytes transferred in 131.214263 secs (16366236 bytes/sec)

root@:/ # dd if=/dev/urandom of=/dev/da0p7 bs=16k conv=sync status=progress
dd: /dev/da0p7: end of device2038 MiB) transferred 82.003s, 26 MB/s

131073+0 records in
131072+0 records out
2147483648 bytes transferred in 82.420743 secs (26055136 bytes/sec)

root@:/ # dd if=/dev/urandom of=/dev/da0p7 bs=32k conv=sync status=progress
dd: /dev/da0p7: end of device2028 MiB) transferred 61.030s, 35 MB/s

65537+0 records in
65536+0 records out
2147483648 bytes transferred in 61.621686 secs (34849479 bytes/sec)

root@:/ # dd if=/dev/urandom of=/dev/da0p7 bs=128k conv=sync status=progress
dd: /dev/da0p7: end of device2032 MiB) transferred 49.002s, 43 MB/s

16385+0 records in
16384+0 records out
2147483648 bytes transferred in 49.394171 secs (43476459 bytes/sec)
root@:/ # 

[2] test swap partition writing while multiuser and 'make installworld'

# dd if=/dev/urandom of=/dev/da0p7 bs=8k conv=sync status=progress
^C57442304 bytes (57 MB, 55 MiB) transferred 113.382s, 507 kB/s
7013+0 records in
7012+0 records out
57442304 bytes transferred in 114.630376 secs (501109 bytes/sec)

test while multiuser and 4k write to zfs:

# dd if=/dev/urandom of=test4k.bin bs=4k count=2500000 conv=sync status=progress
^C9595363328 bytes (9595 MB, 9151 MiB) transferred 115.001s, 83 MB/s
2360113+0 records in
2360113+0 records out
9667022848 bytes transferred in 115.957392 secs (83367025 bytes/sec)

# dd if=/dev/urandom of=/dev/da0p7 bs=8k conv=sync status=progress
^C7127040 bytes (7127 kB, 6960 KiB) transferred 112.235s, 64 kB/s
872+0 records in
871+0 records out
7135232 bytes transferred in 112.309547 secs (63532 bytes/sec)