Bug 2142779 - animations (PatternFly Spinner, Skeleton) causing excessive CPU load in kvm virtual machines
Summary: animations (PatternFly Spinner, Skeleton) causing excessive CPU load in kvm v...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: webkit2gtk3
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Michael Catanzaro
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-11-15 09:12 UTC by Radek Vykydal
Modified: 2022-11-15 14:21 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 14:02:35 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Radek Vykydal 2022-11-15 09:12:40 UTC
Description of problem:

In Anaconda installer Web UI we are developing we are using PatternFly / React. Progress animations are causing excessive CPU load when installing in kvm Virtual Machines. We are seeing the issue also on regular system (kvm Virtual Machines with Fedora 37).

Version-Release number of selected component (if applicable):

Fedora 37

How reproducible:

Always

Steps to Reproduce: 
1.
2.
3.

In Fedora 37 in kvm vm (4 CPUs, 4GB RAM) run React application with animations:
(the hypervisor: [1])

1) for example the basic react app from https://create-react-app.dev/:
npx create-react-app my-app

2) or our testing small app with PatternFly Spinner / Skeleton / EmptyStateIcon components:
https://rvykydal.fedorapeople.org/testing_app_spinner.tar.gz

and watch the CPU load.

Tasks: 300 total,   3 running, 297 sleeping,   0 stopped,   0 zombie
%Cpu(s): 62.4 us,  6.6 sy,  0.0 ni, 29.9 id,  0.0 wa,  0.9 hi,  0.1 si,  0.1 st
MiB Mem :   3821.3 total,    469.5 free,   1648.5 used,   1703.3 buff/cache
MiB Swap:   3821.0 total,   3820.7 free,      0.2 used.   1903.8 avail Mem.

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6556 rvykydal  20   0  103.1g 198356 138120 R 159.5   5.1   0:51.26 WebKitWebProces
   1593 rvykydal  20   0 4877300 336756 141340 S  96.0   8.6  11:51.67 gnome-shell
   6531 rvykydal  20   0  102.4g 134476 100164 R  18.6   3.4   0:06.34 cockpit-client
   5657 root      20   0       0      0      0 I   0.7   0.0   0:00.39 kworker/u8:3-events_unbound
      1 root      20   0  172100  17948  11228 S   0.0   0.5   0:02.64 systemd

after hiding the animations:

Tasks: 297 total,   1 running, 296 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.1 st
MiB Mem :   3821.3 total,    455.0 free,   1663.1 used,   1703.2 buff/cache
MiB Swap:   3821.0 total,   3820.7 free,      0.2 used.   1889.3 avail Mem.

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6629 rvykydal  20   0  224952   4008   3092 R   0.7   0.1   0:00.07 top
    115 root      20   0       0      0      0 I   0.3   0.0   0:01.26 kworker/u8:6-events_unbound
    706 systemd+  20   0   16156   7880   6948 S   0.3   0.2   0:07.07 systemd-oomd
   1785 root      20   0  239168   9144   7708 S   0.3   0.2   0:06.21 sssd_kcm
      1 root      20   0  172100  17948  11228 S   0.0   0.5   0:02.64 systemd

We use cockpit-client which is using WebKit2Gtk:
/usr/libexec/cockpit-client --external-ws http://127.0.0.1:8000

Actual results:

Excessive CPU load.

Expected results:

No excessive CPU load.

Additional info:

We have been resolving similar issues with Gtk spinner in VM in Anaconda Gtk GUI: https://bugzilla.redhat.com/show_bug.cgi?id=1204242
and also now played with animation paramteres to reduce the CPU load as a workaround:
https://github.com/rhinstaller/anaconda/pull/4424.

Tasks: 300 total,   1 running, 299 sleeping,   0 stopped,   0 zombie
%Cpu(s): 50.5 us,  9.8 sy,  0.0 ni, 38.1 id,  0.0 wa,  1.3 hi,  0.2 si,  0.1 st
MiB Mem :   3821.3 total,    236.8 free,   1873.9 used,   1710.5 buff/cache
MiB Swap:   3821.0 total,   3820.7 free,      0.2 used.   1669.9 avail Mem.

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   1593 rvykydal  20   0 4893472 361112 150732 S 152.8   9.2  13:17.47 gnome-shell
   6665 rvykydal  20   0 3184384 332144 163372 S  53.5   8.5   0:22.22 firefox
   6764 rvykydal  20   0 2671764 118320  99468 S  31.2   3.0   0:10.05 Isolated Web Co
   5657 root      20   0       0      0      0 I   1.0   0.0   0:00.58 kworker/u8:3-events_unbound
    115 root      20   0       0      0      0 I   0.3   0.0   0:01.47 kworker/u8:6-blkcg_punt_bio
      1 root      20   0  172100  17948  11228 S   0.0   0.5   0:02.65 systemd

We also tried run firefox --kiosk http://127.0.0.1:8000. In this case the CPU load is far better for Firefox, but the load of gnome-shell process (which was already high for webkit) has significantly risen.

after hiding the animations:

Tasks: 306 total,   1 running, 305 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.1 us,  0.4 sy,  0.0 ni, 98.3 id,  0.0 wa,  0.2 hi,  0.0 si,  0.0 st
MiB Mem :   3821.3 total,    246.9 free,   1863.8 used,   1710.6 buff/cache
MiB Swap:   3821.0 total,   3820.7 free,      0.2 used.   1680.0 avail Mem.

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   6665 rvykydal  20   0 3174128 333376 164136 S   3.3   8.5   0:34.78 firefox
   6985 rvykydal  20   0  224964   3932   3004 R   1.0   0.1   0:00.07 top
   6764 rvykydal  20   0 2673812 118864  99916 S   0.7   3.0   0:16.98 Isolated Web Co
   1785 root      20   0  239168   9144   7708 S   0.3   0.2   0:06.50 sssd_kcm
   3370 rvykydal  20   0   16260   6904   5092 S   0.3   0.2   0:00.08 sshd
      1 root      20   0  172100  17948  11228 S   0.0   0.5   0:02.65 systemd



--------------------------

[1] the hypervisor:

[rvykydal@cobra04 ~]$ uname -a
Linux cobra04 5.13.10-100.fc33.x86_64 #1 SMP Thu Aug 12 21:15:41 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[rvykydal@cobra04 ~]$ rpm -qi libvirt
Name        : libvirt
Version     : 6.6.0
Release     : 5.fc33
Architecture: x86_64

Comment 1 Michael Catanzaro 2022-11-15 14:02:35 UTC
Hi, feel free to report this on WebKit Bugzilla, using the WebKitGTK component so the right developers notice your report. It won't be fixed here since I'm the only downstream developer and I don't have time to look into it, and wouldn't have any clue where to start if I did. It will need to be profiled by a performance expert, but profiling in Fedora is impossible because we don't have frame pointers https://pagure.io/fesco/issue/2817.

tbh it's unlikely to be prioritized by upstream developers either, but at least on WebKit Bugzilla you would have a chance that interested developers might see it. Good luck....

Comment 3 Michael Catanzaro 2022-11-15 14:21:14 UTC
Actually there is one more thing to try: you could switch cockpit-client to use GTK 4 instead of GTK 3, and webkit2gtk-5.0 instead of webkit2gtk-4.1. Users are reporting huge performance improvements, so maybe you'll get lucky? Worth checking. Fortunately, cockpit-client looks pretty small, so it should not be too hard to switch.


Note You need to log in before you can comment on or make changes to this bug.