amazon-chime-sdk-component-library-react icon indicating copy to clipboard operation
amazon-chime-sdk-component-library-react copied to clipboard

High GPU Usage

Open marr opened this issue 4 years ago • 4 comments

Describe the bug I have the demo running locally, and with 8 other people joining from other computers, I see the CPU and GPU usage at about 40%. This seems to be a high amount of usage. My machine is pretty top end (16GB RAM/ i9), and we have experienced major slowdowns on other machines.

To Reproduce

  1. Using latest Chrome on Mac OS (Big Sur), have a computer connect 8 sessions to the same meeting.
  2. On another computer connect to the meeting with the 8 people in it.
  3. Notice the CPU and GPU usage with Chrome is very high. I see my CPU at 40% and GPU at 40%. On Firefox, the %CPU is around 75% and the GPU is around 11%.

Expected behavior I expect the CPU and GPU usage to not be as high, as there may be more than 12-15 people in a room which causes resource contention.

Desktop (please complete the following information):

  • OS: Mac OS Big Sur
  • Browser: Chrome 90.0.4430.212, Firefox 87.0 (64-bit)

Additional context Using the browser demo from the amazon-chime-sdk-js repo, I don't see these issues.

marr avatar May 18 '21 20:05 marr

The way chime works is that each video tile is its own video stream. That means that each video must be decoded individually. This uses a ton of CPU and/or GPU depending on your hardware and settings. The only way around this limitation is if Chime were to stitch together videos in their server, but then you'd have a lot less flexibility and I don't know fi they ever plan to do anything like that. For now, I think Chime is just an "SFU", i.e. selective forwarding.

There's a guide here to help with this: https://aws.github.io/amazon-chime-sdk-js/modules/qualitybandwidth_connectivity.html

jrowny avatar May 19 '21 14:05 jrowny

Thanks Jonathan, Do you know why we don't see the resource hogginess when using the vanilla js browser demo?

marr avatar May 19 '21 15:05 marr

@marr the react library sets a lot of things for you, I haven't looked internally, but maybe they're setting a higher quality level or something?

jrowny avatar May 19 '21 15:05 jrowny

@jrowny I tested with lower quality video (320x200) and I didn't see much GPU change (maybe 1-2%). I don't think the react example (this repo) sets initial quality afaik, so it would default to 540p. Something with seems to be amiss with react taking up more GPU than vanilla js.

marr avatar May 21 '21 18:05 marr

@marr did you end up finding a solution to this? Or work out what it was? I am also having this problem where before we were running the vanilla JS chime library on a version below 3 and it used almost no gpu. now the same number of streams uses 2.5x the amount of gpu

Lithial avatar Dec 05 '22 03:12 Lithial

I actually worked this one out at least what it was for me. I had a css bug where the video tiles container has filter: box-shadow() on it which was causing a massive amount of redraws. apparently its a common bug with boxshadow and targets that are animated. removing this css caused my performance to stabilize at previous levels. So if you run into this problem at all, try turning off css like filter and shadows around your video to see if it goes away.

Lithial avatar Dec 08 '22 02:12 Lithial