Hmm... selbst wenn ich das auf die Spitze treibe und mal zum Testen nur Byteweise beschreibe um damit die Zugriffszahlen zu maximieren, kann ich da nur einen kaum bemerkbaren Unterschied sehen:
Code: Alles auswählen
root@desk:/media/usbstick# for((i=1;$i<=20;i++));do { dd </dev/zero bs=1c count=$((1024*1024*50)) >testfile ; } 2>&1 | grep -v Datens ; done
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,392 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,3795 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,5895 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,3803 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,5129 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,3975 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,794 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,4439 s, 2,0 MB/s
...
root@desk:/media/usbstick# for((i=1;$i<=20;i++));do { dd </dev/zero bs=1c count=$((1024*1024*50)) iflag=sync oflag=sync >testfile ; } 2>&1 | grep -v Datens ;done
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,4446 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,7176 s, 2,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 27,181 s, 1,9 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 27,3521 s, 1,9 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 27,2663 s, 1,9 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 27,1722 s, 1,9 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 26,5311 s, 2,0 MB/s
...
Nachtrag: hier auch nochmal der Schreibvorgang mit Ausgabe direkt auf das Gerät(statt in ein Dateisystem):
Code: Alles auswählen
for((i=1;$i<=20;i++));do { dd </dev/zero bs=1c count=$((1024*1024*50)) >/dev/sdb ; } 2>&1 | grep -v Datens ;done
52428800 Bytes (52 MB, 50 MiB) kopiert, 23,8363 s, 2,2 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 23,4236 s, 2,2 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 23,4284 s, 2,2 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 23,1841 s, 2,3 MB/s
...
Ich habe einen normalen USB-Stick(USB 2) an einem schnellen Rechner verwendet.
Wenn also bei 50.000.000 Schreibzugriffen so wenig Auswirkung ist, würde ich sagen, dass die Ansprechzeiten des USB-Sticks hier vernachlässigbar sind.
Hier nochmal der Test, wenn ich mit etwas mehr Daten mit grösseren Blockgrössen(Standardblockgrösse = 512 Bytes) schreibe:
Code: Alles auswählen
for((i=1;$i<=20;i++));do { dd </dev/zero count=$((1024*1024)) >/dev/sdb ; } 2>&1 | grep -v Datens ;done
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,640451 s, 838 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,542197 s, 990 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,546151 s, 983 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,601548 s, 892 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,552735 s, 971 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,551296 s, 974 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,551773 s, 973 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,561011 s, 957 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,570087 s, 942 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 1,13311 s, 474 MB/s
536870912 Bytes (537 MB, 512 MiB) kopiert, 0,61497 s, 873 MB/s
Der popelige USB-Stick schafft diese Geschwindigkeit nie im Leben. D. h. ich vermute da wird überhaupt nix synchron geschrieben, sondern alles gecached , erst im Hintergrund auf den Stick geschrieben und die langsame Geschwindigkeit oben kommt nur daher, dass das System jedes Byte einzeln hin- und herschubsen muss.
Wenn ich auch mal verschiedene Bereiche beschreibe, dann sieht man da nochmal eine Veränderung:
Code: Alles auswählen
root@desk:/media/usbstick# for((i=1;$i<=100;i++));do { dd </dev/zero count=$((1024*100)) seek=$(($i*1024*100)) >/dev/sdb ; } 2>&1 | grep -v Datens ;done
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0885792 s, 592 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,126787 s, 414 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0974019 s, 538 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,101278 s, 518 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,102126 s, 513 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,129887 s, 404 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0890491 s, 589 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,102819 s, 510 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,101822 s, 515 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,128684 s, 407 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0905995 s, 579 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0901749 s, 581 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,128309 s, 409 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0901506 s, 582 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 20,2728 s, 2,6 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,097679 s, 537 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 119,756 s, 438 kB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0833935 s, 629 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 107,291 s, 489 kB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,124952 s, 420 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 112,425 s, 466 kB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0750392 s, 699 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 64,9629 s, 807 kB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0630086 s, 832 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 27,5559 s, 1,9 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0992653 s, 528 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 57,5047 s, 912 kB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,102086 s, 514 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 45,8611 s, 1,1 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,0579088 s, 905 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 43,4918 s, 1,2 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 0,127354 s, 412 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 40,1855 s, 1,3 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 1,00295 s, 52,3 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 56,5088 s, 928 kB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 49,1058 s, 1,1 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 43,8796 s, 1,2 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 48,5203 s, 1,1 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 45,0704 s, 1,2 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 35,149 s, 1,5 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 44,1591 s, 1,2 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 51,5053 s, 1,0 MB/s
52428800 Bytes (52 MB, 50 MiB) kopiert, 43,5743 s, 1,2 MB/s
D. h. ich beschreibe bei jeder Iteration einen anderen Bereich. Sobald der Cache voll ist, müssen die Daten geschrieben werden, und dann geht die Schreibgeschwindigkeit auf die tatsächliche Geschwindigkeit runter, die der Stick leisten kann und wird dann erst wieder schnell, wenn die Daten aus dem Cache weggeschrieben sind. Wenn ich kontinuierlich schreibe, dann geht die Geschwindigkeit tendenziell in den Keller, wie oben zu sehen.
Lange Rede, kurzer Sinn
Ich sehe da nicht dass bei meinem System(Debian Stretch, Desktop-PC), beim direkten Schreiben auf eine USB-Stick-Gerätedatei, da irgendetwas synchron geschrieben wird.
Das hier scheint es zu erklären.
https://lwn.net/Articles/572911/
Bei mir steht dirty_ratio auf 10 (%). D. h. bei 16 GB RAM wird 1,6 GB für das Caching verwendet.