You are not logged in.

#1 2016-06-24 14:23:06

cmtonkinson
Member
Registered: 2013-11-15
Posts: 18

[SOLVED] Optimizing performance of dmcrypt on bootable USB flash drive

I have Arch installed to a USB stick to use as a portable workstation, and I'm using dm-crypt (with cryptsetup/LUKS) to secure the root partition.

The target laptop has plenty of horsepower - an i7 and 8GB RAM. The drive is a Kingston HyperX Savage USB 3.1 (HXS3/128GB) with advertised throughput of 350MB/s R, 250MB/s W.

/dev/sdX1 - 100M unencrypted ext4 for /boot
/dev/sdX2 - 100G dm-crypt/LUKS ext4 for /

I formatted the luks container with the options

--verbose --verify-passphrase --cipher=aes-xts-plain64 --key-size=512 --hash=sha512 --iter-time=10000 --use-random

I wonder if there are any I/O optimizations I can make, given this configuration? Lower latency on small file read/write is more important than sustained sequential throughput (my workload is primarily web browsing and ruby development, not say gaming or video streaming/editing). With the i7, I can yield some CPU time to optimize disk ops if that's a decision point.

Maybe there are more/different luks parameters I could have used? Some dm-crypt flags I should set in the bootloader? Perhaps tweaking some kernel settings (such as filesystem caching pressure or flushing parameters)? I don't know what I don't know, so these are only vague guesses.

Last edited by cmtonkinson (2016-06-30 01:19:03)

Offline

#2 2016-06-24 14:43:29

cmtonkinson
Member
Registered: 2013-11-15
Posts: 18

Re: [SOLVED] Optimizing performance of dmcrypt on bootable USB flash drive

I should clarify that the primary goal is decreasing the overall latency of a gnome-shell environment (but most of my time is spent in a browser or text editor).

Offline

#3 2016-06-24 15:04:36

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [SOLVED] Optimizing performance of dmcrypt on bootable USB flash drive

I doubt very much whether the bottleneck in this situation is going to be dm-crypt, with a modern processor with onboard AES instructions the overhead is negligible anyway.
Your better off just doing the standard optimizations for a USB drive like disabling ext4 journaling, mounting with the noatime option, changing the scheduler, using preload, storing firefox profiles in RAM etc...


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#4 2016-06-24 15:39:27

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] Optimizing performance of dmcrypt on bootable USB flash drive

Also try other filesystems. In my experience f2fs will perform better on usb flash drives than ext4 or btrfs. Mind you that I've done my last test a good while ago so things may be different now.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2016-12-28 16:41:51

mxfm
Member
Registered: 2015-10-23
Posts: 163

Re: [SOLVED] Optimizing performance of dmcrypt on bootable USB flash drive

Running cryptsetup test utility shows that on RAM using 256 instead of 512 (both sha and key size) increases performance.

Offline

#6 2016-12-28 17:35:46

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] Optimizing performance of dmcrypt on bootable USB flash drive

mxfm wrote:

Running cryptsetup test utility shows that on RAM using 256 instead of 512 (both sha and key size) increases performance.

Not relevant and necro-bumping, closing.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB