|Do you know where your variables are?|
Could SHA encode faster than MD5?by bbs2web (Novice)
|on Jun 20, 2020 at 14:19 UTC||Need Help??|
bbs2web has asked for the wisdom of the Perl Monks concerning the following question:
I found the following script many years ago and it's been absolutely invaluable in providing for local or network based block device replication. Part of it's neat beauty is that it's trivial to simply copy & paste the lines on a Linux host's shell prompt. It essentially reads data from both source and either local or remote destination block devices (could be entire drive, partition, md device or in our case a Ceph RBD image) in 4 MiB chunks. If the chunk's md5 checksum matches it skips ahead, otherwise it overwrites that chunk.
We are however increasingly being bottle necked by the MD5 hashing function and were wondering if anyone had recommendations on replacing the calls with something that could perhaps offload the hashing to an Intel CPU's AES instructions.
Local block devices:
Local source to remote block devices:On source system:
Unallocated, discarded or trimmed blocks read as zeros so read speeds accelerate to GiB/s levels where Perl's MD5 hashing function then becomes the bottleneck. Another thread (860184) referencing possibly skipping the MD5 check if buffers matched. I presume that wouldn't be easy to do on the network based iteration above although it would still save time one some operations...