Curious about running multiple xvfb displays: I have between 10-50 instances of a script running in parallel that connect to an xvfb display. Is is advantageous to run the same number of xvfb displays and connect 1 to 1? Or can multiple processes share the same display? RAM is not an issue, neither is processing power.
Asked
Active
Viewed 7,365 times
1 Answers
13
One Xvfb server should be able to handle lots of connections quite well. One thing you want to make sure you do is run the server with the -noreset
option. Without it, it has a memory leak every time a client disconnects.
The only time multiple Xvfb servers is helpful is if you have more than one processor available in the machine (e.g. 8 cores) and your script is graphics-heavy. To see if this is the case, connect many instances of your script and check top
to see what the CPU usage of Xvfb is. If it's at 100%, you might benefit from additional Xvfb instances.

jterrace
- 64,866
- 22
- 157
- 202
-
Cool. I have a i7 quad-core. I'm rendering around 50 web pages per second. I didn't know about the -noreset option, my (16GB) memory was maxing out every 45 minutes. My dirty fix was to cron killall Xvfb every 15 minutes. Thanks for that. My CPU hovers around 70% to 90% with one Xvfb server. With your information I'm thinking 4 servers in a round robin queue? – nathancahill Jun 11 '12 at 22:26
-
Is the single Xvfb process taking 70% to 90% cpu? That's out of 400% right? So it's 70-90% of a single core? – jterrace Jun 11 '12 at 22:47
-
Now that I look at it, it's my python scripts that are connecting to the Xvfb that are taking up the CPU. The xvfb server is around 3%. Yes, that's out of 400%. – nathancahill Jun 12 '12 at 01:23
-
Yeah if xvfb is so low, 1 server should be fine – jterrace Jun 12 '12 at 03:10