Skip to content

Conversation

@SoongVilda
Copy link
Contributor

I have been testing these for about a week. I had some inaccurate values, but it seems promising now.

Rustdesk can achieve usable gaming at 80-100 FPS on a LAN connection. Sunshine + Moonlight also works perfectly, even at a 150 Mbps bitrate with H.265, with no drops or lags.

Results over WAN (Tailscale) are pretty similar when direct P2P is achieved and both sides have a decent network.

I believe my personal tweaks would be useful for CachyOS.

I have been testing these for about a week. I had some inaccurate values, but it seems promising now.

Rustdesk can achieve usable gaming at 80-100 FPS on a LAN connection.
Sunshine + Moonlight also works perfectly, even at a 150 Mbps bitrate with H.265, with no drops or lags.

Results over WAN (Tailscale) are pretty similar when direct P2P is achieved and both sides have a decent network.

I believe my personal tweaks would be useful for CachyOS.
@SoongVilda SoongVilda requested a review from 1Naim November 18, 2025 18:50
@SoongVilda
Copy link
Contributor Author

btw: Option net.core.netdev_max_backlog = 4096 remains same - already pretty good, I just moved to into the section to have everything about network on one place.

@1Naim
Copy link
Member

1Naim commented Nov 18, 2025

Rustdesk can achieve usable gaming at 80-100 FPS on a LAN connection. Sunshine + Moonlight also works perfectly, even at a 150 Mbps bitrate with H.265, with no drops or lags

Do you have any benchmarks against stock settings?

@SoongVilda
Copy link
Contributor Author

Rustdesk can achieve usable gaming at 80-100 FPS on a LAN connection. Sunshine + Moonlight also works perfectly, even at a 150 Mbps bitrate with H.265, with no drops or lags

Do you have any benchmarks against stock settings?

Could you consider a benchmark as the state when RustDesk dropped frames, was slower, and provided an overall crappy experience? Similar to Moonlight, it was great below 80 Mbps, but higher values had micro-lags. With these settings, I can use 150 Mbps, and the latency is stable, and the stream is smooth and stable.

If I weren't seeking performance improvements for Tailscale, RustDesk, and even Syncthing, then this pull request wouldn't be created.

@SoongVilda
Copy link
Contributor Author

1. UDP Latency Assurance (Audio/Input Stability)

  • Change: Set net.ipv4.udp_rmem_min and net.ipv4.udp_wmem_min to 32768 (32KB).
  • Reason: The default values (usually 4KB) are too small for high-bitrate real-time streams. This prevents "robotic" audio glitches in Moonlight and input packet drops in RustDesk when the CPU is momentarily spike-loaded.

2. Connection Queue Expansion (P2P Stability)

  • Change: Increased net.core.somaxconn and net.ipv4.tcp_max_syn_backlog to 8192.
  • Reason: Prevents "Connection Refused" errors during "startup storms" where P2P applications (like Syncthing) attempt to handshake with dozens of peers simultaneously.

3. Socket Resource Recycling (Port Exhaustion)

  • Change: Enabled net.ipv4.tcp_tw_reuse = 1 and reduced net.ipv4.tcp_fin_timeout to 30s.
  • Reason: Allows the kernel to reclaim "zombie" connections faster. This is critical for preventing ephemeral port exhaustion during heavy P2P syncing or high-traffic Tailscale relaying.

@VolRencs
Copy link

Sounds interesting, but to understand how it really is you need tests in different situations. I believe that there is no way without benchmarks. Also because of these changes there may be small problems for people who have less than 4GB of RAM, correct me if I'm wrong.

@damachine
Copy link

Interesting changes. I know from experience that network benchmarks can be very time-consuming, as many external factors come into play. Nevertheless, out of interest, I will conduct a before-and-after comparison of network performance.

@SoongVilda
Copy link
Contributor Author

Here is a results of ma changes, which are ready to merge for now. I made two videos on my YT.

At both scenarios I was able basically smooth remote gaming experience, which I've never seen with Rustdesk, it's even not design for this use case... xD

I can also shows combo Sunshine + Moonlight, where I can run 150 Mbps at LAN, sadly I can't test 150 Mbps over 5G CGNAT with Tailscale since I'm limited by local 5G tower, which reaching only to 70 - 100 Mbps.

@SoongVilda
Copy link
Contributor Author

Sounds interesting, but to understand how it really is you need tests in different situations. I believe that there is no way without benchmarks. Also because of these changes there may be small problems for people who have less than 4GB of RAM, correct me if I'm wrong.

Yeah, I know... I have my personal values a little bit different ... my machine is a little bit different thing than gaming rigs: My machine so I tried keep it still RAM friendly.

As we have https://wiki.cachyos.org/installation/installation_prepare/#system-requirements at recommended 8GB... well, I think people with 3 GB RAM should be happy system even works.

Sadly, even my older laptop have 32 GB RAM, It would be nice, if anyone could test it under 8 GB RAM device.

Changed from

```bash
net.ipv4.udp_rmem_min = 32768
net.ipv4.udp_wmem_min = 32768
```

to

```bash
net.ipv4.udp_rmem_min = 8192
net.ipv4.udp_wmem_min = 8192
```

Reason: It could kill RAM on low-performance device and from my testing Moonlight + Sunshine or Rustdesk still works fine even with `8192`, so no reason to use higher. Right now it's just 2x time than Arch default, but Arch wiki suggest values `8192`.

https://wiki.archlinux.org/title/Sysctl#Increase_the_memory_dedicated_to_the_network_interfaces
…of net.ipv4.tcp_keepalive_time in Arch Linux

Changed description to align value of net.ipv4.tcp_keepalive_time in Arch Linux: https://gitlab.archlinux.org/archlinux/rfcs/-/merge_requests/51
@SoongVilda SoongVilda self-assigned this Nov 20, 2025
@SoongVilda SoongVilda added the enhancement New feature or request label Nov 20, 2025
@SoongVilda
Copy link
Contributor Author

Closing this one since it's too much changes, let's merge a smaller one and let's wait how it will work for users.

#187

@SoongVilda SoongVilda closed this Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants