Why are TrueCrypt/VeraCrypt write speeds so *disproportionately* slow?

0

1

When I try to use TrueCrypt or VeraCrypt, write speeds are very slow, but read speeds are fast. This happens with both programs, and it occurs regardless of whether I'm using an encrypted file container or an encrypted partition. (So, no, this isn't fragmentation etc.)

For example, on my SSD where unencrypted read and write speed both benchmark over 1GB/s on CrystalDiskMark, an encrypted volume using AES-XTS and HMAC-RIPEMD-160 benchmarks read speeds of 810 MB/s vs. write speeds of 40 MB/s.

Why are encrypted writes so much slower than encrypted reads?

(And no, I'm not doing something silly like benchmarking in a VM. I swear I've already thought of all the "easy" answers and they don't explain the situation as far as I can tell.)

user541686

Posted 2018-04-28T05:51:12.567

Reputation: 21 330

Possible duplicate of Is a VeraCrypt partition slower?

– Keltari – 2018-04-28T06:16:43.363

1"Why are encrypted writes so much slower than encrypted reads?" The unencrypted write time should be significantly longer than the read time, so that benchmark is suspect. But the encryption process takes longer than the decryption process. It isn't clear what level of detail you're looking for to explain the difference. – fixer1234 – 2018-04-28T06:52:07.507

@fixer1234: "The unencrypted write time should be significantly longer than the read time, so that benchmark is suspect." ...no, my benchmark isn't suspect; you just haven't seen fast SSDs. However, I'm not aware of encryption taking 20x more time than decryption; it should be about the same as far as I'm aware. If you believe otherwise, you don't really need any detail to prove it: just show me a program (or use standard OpenSSL commands) that demonstrate encryption taking 20x longer than decryption. I'll happily accept such an answer. – user541686 – 2018-04-28T07:32:05.140

@Keltari: No, this isn't a duplicate of that... my read speed is so ridiculously faster than my write speed, even for the encrypted partition. That guy was just wondering why encryption was slower than plaintext... it doesn't explain the read-write discrepancy. – user541686 – 2018-04-28T07:35:10.263

What model CPU do you have? – davidgo – 2018-04-28T09:13:15.823

@davidgo: I don't see how the model could possibly explain the read vs. write difference, but 7820HQ... – user541686 – 2018-04-28T10:06:17.883

It won't be the issue in your build - but I was wondering if the CPU was lacking AeS-NI support. – davidgo – 2018-04-28T19:09:11.153

@davidgo: Yeah I got that part, but how would that make the read so much faster than the write? – user541686 – 2018-04-28T19:11:22.447

Answers

0

Are you sure it's the encryption alone causing the speed differences?

First, your drive could be using compression to return artificially high unencrypted read & write speeds. This article (also linked below) shows "Zalman actually draws an honest picture of data compression and its effect. The chart on its product website clearly shows that writing incompressible data may happen slower that compressible information." with the graphic showing incompressible reads 500MB/s and incompressible writes ~160MB/s.

And if the drive was full or wasn't TRIMed it could slow down writes from needing to erase sectors before writing. It's a security leak to even use TRIM with encryption, since it reveals which sectors are empty, and VeraCrypt may not be TRIMing (it really shouldn't), slowing writes.

And CrystalDiskMark (or the SSD itself) could be strongly influenced by the filesystem and type of test being done. I'd try several different tests, and different benchmarks too (like AS SSD & Iometer & PCMark) and real-world usage tests before concluding that slow encryption is the only possible cause.

This article on Tom's Hardware, Does Your SSD's File System Affect Performance?, shows wildly different read & write speeds for three different filesystems on two different SSD's, without any encryption. Here's a few of the results:

enter image description here

Reads could even be much slowerdescription

enter image description here

enter image description here

Xen2050

Posted 2018-04-28T05:51:12.567

Reputation: 12 097