无头铬 - 性能

mbu*_*tan 5 video google-chrome headless chromium google-chrome-devtools

我一直在努力解决 Headless Chromium 的性能问题。我的计划是以至少 30fps(甚至更高)的速度捕获加载的网站。然而,随着分辨率的提高,返回帧的频率会下降。

对于 720p 窗口分辨率,只要将分辨率更改为 1080p,我就可以轻松达到约 35fps,然后帧数会下降到约 20fps 甚至更低。我在一台有 30 个 CPU 的机器上运行 Google Cloud Compute Engine 上的 chromium,但根本没有完全使用。

你们中有人遇到过类似的问题吗?

我的一些设置:

  • 为了捕获帧,应用程序使用 Chrome 开发工具事件“Page.screencastFrame”。
  • Google 云计算引擎 - 30CPU、30GB 内存
  • 标志:-disable-translate --disable-extensions --disable-background-networking --safebrowsing-disable-auto-update --disable-sync --metrics-recording-only --disable-default-apps --no-first-run --remote-debugging-port=9222 --user-data-dir=/var/app/CHROME --disable-setuid-sandbox --window-size=1920,1080 --disable-gpu --hide-scrollbars --user-agent=true --remote-debugging-address=0.0.0.0 --no-sandbox --no-zygote --headless --autoplay-policy=no-user-gesture-required --disable-notifications --disable-logging --disable-permissions-api

Mor*_*enB 1

我发现,如果我在静默期运行容器,它们会运行得更快,从 Gitlab-CI 设备转移到磁盘速度快得多的机器上,性能会得到改善。

容器的大小很重要(高山),容器主机上也有非常快的 SSD。在新设备上运行带有 chromium v​​77 的 alpine v3.10 容器,我能够将时间从 117 秒减少到 43 秒,但是 Alpine 不太灵活,如果你必须编译东西,它几乎和 ubuntu 容器一样大。