Snapd causes high io

snapd is causing very high io on my laptop.
It seems i’m not alone. link to a similar problem at stackoverflow
“sudo systemctl stop snapd.service” solves this problem but that prevents me from using snap.
According to the output of “cat /sys/kernel/debug/tracing/trace_pipe”, snapd causes “jbd2_commit_flushing” a few times per second.

How to slove that problem? Any help is appriciated!

My system is ubuntu 20.04. my snaps:

alex@Mia:~$ sudo snap list 
Name               Version                 Rev   Tracking         Publisher   Notes
core18             20200427                1754  latest/stable    canonical✓  base
gnome-3-34-1804    0+git.3009fc7           36    latest/stable/…  canonical✓  -
gtk-common-themes  0.1-36-gc75f853         1506  latest/stable/…  canonical✓  -
snap-store         3.31.1+git187.84b64e0b  415   latest/stable/…  canonical✓  -
snapd              2.45.1                  8140  latest/stable    canonical✓  snapd

output of iotop:

Total DISK READ:         0.00 B/s | Total DISK WRITE:      1391.58 K/s
Current DISK READ:       0.00 B/s | Current DISK WRITE:       2.36 M/s
    TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND           
    437 be/3 root        0.00 B/s    0.00 B/s  0.00 % 39.05 % [jbd2/dm-0-8]
  53417 be/4 root        0.00 B/s  385.78 K/s  0.00 %  1.09 % snapd
  53418 be/4 root        0.00 B/s  183.71 K/s  0.00 %  0.64 % snapd
  53444 be/4 root        0.00 B/s  128.59 K/s  0.00 %  0.39 % snapd
  53422 be/4 root        0.00 B/s  110.22 K/s  0.00 %  0.39 % snapd
  53545 be/4 root        0.00 B/s   91.85 K/s  0.00 %  0.38 % snapd
  53421 be/4 root        0.00 B/s  104.10 K/s  0.00 %  0.37 % snapd
  53409 be/4 root        0.00 B/s   73.48 K/s  0.00 %  0.36 % snapd
  53416 be/4 root        0.00 B/s   73.48 K/s  0.00 %  0.26 % snapd
  53562 be/4 root        0.00 B/s   73.48 K/s  0.00 %  0.25 % snapd
  53419 be/4 root        0.00 B/s   36.74 K/s  0.00 %  0.13 % snapd
  53543 be/4 root        0.00 B/s   88.79 K/s  0.00 %  0.13 % snapd
  53552 be/4 root        0.00 B/s   18.37 K/s  0.00 %  0.12 % snapd
  53542 be/4 root        0.00 B/s   18.37 K/s  0.00 %  0.01 % snapd
    487 be/3 root        0.00 B/s    4.59 K/s  0.00 %  0.00 % systemd-journald

output of “cat /sys/kernel/debug/tracing/trace_pipe”:

root@Mia:~# echo 1 > /sys/kernel/debug/tracing/events/jbd2/jbd2_commit_flushing/enable 
root@Mia:~# cat /sys/kernel/debug/tracing/trace_pipe
     jbd2/dm-0-8-437   [002] .... 17283.340517: jbd2_commit_flushing: dev 253,0 transaction 2810751 sync 0
     jbd2/dm-0-8-437   [002] .... 17283.362244: jbd2_commit_flushing: dev 253,0 transaction 2810752 sync 0
     jbd2/dm-0-8-437   [002] .... 17283.378934: jbd2_commit_flushing: dev 253,0 transaction 2810753 sync 0
     jbd2/dm-0-8-437   [002] .... 17283.469004: jbd2_commit_flushing: dev 253,0 transaction 2810754 sync 0
     jbd2/dm-0-8-437   [002] .... 17283.485497: jbd2_commit_flushing: dev 253,0 transaction 2810755 sync 0
     jbd2/dm-0-8-437   [002] .... 17283.501523: jbd2_commit_flushing: dev 253,0 transaction 2810756 sync 0
     jbd2/dm-0-8-437   [002] .... 17283.512970: jbd2_commit_flushing: dev 253,0 transaction 2810757 sync 0
     jbd2/dm-0-8-437   [003] .... 17283.608488: jbd2_commit_flushing: dev 253,0 transaction 2810758 sync 0
     jbd2/dm-0-8-437   [003] .... 17283.620601: jbd2_commit_flushing: dev 253,0 transaction 2810759 sync 0
     jbd2/dm-0-8-437   [003] .... 17283.641163: jbd2_commit_flushing: dev 253,0 transaction 2810760 sync 0
     ...
1 Like

This looks like a problem that @cmatsuoka had.

Can you attach the output of snap changes?

If the problem is still happening, fatrace | grep snapd could give us information on what snapd is accessing in the filesystem.

This is the bug report that describes a similar problem: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1831629

1 Like

After the auto-refreshing of snap-store, from 3.31.1+git187.84b64e0b to 3.36.0-80-g208fd61, the problem is gone.
Perhaps there are some problems in the version 3.31, which I’ll never know.

alex@Mia:~$ snap list
Name               Version                     Rev    Tracking         Publisher   Notes
core18             20200427                    1754   latest/stable    canonical✓  base
gnome-3-28-1804    3.28.0-17-gde3d74c.de3d74c  128    latest/stable    canonical✓  -
gnome-3-34-1804    0+git.3009fc7               36     latest/stable/…  canonical✓  -
gtk-common-themes  0.1-36-gc75f853             1506   latest/stable/…  canonical✓  -
lxd                4.2                         15675  latest/stable    canonical✓  -
snap-store         3.36.0-80-g208fd61          467    latest/stable/…  canonical✓  -
snapd              2.45.1                      8140   latest/stable    canonical✓  snapd
alex@Mia:~$ snap changes 
ID   Status  Spawn               Ready               Summary
21   Done    today at 07:15 CST  today at 07:17 CST  Auto-refresh snap "lxd"