DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marc MERLIN <marc@merlins.org>
To: Yves-Alexis Perez <corsac@debian.org>,
	dm-crypt@saout.de, htd@fancy-poultry.org
Subject: Re: [dm-crypt] aes-xts-plain with aes_x86_64 makes my SSD 5x slower than my encrypted HD
Date: Sun, 22 Jul 2012 14:55:39 -0700	[thread overview]
Message-ID: <20120722215539.GB12951@merlins.org> (raw)
In-Reply-To: <20120722203929.GB3925@merlins.org>

On Sun, Jul 22, 2012 at 01:39:29PM -0700, Marc MERLIN wrote:
> Result is the same:
> gandalfthegreat:~# hdparm -tT /dev/mapper/ssdcrypt 
> 
> /dev/mapper/ssdcrypt:
>  Timing cached reads:   16614 MB in  2.00 seconds = 8317.50 MB/sec
>  Timing buffered disk reads:  68 MB in  3.08 seconds =  22.09 MB/sec
> 
> Grumble.
> 
> It shouldn't be a hardware problem since I do see 400MB/s before encryption.

Ok, I'm not sure I understand. I mounted /dev/mapper/ssdcrypt (btrfs)
and when going through the filesystem I get much higher speeds than
using dd on the raw block device.
But... when I run 

The test below shows that I can access the encrypted SSD 10x faster by talking
to it through a btrfs filesystem than doing a dd read from the device node.

So I suppose I could just ignore the dd device node thing, however not really.
Let's take a directory with some source files inside:

gandalfthegreat:/var/local# find src | wc -l
15261
gandalfthegreat:/var/local# echo 3 > /proc/sys/vm/drop_caches; time du -sh src
514M	src
real	0m5.865s

So on an encrypted spinning disk, it takes 6 seconds.
On my SSD in the same machine with the same encryption and the same btrfs filesystem,
I get 5 times slower:
gandalfthegreat:/mnt/btrfs_pool1/var/local# time du -sh src
514M	src
real	0m24.937s

Incidently 5x is also the speed difference between my encrypted HD and encrypted SSD
with dd.
Now, why du is 5x slower and dd of a file from the filesystem is 2.5x
faster, I have no idea :-/


See below:

1) drop caches
gandalfthegreat:/mnt/btrfs_pool1/var/local/VirtualBox VMs/w2k_virtual# echo 3 > /proc/sys/vm/drop_caches

gandalfthegreat:/mnt/btrfs_pool1/var/local/VirtualBox VMs/w2k_virtual# dd if=w2k-s001.vmdk of=/dev/null
2146631680 bytes (2.1 GB) copied, 8.03898 s, 267 MB/s
-> 267MB/s reading from the file through the encrypted filesystem. That's good.

For comparison
gandalfthegreat:/mnt/mnt2# dd if=w2k-s001.vmdk of=/dev/null 
2146631680 bytes (2.1 GB) copied, 4.33393 s, 495 MB/s
-> almost 500MB/s reading through another unencrypted filesystem on the same SSD

gandalfthegreat:/mnt/btrfs_pool1/var/local/VirtualBox VMs/w2k_virtual# dd if=/dev/mapper/ssdcrypt of=/dev/null bs=1M count=1000
1048576000 bytes (1.0 GB) copied, 45.1234 s, 23.2 MB/s

-> 23MB/s reading from the block device that my FS is mounted from. WTF?

gandalfthegreat:/mnt/btrfs_pool1/var/local/VirtualBox VMs/w2k_virtual# echo 3 > /proc/sys/vm/drop_caches; dd if=w2k-s001.vmdk of=test
2146631680 bytes (2.1 GB) copied, 17.9129 s, 120 MB/s

-> 120MB/s copying a file from the SSD to itself. That's not bad.

gandalfthegreat:/mnt/btrfs_pool1/var/local/VirtualBox VMs/w2k_virtual# echo 3 > /proc/sys/vm/drop_caches; dd if=test of=/dev/null
2146631680 bytes (2.1 GB) copied, 8.4907 s, 253 MB/s

-> reading the new copied file still shows 253MB/s, good.

gandalfthegreat:/mnt/btrfs_pool1/var/local/VirtualBox VMs/w2k_virtual# dd if=test of=/dev/null
2146631680 bytes (2.1 GB) copied, 2.11001 s, 1.0 GB/s

-> reading without dropping the cache shows 1GB/s 

I'm very lost now, any idea what's going on?

Thanks,
Marc
-- 
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems ....
                                      .... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/

  parent reply	other threads:[~2012-07-22 21:55 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-22 19:07 [dm-crypt] aes-xts-plain with aes_x86_64 makes my SSD 5x slower than my encrypted HD Marc MERLIN
2012-07-22 19:47 ` Yves-Alexis Perez
2012-07-22 20:39   ` Marc MERLIN
2012-07-22 21:47     ` Arno Wagner
2012-07-23  6:07       ` Yves-Alexis Perez
2012-07-23  6:28       ` Marc MERLIN
2012-07-23  8:14         ` Arno Wagner
2012-07-23 10:46           ` Milan Broz
2012-07-23 11:09             ` Yves-Alexis Perez
2012-07-23 11:37               ` Milan Broz
2012-07-23 15:08                 ` André Gall
2012-07-23 17:27                 ` André Gall
2012-07-24 14:06             ` Heinz Diehl
2012-07-24 14:16               ` Milan Broz
2012-07-23 16:12           ` Marc MERLIN
2012-07-23 16:19             ` Yves-Alexis Perez
2012-07-23 17:54               ` Marc MERLIN
2012-07-23 19:26                 ` Yves-Alexis Perez
2012-07-23 17:15             ` Milan Broz
2012-07-23 17:51               ` Marc MERLIN
2012-07-23 21:31                 ` Milan Broz
2012-07-24  5:57                   ` Marc MERLIN
2012-07-24  6:25                     ` Heinz Diehl
2012-07-24 15:02                       ` Marc MERLIN
2012-07-24 15:19                         ` Milan Broz
2012-07-24 16:09                           ` Marc MERLIN
2012-07-24 13:54                     ` Milan Broz
     [not found]                       ` <500E9099.8050501@redhat.com>
2012-07-24 14:27                       ` Heinz Diehl
2012-07-24 14:58                         ` Heinz Diehl
2012-07-24 15:38                           ` Marc MERLIN
2012-07-24 16:48                             ` Heinz Diehl
2012-07-24  6:11                   ` Heinz Diehl
2012-07-22 21:55     ` Marc MERLIN [this message]
2012-07-22 20:22 ` Heinz Diehl
2012-08-12 12:49 ` Pasi Kärkkäinen
2012-08-16  7:43   ` Marc MERLIN
     [not found]     ` <502D1F96.3080905@andregall.de>
2012-08-16 17:57       ` Marc MERLIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120722215539.GB12951@merlins.org \
    --to=marc@merlins.org \
    --cc=corsac@debian.org \
    --cc=dm-crypt@saout.de \
    --cc=htd@fancy-poultry.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox