我一直在努力解决 Headless Chromium 的性能问题。我的计划是以至少 30fps(甚至更高)的速度捕获加载的网站。但是,随着分辨率的提高,返回帧的频率会下降。
对于 720p 的窗口分辨率,每当将分辨率更改为 1080p 时,我可以轻松达到 ~35fps,然后帧数下降到 ~20fps 甚至更低。
我在一台有 30 个 CPU 的机器上运行 Google Cloud Compute Engine 上的 Chromium,但它根本没有完全使用。
你们中有人遇到过类似的问题吗?
我的一些设置:
-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
最佳答案
我发现,如果我在静默期间运行我的容器,它们会运行得更快,从 Gitlab-CI 装备转移到具有更快磁盘的机器上会改进它。
容器的大小很重要( Alpine ),容器主机上也有非常快的 SSD。在新设备上运行带有 Chromium v77 的 alpine v3.10 容器,我能够将时间从 117 秒减少到 43 秒,但是 Alpine 不是那么灵活,如果您必须编译东西,它变得几乎和 ubuntu 容器一样大。
关于google-chrome - Headless Chromium - 性能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55160480/