Ubuntu performance is bad with cryptsetup/lvm setup

1

I currently have the following setup on my laptop - harddrive is divided in 3 parts, first one is a /boot for my ubuntu, third one is a windows installation, and one in the middle is a encrypted partition, which has lvm with 3 partitions - / and /home with btfs and /swap. On those i have Ubuntu 10.10 installed.

I do encryption with cryptsetup/luks.

Unfortunately I have a very poor performance in this setup - boot takes almost 3 minutes and after boot system "warms up" to normal performance for a minute/two. I suspect that disk i/o is a problem, as stuff like apt-get is sometimes very slow on i/o intensive operations ("reading database"). I wonder why my i/o performance could be slow. I have 3 ideas - either lvm behaves bad over luks encrypted partition, or btrfs behaves badly for some reason or ubuntu installation for some reason is screwed up (which I doubt).

I wonder if any of those suggestions are possible and if not what else could so drastically affect performance.

PS: Before this installation performance was okay with luks-on-lvm setup (3 lvm partitions encrypted by luks) and ext4 fs setup, so it's this installation, not laptop.

PPS: Encryption is aes-xts-plain 512 bits.

freiksenet

Posted 2010-10-21T19:09:13.423

Reputation: 63

1What hardware are you using and what encryption options did you pick? My 10.10 install on a netbook using luks and ext4 boots at normal speed so it's probably related to your hardware or encryption choices. – Cry Havok – 2010-10-21T19:19:17.427

Hardware shouldn't be relevant, as I had different setup on same hardware and it worked fine. – freiksenet – 2010-10-21T19:23:59.453

That's your assumption, but it may not be valid hence why I asked. Remember that the encryption/decryption adds an overhead so that it runs fine unencrypted means nothing. – Cry Havok – 2010-10-21T20:11:04.563

It ran fine encrypted, but with different setup - it was lvm, which partitions was encrypted, not encrypted partition on lvm. Post mentions that. – freiksenet – 2010-10-22T20:15:30.780

Might just by fluke be a bad install or the different configuration has it on a bad/slower part of the disk drive. – wag2639 – 2010-10-28T06:16:47.050

Have you tried in http://askubuntu.com or http://unix.stackexchange.com ?

– Toto – 2010-10-29T19:22:47.613

Answers

2

Hi i think you have chosen a too strong encryption, which is causing the performance problems. 512 bits is a little overkill, 256 should be enougth, since it is still secure and probably will be for a lot of years to come.

scigor

Posted 2010-10-21T19:09:13.423

Reputation: 913

Ok, that sounds reasonable. I didn't think encryption can so drastically decrease performance. I'll try to reencrypt everything with lower bitrate. – freiksenet – 2010-10-31T07:44:03.703

If the chosen encryption scheme (or your partitioning setup) happens to line up poorly with the native disk drive geometry, you can see performance (especially for small random IO like apt) plumet as the disk reads 2 blocks where before (in a properly aligned setup) it only read one. – Paul McMillan – 2011-02-08T00:44:15.023

0

I would guess the problem is btrfs on LVM. I've had poor experiences with that combination (mostly much worse latency for individual I/O requests than expected). Overall performance may be okay so it really depends on your workload. If you need low latency for each request I would recommend using EXT4 on LVM or btrfs on raw devices.

Mikko Rantalainen

Posted 2010-10-21T19:09:13.423

Reputation: 375

The problem may also have been related to the fact that the OP asked this question in 2010, before AES-NI was commonplace. – duskwuff -inactive- – 2018-04-25T08:34:29.557

@duskwuff it's true that the question is pretty old. However, I've been using LUKS since around the same time period I'd say that compared to performance of rotating harddrives, LUKS is/was fast enough already. – Mikko Rantalainen – 2018-04-25T09:23:20.060