You are not logged in.

#1 2022-06-08 21:04:28

dudeguy
Member
Registered: 2022-06-08
Posts: 3

Computer freezing when downloading files

HI. I had a working arch system for over 2 years but I decided to start fresh with a new encrypted filesystem. So I used the new archinstall script and made a btrfs + luks encryption + zstd compression + btrfs subvolumes setup. This is pretty much all the recommended settings in the archinstall for btrfs.

Everything seems to work just fine except when I have moderately high disk usage like copying files from another disk or downloading games on Steam I get lags and freezes. Random programs seem to become very slow or just freeze for few seconds. I can have htop working and refreshing itself while firefox is completely unresponsive (still playing the YouTube video though).

Keep in mind that I have an nvme ssd so 2000+mb read/write should be possible and I'm downloading games at ~11mb/s.

Here are some logs from iostat 1 -sxt

06/08/2022 08:59:09 PM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.50    1.59    5.76    0.33    0.00   90.81

Device             tps      kB/s    rqm/s   await  areq-sz  aqu-sz  %util
dm-0              8.00   2728.00     0.00    9.25   341.00    0.07   5.80
nvme0n1          20.00   2132.00     0.00    6.50   106.60    0.13   5.80
sda               0.00      0.00     0.00    0.00     0.00    0.00   0.00
sdb               0.00      0.00     0.00    0.00     0.00    0.00   0.00


06/08/2022 08:59:10 PM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.51    1.59    3.86   15.94    0.00   77.10

Device             tps      kB/s    rqm/s   await  areq-sz  aqu-sz  %util
dm-0             60.00  32608.00     0.00  494.93   543.47   29.70 100.20
nvme0n1         254.00  29904.00     1.00   73.73   117.73   18.73  98.40
sda               0.00      0.00     0.00    0.00     0.00    0.00   0.00
sdb               0.00      0.00     0.00    0.00     0.00    0.00   0.00


06/08/2022 08:59:11 PM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.34    1.59    4.02   20.33    0.00   72.72

Device             tps      kB/s    rqm/s   await  areq-sz  aqu-sz  %util
dm-0             95.00  26424.00     0.00 1647.35   278.15  156.50 100.00
nvme0n1         268.00  29220.00     3.00   94.87   109.03   25.43 100.00
sda               0.00      0.00     0.00    0.00     0.00    0.00   0.00
sdb               0.00      0.00     0.00    0.00     0.00    0.00   0.00


06/08/2022 08:59:12 PM
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.51    1.34    3.77   10.47    0.00   82.91

Device             tps      kB/s    rqm/s   await  areq-sz  aqu-sz  %util
dm-0             80.00  26932.00     0.00 2490.43   336.65  199.23  99.80
nvme0n1         245.00  27220.00     1.00  102.03   111.10   25.00  99.80
sda               0.00      0.00     0.00    0.00     0.00    0.00   0.00
sdb               0.00      0.00     0.00    0.00     0.00    0.00   0.00

100% disk usage when just downloading and depacking a steam game ? Weird. I've read online that the encryption and btrfs compression is not that expensive to worry about so I hope there's another simpler problem to be solved (besides I don't want to wipe my disk again roll) Swap is off btw (just turned it off now) but it doesn't change anything.

NAME         MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda            8:0    0 465.8G  0 disk
├─sda1         8:1    0   529M  0 part
├─sda2         8:2    0   100M  0 part
├─sda3         8:3    0    16M  0 part
└─sda4         8:4    0 465.1G  0 part
sdb            8:16   1   7.5G  0 disk
├─sdb1         8:17   1   775M  0 part
└─sdb2         8:18   1    86M  0 part
zram0        253:0    0     0B  0 disk
nvme0n1      259:0    0 953.9G  0 disk
├─nvme0n1p1  259:1    0   509M  0 part  /boot
└─nvme0n1p2  259:2    0 953.4G  0 part
  └─cryptlvm 254:0    0 953.4G  0 crypt /home
                                        /var/log
                                        /var/cache/pacman/pkg
                                        /.snapshots
                                        /

CPU: AMD Ryzen 5 2600 (12) @ 3.400GHz
RAM: 16GB
Kernel: 5.18.2-260-tkg-pds (same thing happens on the stock kernel too !)

Offline

#2 2022-06-12 17:10:46

dudeguy
Member
Registered: 2022-06-08
Posts: 3

Re: Computer freezing when downloading files

Bump. Any tips ? What to check, what to try ?

Offline

#3 2022-06-12 17:30:34

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: Computer freezing when downloading files


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

#4 2022-06-12 19:32:54

seth
Member
Registered: 2012-09-03
Posts: 49,974

Re: Computer freezing when downloading files

Keep in mind that I have an nvme ssd

luks encryption + zstd compression

I guess the problem doesn't exist when downloading to the unencrypted sda/b?

I've read online that

Do we really have to talk about that?

I'd first run "cryptsetup benchmark" and compare the results w/ the algo you chose.
You might also want to try w/o compression to see whether that's the immediate cause - then maybe adjust the compression algo or the overall approach (rather not compress-force, maybe only chttr +c or frequent defrag -c, https://btrfs.wiki.kernel.org/index.php/Compression )

Online

#5 2022-06-12 22:00:28

dudeguy
Member
Registered: 2022-06-08
Posts: 3

Re: Computer freezing when downloading files

seth wrote:

Keep in mind that I have an nvme ssd

luks encryption + zstd compression

I guess the problem doesn't exist when downloading to the unencrypted sda/b?

I've read online that

Do we really have to talk about that?

I'd first run "cryptsetup benchmark" and compare the results w/ the algo you chose.
You might also want to try w/o compression to see whether that's the immediate cause - then maybe adjust the compression algo or the overall approach (rather not compress-force, maybe only chttr +c or frequent defrag -c, https://btrfs.wiki.kernel.org/index.php/Compression )

Thanks for the suggestions. I think I actually have compression disabled since I don't see it listed in the mount options

/dev/mapper/cryptlvm on / type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=256,subvol=/@)
/dev/mapper/cryptlvm on /.snapshots type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=257,subvol=/@.snapshots)
/dev/mapper/cryptlvm on /var/cache/pacman/pkg type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=260,subvol=/@pkg)
/dev/mapper/cryptlvm on /home type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=258,subvol=/@home)
/dev/mapper/cryptlvm on /var/log type btrfs (rw,relatime,ssd,space_cache=v2,subvolid=259,subvol=/@log)

My disk is encrypted using aes-xts-plain64

/dev/mapper/cryptlvm is active and is in use.
  type:    LUKS2
  cipher:  aes-xts-plain64
  keysize: 512 bits
  key location: keyring
  device:  /dev/nvme0n1p2
  sector size:  512
  offset:  32768 sectors
  size:    1999321088 sectors
  mode:    read/write

This is the result of cryptsetup benchmark for this cipher

$ cryptsetup benchmark --cipher aes-xts-plain64 --key-size 512
# Tests are approximate using memory only (no storage IO).
# Algorithm |       Key |      Encryption |      Decryption
    aes-xts        512b      2204.3 MiB/s      2224.2 MiB/s

Also I looked at how the computer behaves when copying these files again. I can consistently cause freezes by copying this one directory with data around (about 7gb, mostly large files inside).

What I notice is that for the first 5-10 seconds it all goes normal, it's around 400mb/s (about the max read speed of my second disk). and the cp process takes about 20% of the cpu. Everything else is running just fine in the background. Then at some point the computer stars lagging, but the CPU is still at low usage. All the processes start to slow down, the cp goes all the way down to 0%, so does firefox and other stuff. It's as if all these user space tasks didn't run at all, execution is stuck in kernel space ?

Copying the same folder to the other unencrytped disk causes no problems.

#/tmp/win is mounted unencrypted disk, home is encrypted nvme disk

$ time cp -r ~/games/fallout_nv/ /tmp/win/

real	0m30.710s
user	0m0.027s
sys	0m9.794s
$ time cp -r /tmp/win/fallout_nv ~/

real	1m37.358s
user	0m0.018s
sys	0m8.069s

#this took over a minute more and that's about how long the computer was frozen for while copyig

Last edited by dudeguy (2022-06-12 22:02:32)

Offline

#6 2022-06-13 06:24:12

seth
Member
Registered: 2012-09-03
Posts: 49,974

Re: Computer freezing when downloading files

What I notice is that for the first 5-10 seconds it all goes normal, it's around 400mb/s

Likely just cache.

dd if=/dev/zero of=/home/username/foo.dd oflag=direct count=1M # default bs is 512, so 512MB

The encryption looks accelerated, so that's "for free".

How do you monitor the CPU? top/htop?
Do you show kernel processes?
How does the RAM usage develop?
Are there IO errors in dmesg?
If you run a CPU intense process that's IO-free (hopefully), is that affected?

time echo "scale=5000; a(1)*4" | bc -l # don't post the result - it's Pi, just check the CPU and time stats

Online

#7 2022-09-19 07:42:11

gwaewion
Member
Registered: 2014-09-25
Posts: 9

Re: Computer freezing when downloading files

dudeguy wrote:

btrfs + luks encryption + btrfs subvolumes setup.

dudeguy wrote:

downloading games on Steam I get lags and freezes. Random programs seem to become very slow or just freeze for few seconds

dudeguy wrote:

I have an nvme ssd

You are not alone, I have same issue - high iowait up to 50%.

Offline

#8 2022-09-19 12:17:39

2ManyDogs
Forum Moderator
Registered: 2012-01-15
Posts: 4,645

Re: Computer freezing when downloading files

The OP has not been back since June, so I am going to consider this thread abandoned and close it.


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

Board footer

Powered by FluxBB