Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xrdp Slow #1600

Closed
gamersalpha opened this issue Jun 6, 2020 · 11 comments
Closed

Xrdp Slow #1600

gamersalpha opened this issue Jun 6, 2020 · 11 comments
Labels
question or troubleshoot question or trouble shoot, not confirmed as xrdp bug or issue yet

Comments

@gamersalpha
Copy link

Hello there,

i m just installa frech install of ubuntu 20.04 and update evrything i just install
sudo apt_get install xrdp

so i can connect on my virtual machine got to issue very bad :

  • No sound
  • and the acess is very slow

can u help me to fix this please

@matt335672
Copy link
Member

Hi @gamersalpha

  • sound: the distro xrdp doesn't include the pulseaudio drivers, so you'll need to follow the procedure we've already discussed in Ubuntu 20.04 - Audio compilation Error #1564 I'm happy to help you with that if you want to try it.
  • slow: You've not given us a lot to go on. What are you trying to achieve exactly? Running a remote desktop over a network is never going to be as quick as running locally.

If you're trying to use a console login at the same time as a remote login on any version of 20.04, read this wiki page.

@metalefty metalefty added the question or troubleshoot question or trouble shoot, not confirmed as xrdp bug or issue yet label Jun 25, 2020
@gamersalpha
Copy link
Author

Hello there,
so i try again, i get smooth moving windows is slow

so i m on windows and i connect in rdp to my linux machine ubuntu 20.04 desktop

@matt335672
Copy link
Member

Hi @gamersalpha

Are you saying that just dragging Windows about on the desktop is slow?

That doesn't sound like normal behaviour. What kind of network have you got between the two machines? Are they on the same LAN? Are you running wired or wireless?

@ehaughee
Copy link

ehaughee commented Mar 10, 2021

I'm having a similar issue with input lag, choppy rendering, etc. I am on the same LAN (both wired) connecting from a Windows 10 machine using Remote Desktop. What other information would be helpful?

Ubuntu 20.04
KDE Plasma 5.18.5
xrdp 0.9.12

@matt335672
Copy link
Member

Hi @ehaughee

That sounds like a bandwidth or latency issue, or possibly packet drops. Are you running a graphically intensive application?

First thing to do would be to establish the available bandwidth and latency between the server and the client, with the server sending. I can't stress enough that it's worth measuring this rather than just assuming all is OK with the link, and you're getting the advertised link speed at both ends.

Measure bandwidth with iperf3. If you can it's best to stop xrdp and reuse its port to make sure packets are traversing host firewalls in the same way. So, on the server:-

  • sudo systemctl stop xrdp
  • iperf3 -s -p 3389

On the client:-

  • iperf3 -c <hostname> -p 3389 -R

On a wireless connection here I get around 52Mb/s from a cheap Windows laptop. That's going through two virtual routers (all on the same site).

Latency (i.e. round-trip-time) can be measured by using ping from the windows side. I'm getting single-digit milliseconds.

That's not a great link, but it's absolutely fine for running software development tools.

Measure the actual bandwidth being used by xrdp by using 'iftop'. So once you've stopped iperf3, restarted xrdp and get a session going, you can use a command like this to look at the throughput in Mb/s :-

sudo iftop -f "port 3389"

That'll give you a clear idea of exactly what capacity is available on the link, and what xrdp is demanding from it.

@ehaughee
Copy link

ehaughee commented Mar 11, 2021

@matt335672 thanks for the cool measuring tips!

Below are my measurements.

Ping from Windows --> Ubuntu

>ping 192.168.1.12 -n 20

Pinging 192.168.1.12 with 32 bytes of data:
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64
Reply from 192.168.1.12: bytes=32 time<1ms TTL=64

Ping statistics for 192.168.1.12:
    Packets: Sent = 20, Received = 20, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 0ms, Average = 0ms

iperf output

❯ iperf3 -c 192.168.1.12 -p 3389 -R
Connecting to host 192.168.1.12, port 3389
Reverse mode, remote host 192.168.1.12 is sending
[  5] local 172.20.105.65 port 43828 connected to 192.168.1.12 port 3389
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec   112 MBytes   938 Mbits/sec
[  5]   1.00-2.00   sec   107 MBytes   900 Mbits/sec
[  5]   2.00-3.00   sec   112 MBytes   941 Mbits/sec
[  5]   3.00-4.00   sec   112 MBytes   939 Mbits/sec
[  5]   4.00-5.00   sec   110 MBytes   919 Mbits/sec
[  5]   5.00-6.00   sec   112 MBytes   939 Mbits/sec
[  5]   6.00-7.00   sec   110 MBytes   921 Mbits/sec
[  5]   7.00-8.00   sec   112 MBytes   940 Mbits/sec
[  5]   8.00-9.00   sec   112 MBytes   940 Mbits/sec
[  5]   9.00-10.00  sec   107 MBytes   901 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-10.00  sec  1.08 GBytes   930 Mbits/sec   88             sender
[  5]   0.00-10.00  sec  1.08 GBytes   928 Mbits/sec                  receiver

iperf Done.

iftop
I opened Firefox and dragged the window around a bunch. I saw the same stutter-step rendering/low sampling as before. This included slow animation speeds (like when clicking log out, the logout screen fades in slowly in increments). Nothing is crazy slow just very noticeable and annoying to use.

   # Host name (port/service if enabled)            last 2s   last 10s   last 40s cumulative
--------------------------------------------------------------------------------------------
   1 remote-host                              =>     55.9Mb     95.6Mb     88.0Mb      330MB
     windows-host                             <=      661Kb     1.14Mb     1.04Mb     3.92MB
--------------------------------------------------------------------------------------------
Total send rate:                                     55.9Mb     95.6Mb     88.0Mb
Total receive rate:                                   661Kb     1.14Mb     1.04Mb
Total send and receive rate:                         56.6Mb     96.8Mb     89.0Mb
--------------------------------------------------------------------------------------------
Peak rate (sent/received/total):                      168Mb     1.88Mb      170Mb
Cumulative (sent/received/total):                     330MB     3.92MB      334MB
============================================================================================

I grabbed the highest peak number output I saw while doing the above actions.

And this is iftop at rest. I just logged into the remote host and let it sit there. After about 20 seconds, I grabbed the below output.

   # Host name (port/service if enabled)            last 2s   last 10s   last 40s cumulative
--------------------------------------------------------------------------------------------
   1 remote-host                              =>     49.1Kb     40.7Kb     2.12Mb     9.01MB
     windows-host                             <=       960b       768b     26.4Kb      112KB
--------------------------------------------------------------------------------------------
Total send rate:                                     49.1Kb     40.7Kb     2.12Mb
Total receive rate:                                    960b       768b     26.4Kb
Total send and receive rate:                         50.1Kb     41.5Kb     2.15Mb
--------------------------------------------------------------------------------------------
Peak rate (sent/received/total):                     33.7Mb      404Kb     34.1Mb
Cumulative (sent/received/total):                    9.01MB      112KB     9.12MB
============================================================================================

@matt335672
Copy link
Member

Thanks for the comprehensive reply!

There doesn't seem to be anything wrong with your network, so that's a good start.

If I'm reading your numbers right (and I'm not entirely sure about that), you're using around 10% of the link bandwidth for the session. Depending on the round-trips needed for communication, this could be suffering from latency. I can't see anything else here which would account for it.

What backend are you using? Xorg or Xvnc?

Xorg can be a bit tricky to set up. If you're using it. see #1026 (comment) and try the settings there.

@ehaughee
Copy link

ehaughee commented Mar 11, 2021

I am using Xorg. I tried setting the connection speed to LAN and I already had the color depth set to 32 bit. I still see the same lag. Here is a video showing the input, rendering, and animation lag with LAN+32bit: https://www.dropbox.com/s/zzyqi4l13espvyn/input-lag.mp4?dl=0

I checked that the video (and the uploaded version played in the browser) accurately depicts the input lag I'm seeing (window lags behind the cursor) and the animation lag (clicking log out). The slowness is not an artifact of video compression. I have tested with direct access to the "remote" machine (monitor, keyboard, and mouse plugged in to the physical box) and do not see the same latencies.

I have also tried changing the compositor settings in KDE Plasma based on some suggestions I saw elsewhere but saw no noticeable improvement. However, I also saw the same lag with Gnome 3. Below are my current (non-default) compositor settings:
image

@matt335672
Copy link
Member

Hi @ehaughee

Maybe the video's not doing your user experience justice, but that doesn't look entirely unexpected.

The cursor is drawn locally, the mouse move is sent to the remote end and the remote end updates the screen and sends it back. That looks like a fairly high res screen you've got there to me (is it 2160p?), with a fairly nuanced backdrop. You're going to be sending a lot of data for each redraw, and that will explain the delay.

You could try using a single colour backdrop for the remote session. Areas of a single colour pretty much compress to nothing, and that will reduce bandwidth and hence round-trip-times.

Other than that, I can't think of anything else which would improve on that experience I'm afraid.

@ehaughee
Copy link

The monitor is 1080p. If this is the best performance I can get from a local connection, that's fine, just wanted to make sure there wasn't something else I could do.

For anyone else following along, I ended up turning off the KDE Plasma compositor (System Settings/Display and Monitor/Compositor) which helped a little but obviously disabled things like animations and transparency for the theme I was using. This is fine for my use-case but may not be for others.

Thanks, @matt335672, for your help!

@marcsosduma
Copy link

After doing a lot of research, I got good performance with these settings:

xfce4
xorgxrdp-glamor
In /etc/xrdp/sesman.ini and /etc/xrdp/xrdp.ini:

Policy=UBDI
max_bpp=16
xserverbpp=16
use_compression = yes
crypt_level=none
KillDisconnected=true
DisconnectedTimeLimit=0
tcp_send_buffer_bytes=4194304
Tweak for TCP (2x request buffer size):

sudo sysctl -w net.core.wmem_max=8388608
see #1483

Disable compositor:

xfconf-query -c xfwm4 -p /general/use_compositing -t bool -s false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question or troubleshoot question or trouble shoot, not confirmed as xrdp bug or issue yet
Projects
None yet
Development

No branches or pull requests

5 participants