简体   繁体   English

如果使用设备块大小,则 mbuffer 比 dd 慢

[英]mbuffer slower than dd if device block is size used

I have an backup script which is generating a tar on the fly and piping it to mbuffer.我有一个备份脚本,它动态生成 tar 并将其通过管道传输到 mbuffer。 The data is then written to a tape drive (LTO3)然后将数据写入磁带驱动器 (LTO3)

I discovered that the mbuffer slows the bandwidth down and I can not figure out why.我发现 mbuffer 减慢了带宽,我不知道为什么。

here the 2 commands and the average speeds below them这里有 2 个命令和它们下面的平均速度

$tar -b 512 -cf - /data | \
 mbuffer -A "..." -P 90 -m 1G -f -o /dev/st0 -d 512

in @ 21.8 MB/s, out @ 21.8 MB/s, 1287 MB total, buffer 100% full

and if I pipe the data again to dd it will result in a much higher bandwidth如果我再次将数据通过管道传输到 dd 它将导致更高的带宽

$tar -b 512 -cf - /nas/homes/ /nas/photo/ | \
 mbuffer -P 90 -m 1G | \
 dd of=/dev/st0 bs=256k

in @ 72.9 MB/s, out @ 64.0 MB/s, 2671 MB total, buffer  99% full

My question is if I am using mbuffer the wrong way or if its not supposed to be used with -d .我的问题是我是否以错误的方式使用 mbuffer 或者它不应该与-d一起使用。 Even if I'm not specifying the block-size with -d the speed stays the same.即使我没有用-d指定块大小,速度也保持不变。

I would like to use mbuffer because of the -A flag but with this performance it would take triple the time.由于-A标志,我想使用 mbuffer,但使用这种性能需要三倍的时间。

Well, from the mbuffer(1) man page:好吧,来自 mbuffer(1) 手册页:

-s <size>
           Use blocks of size bytes for buffer (default is determined on startup).

But, I think the key is that in your second command, you're using 262144 byte (256k) writes and only 512 byte writes in the first.但是,我认为关键是在您的第二个命令中,您使用的是 262144 字节(256k)写入,而在第一个命令中仅使用 512 字节写入。 I suspect if you changed the second command to bs=512 and the first command to -s 262144 you'd invert the situation.我怀疑如果您将第二个命令更改为 bs=512 并将第一个命令更改为 -s 262144 ,您会颠倒这种情况。

It'd be ideal if they matched.如果它们匹配就很理想了。 So, try -s 262144 with mbuffer.因此,尝试使用 mbuffer 设置 -s 262144。

Edited to reflect a correction in the David's answer.编辑以反映大卫答案中的更正。

-d isn't an option you can specify a parameter; -d 不是您可以指定参数的选项; it's used to grab the default size.它用于获取默认大小。 To over-ride I recommend you remove the -d and use -s in bytes要覆盖我建议您删除 -d 并以字节为单位使用 -s

eg例如

-s 512000 -s 512000

or use 1024*512 = 524288或使用 1024*512 = 524288

I believe LTO uses a block size minimum of 512, not 256 if memory serves.Anything less is extremely inefficient.我相信 LTO 使用的块大小最小值为 512,如果内存可用,则不是 256。任何更少的东西都是非常低效的。 Try an 8mb minimum buffer- youll get better results.尝试 8mb 的最小缓冲区 - 你会得到更好的结果。

Using dd incorrectly throws about 3 different errors with these drives, especially during tape restore. dd 错误地使用这些驱动器会引发大约 3 个不同的错误,尤其是在磁带恢复期间。 Document your methods used.记录您使用的方法。 It will save you hours of headache later on.它会为您节省数小时的头痛时间。

'mt /dev/ setblk 512' can be used to overcome this(mt-st package)- however- uses for the variable block size exist, such as in using dump/restore(ext4 works best) or Disk archive(as opposed to Tape archive). 'mt /dev/ setblk 512' 可用于克服此问题(mt-st 包)- 但是- 存在用于可变块大小的用途,例如使用转储/恢复(ext4 效果最佳)或磁盘存档(与磁带存档)。

Lzip will not split- plan accordingly.Its fine if your data "should" otherwise fit. Lzip 不会相应地拆分计划。如果您的数据“应该”适合,那很好。

There seems to be a lack of "long term data safe" storage methods.似乎缺乏“长期数据安全”的存储方法。 Tar isnt what it was once cracked up to be.焦油不是它曾经被破解的样子。 It was fine for reel2reel- not so much anymore. reel2reel 很好 - 不再那么多了。 Theres no "integrity" or means to skip over bad files these days- and the methods that can do so- often are not used--or are a real PITA to implement/setup post OS install.这些天没有“完整性”或跳过坏文件的方法 - 并且可以这样做的方法 - 通常不使用 - 或者是在操作系统安装后实施/设置的真正 PITA。 There is no "it just works" solution, unfortunately.不幸的是,没有“它只是有效”的解决方案。 Thats the nature of tape for ya.这就是你磁带的本质。 Disk archive(DAR) is a decent replacemnt for Tar- but be patient with it- DO NOT screw up header writes on WORM tape- its a real pain to fix on recovery.磁盘存档 (DAR) 是 Tar 的不错替代品 - 但要耐心等待 - 不要搞砸 WORM 磁带上的标题写入 - 在恢复时修复它真的很痛苦。

LTFS just makes things worse, not better. LTFS 只会让事情变得更糟,而不是更好。 Dont jump to LTO4+ just for the "filesystem".不要仅仅为了“文件系统”而跳转到 LTO4+。 Its a pain to get going (correctly) on linux.在 linux 上(正确)开始是一种痛苦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM