On 2015-07-26 19:06, gogalthorp wrote:
> robin_listas;2721086 Wrote:
>> No, no, if you watch the CPU load while this happens you will see that
>> it low.
> Well when I do a backup to USB stick I see lots of CPU usage in CPU
> monitor widget on all 6 cores here. I don’t see drag down of cursor but
> it is a large load. It does not show in top though just the widget. Also
> last time was about a gig of updates (use luckybackup (rsync GUI))
> process was done at 6 min but the processors ran high for another 6.
> Also the stick is formatted ext2. I wait until the CPU’s settle before
> removing.
Well, I’m writing now a 3 GB file (Leap iso) to a stick (as file). Total
CPU load on the machine is about 1%. The stick is FAT.
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time cp openSUSE-42.1-DVD-x86_64-Build0017-Media.iso /media/Transcend/
real 3m57.224s
user 0m0.025s
sys 0m6.824s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time sync
real 0m0.757s
user 0m0.000s
sys 0m0.010s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
What is important is the time used on user and sys loads, not the “real”
time. Now, same copy to the hard disk:
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time cp openSUSE-42.1-DVD-x86_64-Build0017-Media.iso ~/
real 0m44.355s
user 0m0.027s
sys 0m5.700s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time sync
real 0m3.595s
user 0m0.000s
sys 0m0.040s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
You see, CPU time is about the same (no cache flushing between the
tests, that may matter).
[At this point, I had to leave, so I hibernated my machine - and it crashed. I don’t know if related to the tests or to recent updates]
Let’s try with dd.
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=direct ; time sync
6266880+0 records in
6266880+0 records out
3208642560 bytes (3,2 GB) copied, 2569,03 s, 1,2 MB/s
real 42m49.054s
user 0m3.558s
sys 2m12.962s
real 0m0.597s
user 0m0.000s
sys 0m0.017s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=nocache ; time sync
6266880+0 records in
6266880+0 records out
3208642560 bytes (3,2 GB) copied, 220,407 s, 14,6 MB/s
real 3m40.431s
user 0m1.305s
sys 0m29.520s
real 0m1.295s
user 0m0.001s
sys 0m0.019s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=dsync ; time sync
^C223247+0 records in
223247+0 records out
114302464 bytes (114 MB) copied, 1659,24 s, 68,9 kB/s
real 27m39.681s
user 0m0.397s
sys 0m7.106s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
maybe playing with chunk size.
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=dsync bs=32K; time sync
^C40976+0 records in
40976+0 records out
1342701568 bytes (1,3 GB) copied, 1064,36 s, 1,3 MB/s
real 17m44.420s
user 0m0.027s
sys 0m4.696s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=dsync bs=32M; time sync
95+1 records in
95+1 records out
3208642560 bytes (3,2 GB) copied, 202,266 s, 15,9 MB/s
real 3m22.860s
user 0m0.002s
sys 0m7.256s
real 0m0.771s
user 0m0.000s
sys 0m0.016s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
Chunk size does make a difference, more so as I’m disabling the cache.
However, notice that on all tests CPU load is very low, and the machine remains very responsive (I opened a LO writer document while testing).
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=nocache bs=32K; time sync
97920+0 records in
97920+0 records out
3208642560 bytes (3,2 GB) copied, 203,151 s, 15,8 MB/s
real 3m24.145s
user 0m0.032s
sys 0m7.868s
real 0m1.406s
user 0m0.000s
sys 0m0.015s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=nocache bs=32M; time sync
95+1 records in
95+1 records out
3208642560 bytes (3,2 GB) copied, 197,229 s, 16,3 MB/s
real 3m17.809s
user 0m0.000s
sys 0m6.747s
real 0m1.284s
user 0m0.000s
sys 0m0.013s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=direct bs=32K; time sync
97920+0 records in
97920+0 records out
3208642560 bytes (3,2 GB) copied, 279,719 s, 11,5 MB/s
real 4m40.178s
user 0m0.042s
sys 0m8.434s
real 0m0.596s
user 0m0.000s
sys 0m0.012s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso oflag=direct bs=32M; time sync
95+1 records in
95+1 records out
3208642560 bytes (3,2 GB) copied, 241,07 s, 13,3 MB/s
real 4m1.098s
user 0m0.002s
sys 0m7.232s
real 0m0.514s
user 0m0.000s
sys 0m0.012s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso ; time sync
6266880+0 records in
6266880+0 records out
3208642560 bytes (3,2 GB) copied, 245,751 s, 13,1 MB/s
real 4m5.784s
user 0m1.178s
sys 0m16.470s
real 0m2.262s
user 0m0.000s
sys 0m0.013s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso bs=32K; time sync
97920+0 records in
97920+0 records out
3208642560 bytes (3,2 GB) copied, 217,996 s, 14,7 MB/s
real 3m39.344s
user 0m0.035s
sys 0m8.587s
real 0m1.276s
user 0m0.000s
sys 0m0.011s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1
cer@Telcontar:/data/storage_b/Isos/Leap/42.1> time dd if=openSUSE-42.1-DVD-x86_64-Build0017-Media.iso of=/media/Transcend1/openSUSE-42.1-DVD-x86_64-Build0017-Media.iso bs=32M; time sync
95+1 records in
95+1 records out
3208642560 bytes (3,2 GB) copied, 204,788 s, 15,7 MB/s
real 3m25.765s
user 0m0.000s
sys 0m8.877s
real 0m1.328s
user 0m0.000s
sys 0m0.010s
cer@Telcontar:/data/storage_b/Isos/Leap/42.1>
Table of results:
512B 32K 32M
dd 13,1 MB/s 14,7 MB/s 15,7 MB/s
dd direct 1.2 MB/s 11,5 MB/s 13,3 MB/s
dd nocache 14.6 MB/s 15,8 MB/s 16,3 MB/s
dd dsync 68,9 kB/s 1,3 MB/s 15,9 MB/s
dsync writes to device asap, leaves a copy in cache.
nocache uses the kernel cache, then flushes it.
direct eliminates kernel cache mechanism completely.
I would vote for using “nocache” with 32 MB chunk size. The usb sticks native blocks are 32 KB, I think, which is why I chose that chunk size for testing; increasing the chunk size beyond that makes little difference, except with the dsync flag.
Using a small chunk size with the kernel cache mechanism disabled, besides being slow, probably wears the usb stick more. I should have remembered this before doing some of the tests, which is why I aborted some of them.
Notice that the problem I describe (unresponsive system) arises only when the size of what is being written to the slow writing device is about or bigger than the amount of ram the kernel can dedicate to disk buffers/cache.
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)