4 ms·
What are the pros and cons of running headless Chrome compared to running Chrome in a virtual display driver like Xvfb?
by codewithcheese 9y ago
What are the pros and cons of running headless Chrome compared to running Chrome in a virtual display driver like Xvfb?
- simlevesque 9y agoXvfb is way harder to setup. Also, I assume it uses less ressources so it scales better.
- codewithcheese 9y agoYes, I assume that the drawing process may be different. However, it's probably still possible to take a screenshot. I would like to know what sort of performance differential I can expect.
- floatboth 9y agoScreenshot functionality is, in fact, advertised in the linked article.
- cryptarch 9y agoI use xvfb-run on Debian and it's a breeze: xvfb-run -s '-screen 0 1280x1024x8' ./cucumber Or are you using more advanced Xvfb features, or perhaps running inside containers?
- michaelmcmillan 9y agoIn my experience it's not a breeze: https://github.com/SeleniumHQ/docker-selenium/issues/87#issuecomment-297944128 https://github.com/SeleniumHQ/docker-selenium/issues/87#issu...
- bdcravens 9y agoxvfb can be a bit tough to setup, but Selenium's Docker images make this a breeze, and they even have a debug mode with automatic VNC.
- codedokode 9y agoIt would be difficult to run this set up on Windows for example.
- heipei 9y agoI haven't looked at Headless closely enough yet, but the biggest pros I can see are: - Potentially less overhead (system resources) - Much simpler setup (compared to something like Xvfb) - Better support for actual automation tasks, e.g. screenshots, separate sessions, etc. The last point is especially relevant if you run a tool that is visiting many sites in parallel. If you run multiple tabs per process to keep memory usage and Xvfb instances limited then you won't be able to have separate browsing sessions, e.g. two concurrent navigations to the same origin could interfere with each other (cookies, local storage, etc). Another obstacle I have discovered is that you can only take screenshots for the tab that is currently active. For my site (https://urlscan.io https://urlscan.io) I work around that by manually activating the tab when the load event fires to take the screenshot. Works reasonably well, but can sometimes fail under load.
- bdcravens 9y ago> If you run multiple tabs per process to keep memory usage and Xvfb instances limited then you won't be able to have separate browsing sessions, e.g. two concurrent navigations to the same origin could interfere with each other (cookies, local storage, etc). Assuming you're running Selenium, this is handled. If you need, you can call each session with its own profile.
- pharrlax 9y ago>If you run multiple tabs per process to keep memory usage and Xvfb instances limited then you won't be able to have separate browsing sessions, e.g. two concurrent navigations to the same origin could interfere with each other (cookies, local storage, etc). Another obstacle I have discovered is that you can only take screenshots for the tab that is currently active. This is a huge flaw in NightmareJS, which is disappointing because of how beautifully simple its API is. A Nightmare fork rebuilt over headless Chrome would be the best of all worlds for browser automation.