[dm-crypt] poor mysqldump performance
treed at ultraviolet.org
Thu Feb 23 23:23:00 CET 2012
I am using dmcrypt/LUKS on:
Doing a mysqldump from the LUKS/dmcrypt volume takes twice as long as it does
from a non-encrypted volume. Only a few percent of the CPU are taken for the
encryption so it isn't kcryptd maxing out the CPU. Most interestingly I notice
that iowait goes from 90% for the non-encrypted db to 99% for the encrypted db.
It really looks like a lot more IO is somehow generated.
This makes no sense to me as I understand dmcrypt to sit above the disk layer
and do a block-for-block encrypt/decrypt of the data as it passes through. How
could it possibly cause extra disk IO? At first I thought maybe it was disk
alignment (which has bitten me many times before) but we are doing reads here,
not writes. iostat confirms that during the mysqldump practically no writes are
happening. I've also looked at increasing readahead to no effect.
I've googled and found that as long as dmcrypt isn't maxing out the CPU (for
which latest kernels support AES-NI and multi-threaded kcryptd) the performance
with and without encryption should be pretty much the same. I don't understand
why my reads are taking such a hit.
More information about the dm-crypt