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

High CPU usage without even starting a xrdp session #2698

Closed
ghost opened this issue May 23, 2023 · 18 comments
Closed

High CPU usage without even starting a xrdp session #2698

ghost opened this issue May 23, 2023 · 18 comments

Comments

@ghost
Copy link

ghost commented May 23, 2023

when starting the system, using htop in ssh, a 80% cpu usage can be seen by
root 650 79.0 0.6 862224 75872 tty1 Rsl+ 12:38 26:41 /usr/lib/xorg/Xorg -nolisten tcp -auth /var/run/sddm/{7a9981cf-4f8a-449f-8b60-44d75944b484} -background none -noreset -displayfd 17 -seat seat0 vt1

xrdp --version
xrdp 0.9.17

kubuntu 22.04

some of my tweaks:

crypt_level=none
max_bpp=16
xserverbpp=16
tcp_send_buffer_bytes=4194304
tcp_recv_buffer_bytes=4194304

delay_ms=250
tls_ciphers=HIGH

#Performance
perf.cursor_shadow=false
perf.cursor_blink=false
perf.themes=false
perf.menu_anims=false
perf.full_window_drag=false
perf.desktop_composition=false
perf.font_smoothing=false
new_cursors=false

sudo vim /etc/xrdp/sesman.ini
AllowRootLogin=false

sysctl -w net.core.wmem_max=8388608

this problem is only happening with kde desktop, also despite the quality tweaks, seems like xrdp is not using any compression? or low levels of compression as a simple behaviour like moving a terminal with htop open is very laggy and already puts my network under 8mbit of pressure, this is not an issue on windows client, i also compared visual things, like watching youtube, youtube is smoother on KDE, although it consumes 3 times the traffic compared to a windows server while the quality is questionably low.

Some other things i tried: compositing is disabled, changed rdp client settings to (LAN) and tried lower resolutions, the high cpu usage is there when no rdp connection has been even activated and stays the same throughout the whole session. this is not a network issue as my network is pretty stable, on xubuntu the performance is slightly worse but the cpu usage is nowhere near kde, but the traffic usage is 3 or 4 times higher than windows rdp, now this isnt quite an issue when you have stable internet sitting somewhere but could be annoying when you are moving around alot. Is there anyway to icrease the compression levels? i tried compression=yes, use_compression=yes, compression=9, now i know these are not in the documentation, but i still found them on the internet and gave them a try.
So here to summarize:

  1. where are these massive CPU usages comming from dispite me not evne being in a rdp session
  2. how to decrease bandwich usage?
  3. this is not a must have but moving windows up and down is pretty nice and stable already, but moving them right and left makes the whole thing quite laggy

id be happy if someone had something here to say, if you need more info about my system, hardware or anything else please let me know.

@matt335672
Copy link
Member

  1. The high CPU at startup is in no way related to xrdp - we can't help you with that. Xorg in this instance will be driving your normal graphical login.
  2. As far as xrdp performance is concerned, the best you can do at the moment is enable RFX. This is mentioned in this comment. We're hoping to get GFX support in at some point, but we're a long way from that.

@ghost
Copy link
Author

ghost commented May 24, 2023

Hello matt335672,

as described, this kind of behaviour accurs as soon as xrdp is installed and the service is enabled and started, ive tried multiple times, this kind of behaviour only happens after activating xrdp, also the server is freshly installed kubuntu without anything else in particular that could cause this, and the cpu usage is quite normal before installing xrdp, also i must say the cpu usage is normal with xfce as well, but kde seems to mess with xrdp, or vice versa.

  1. The high CPU at startup is in no way related to xrdp - we can't help you with that. Xorg in this instance will be driving your normal graphical login.
  2. As far as xrdp performance is concerned, the best you can do at the moment is enable RFX. This is mentioned in this comment. We're hoping to get GFX support in at some point, but we're a long way from that.

@ghost
Copy link
Author

ghost commented May 24, 2023

  1. The high CPU at startup is in no way related to xrdp - we can't help you with that. Xorg in this instance will be driving your normal graphical login.
  2. As far as xrdp performance is concerned, the best you can do at the moment is enable RFX. This is mentioned in this comment. We're hoping to get GFX support in at some point, but we're a long way from that.

to your number 2., im using remote desktop manager on windows, and i have similar performance with rdm and with the option that you offered, i barely see any difference, bandwich isnt a issue i can easily support a high bandwich and it is already happening even in my rdm, as i described, simplest actions already use a lot of traffic, watching a simple 480p youtube video can cause up to 80mbit traffic, understandable of couse, but same action causes 20% of that network on a windows server.

@ghost
Copy link
Author

ghost commented May 24, 2023

i managed to fix the sddm problem, but i have a new update: from what im seeing xrdp is not managing ressources well enough as it is using way too much tra
image
image
ffic again and server has a load avg of 0.05? is there any possible way to increase compression levels? try other methods and so on?
Some actions in particular cause way too much load, simply dragging the mouse on desktop: as shown in the next picture causes the trafic to go up to 80mbit

@matt335672
Copy link
Member

There's nothing I can add apart from my comment above I'm afraid. Try using RemoteFX if your client supports it.

@ghost
Copy link
Author

ghost commented May 25, 2023

hello. i still havent found any data related to enabling rfx from server side, is this even possible or am i looking for somehting that does not exist?
using windows 10 rdp and setting it to lan didnt bring any performance.

@matt335672
Copy link
Member

Sorry - I could have been clearer.

I don't think you've mentioned your xrdp version (see xrdp -v), but it probably doesn't matter. The RFX codec is in all xrdp versions by default since v0.9.2 unless you've built xrdp with --disable-rfxcodec.

The selection of the codec to use then depends entirely on what the client sends over. Importantly, the client connection type must be set to 'LAN' (not automatic), and you must have 24-bit or 32-bit colour selected.

I wish the server-side logging was better than it is. For some reason the codec selection is only logged for development builds. We should probably fix that.

@matt335672
Copy link
Member

Sorry again - I see your xrdp version is listed above.

Try losing those tweaks regarding setting the max_bpp and xserverbpp to 16. They won't be helping at all.

@ghost
Copy link
Author

ghost commented May 26, 2023

thank you, it was mainly because of the max_bpp, works much better now

@matt335672
Copy link
Member

Great.

Any joy with the codec on the client?

@ghost
Copy link
Author

ghost commented May 26, 2023

Great.

Any joy with the codec on the client?

yes, i did actually go through the steps you mentioned on another thread but it didnt work before i changed the bpp back to 24, also another thing: > Sorry again - I see your xrdp version is listed above.

Try losing those tweaks regarding setting the max_bpp and xserverbpp to 16. They won't be helping at all.

also i noticed there was a thread going around about automatic scripts that would be running before or even after the session, i realized you are already working on it? i have this to kill the session: ps u -u "$USER" | awk '/xrdp/ && ! /awk / {system("kill "$2)}'
it would be nice if we could find a way to run this command before the user logs in to the session and automatically kills all other xrdp sessions in their name, i think this must be possible in startwm.sh?

@matt335672
Copy link
Member

I don't fully understand your last comment. Are you saying you want to kill previous sessions, and don't want to reconnect to an existing session?

@ghost
Copy link
Author

ghost commented May 26, 2023

I don't fully understand your last comment. Are you saying you want to kill previous sessions, and don't want to reconnect to an existing session?

well for me it never actually worked to connect to a previous session, all i see is a glance of a white screen and then im disconnected and in order to prevent this i needed that, generally xfce saves the sessions locally? so it still feels like connecting to the same session.

@ghost
Copy link
Author

ghost commented May 26, 2023

I don't fully understand your last comment. Are you saying you want to kill previous sessions, and don't want to reconnect to an existing session?

is there also a way to limit the resolution? as i see xrdp takes automatically what the client selects, thats not a behaviour that id like to have, id like the resolution to be forced to the client, is there a possible way to do that?

@matt335672
Copy link
Member

The reconnect should work fine. It's probably worth getting to the bottom of that.

There's no real support for fixing a session size. You might be able to lash something up by:-

  1. Install tigervnc-standalone-server.
  2. Disabling xorgxrdp and using the Xvnc backend.
  3. Configuring the X server to start with -AcceptDesktopSize=0 -geometry={width}x{height}.

That's off the top of my head - it's a bit of a long shot.

@ghost
Copy link
Author

ghost commented May 26, 2023

The reconnect should work fine. It's probably worth getting to the bottom of that.

There's no real support for fixing a session size. You might be able to lash something up by:-

  1. Install tigervnc-standalone-server.
  2. Disabling xorgxrdp and using the Xvnc backend.
  3. Configuring the X server to start with -AcceptDesktopSize=0 -geometry={width}x{height}.

That's off the top of my head - it's a bit of a long shot.

thanks, just an update, maybe it could be useful: xfce saves sessions locally, so killing sessions does not actually kill the sessions, xrdp behaviour is like this when im logged in somewhere else and i try to log in again: a black screen and nothing else happens, restarting the service does have the same behaviour, as the session is never killed ... i added the line i provided you at the end of startwm.sh, works like magic, in case someone else needs it

@ghost
Copy link
Author

ghost commented May 26, 2023

i also noticed a weird behaviour: if the user manually doesnt log out, but just uses the lock screen, im never ever able to login agian through rdp, my only solution so far was to either reboot or login again manually? first login works, after that if you lock the screen you cant log in again, my solution isnt very clean so id be glad if there would be a way to fix this, or is there a command to actually manually call for the xrdp login screen? so i can just rework the shortcut in the desktop... or should i just remove this option totally? the one that is used on the first xrdp login? because i think what is happening here is that im using lightdm and ofc you cannot see anything when the screen is locked.

@matt335672
Copy link
Member

If you're logged in somewhere and you try to take over the session from somewhere else, that won't work currently. We're aware of it, and it should be a lot easier to fix in devel now. If you log out from the remote session before you leave it, and reconnect later that should be fine.

Your description bothers me somewhat. startwm.sh is only run when a new session is started. If you're trying to reconnect, you shouldn't be using that code path at all. Have you changed the session allocation policy in sesman.ini?

I can't help you with your screen locking I'm afraid. Do you need a screensaver configured at all for xrdp sessions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant