Xpra: Ticket #2341: faster server startup

Following the complaint that xpra startup is slow (ie: in this ticket: https://github.com/mviereck/x11docker/issues/167), we can parallelize some of the mixin startup work.

Related to #1838



Wed, 26 Jun 2019 09:06:42 GMT - Antoine Martin: status changed

Updates:


Wed, 26 Jun 2019 12:28:37 GMT - Antoine Martin:

Remaining places where we could save time:


Wed, 26 Jun 2019 16:57:41 GMT - Antoine Martin:


Wed, 26 Jun 2019 16:58:18 GMT - Antoine Martin: attachment set

ugly debug logging patch


Fri, 28 Jun 2019 19:49:03 GMT - Antoine Martin:

Updates:

With these changes and the following command line:

python3 /usr/bin/xpra start --no-daemon --start=xterm \
   --opengl=noprobe --xsettings=no --no-speaker --no-microphone --html=no

The startup takes at most 350ms on my laptop. (400ms for python2)

Other places where we still spend a little bit too much time:

New potential issue: race condition if we are still initializing via the worker thread when we are asked to shutdown.. maybe process the shutdown request via the worker thread to guarantee we complete what has already been queued?


Sat, 29 Jun 2019 15:01:22 GMT - Antoine Martin:

New issues found in https://github.com/mviereck/x11docker/files/3341648/xpraserver.log:

Partially dealt with in r23043. I'm not sure we want to spend more time on this particular issue: re-using an existing display is not a standard setup..


Sat, 29 Jun 2019 15:28:56 GMT - Antoine Martin:

See also #2344 and #2347


Sat, 29 Jun 2019 19:57:42 GMT - mviereck: cc set


Sun, 30 Jun 2019 10:22:24 GMT - Antoine Martin: attachment set

shows that the main loop startup is not slow because of anything we do


Sun, 30 Jun 2019 10:23:18 GMT - Antoine Martin: status changed; resolution set

Updates:

With all these changes, a server starts on my laptop in under 4 seconds flat - and that's including the slow xvfb startup! With an existing display, the total startup time (logged) is now around 250ms! (actual time is marginally higher than that since logging starts after a the initial startup code)

Log sample with an existing display:

$ python3 /usr/bin/xpra start --no-daemon --start=xterm \
    --opengl=noprobe --xsettings=no --speaker=no --microphone=no \
    --mdns=no --start-new-commands=no --notifications=no --html=no \
    :10 --use-display
2019-06-30 11:15:27,722 created unix domain socket: /run/user/1000/xpra/linux.home-10
2019-06-30 11:15:27,766 pointer device emulation using XTest
2019-06-30 11:15:27,787 xvfb pid=20443
2019-06-30 11:15:27,959 xpra is ready.
2019-06-30 11:15:27,960 xpra GTK3 X11 version 3.0-r22755 64-bit
2019-06-30 11:15:28,037  uid=1000 (antoine), gid=1000 (antoine)
2019-06-30 11:15:28,038  running with pid 20892 on Linux Fedora 30 Thirty
2019-06-30 11:15:28,038  connected to X11 display :10 with 24 bit colors
2019-06-30 11:15:28,657 found 1 virtual video device for webcam forwarding
2019-06-30 11:15:28,750 7.7GB of system memory

Mon, 01 Jul 2019 14:39:29 GMT - Antoine Martin:

r23066: don't load xdg menu data unless start-new-commands is enabled - huge savings


Tue, 02 Jul 2019 07:40:36 GMT - Antoine Martin:

See also:


Tue, 16 Jul 2019 16:28:38 GMT - Antoine Martin:

This may have caused a regression: #2355.

And definitely caused this bug: #2180


Wed, 24 Jun 2020 07:03:38 GMT - Antoine Martin:

New ticket for 4.1: #2815


Sat, 23 Jan 2021 05:48:42 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/2341