diff --git a/docs/advanced/performance.mdx b/docs/advanced/performance.mdx index 24aa4ff4e..3c7ab4c13 100644 --- a/docs/advanced/performance.mdx +++ b/docs/advanced/performance.mdx @@ -181,90 +181,3 @@ https://matrix.example.com { Consider enabling the newer **HTTP/3** protocol for inbound connections to Continuwuity. In Caddy this is allowed by default, and you'd need to expose port :443/**udp** on your firewall. HTTP/3 support is mostly beneficial for faster Client-Server connections, especially in browser-based applications like Element or Cinny. Continuwuity includes experimental _outbound_ HTTP/3 support in its Docker images, so connections between Continuwuity servers can benefit from this too. - -### Increasing file descriptors - -On many Linux systems, file descriptors are capped to `1024`, which may not be enough for Continuwuity's heavy use of network and disk resources. Consider increasing this number by editing your `limits.conf` file: - -```txt title=/etc/security/limits.conf -* soft nofile 32768 -* hard nofile 65536 -``` - -You may also need to increase your global file descriptor limit, by adding a sysctl parameter like `fs.file-max=1048576` (see [sysctl tuning section](#sysctl-tunings) for more). - -Restart your system and run `ulimit -Sn` and `ulimit -Hn`. Your soft and hard limits should now be updated. - -For Docker, these tweaks correspond to the following `ulimits` parameters: - -```yaml title=docker-compose.yml -services: - homeserver: - # ... - ulimits: - nofile: - soft: 32768 - hard: 65536 -``` - -### Sysctl tunings - -Lastly, consider tuning kernel parameters in your `/etc/sysctl.conf` file (or for systemd distros, `/etc/sysctl.d/99-sysctl.conf`). Refer to external guides such as the [Arch Linux entry on Sysctl][arch-linux-sysctl] and the [sysctl documentation][sysctl-docs] for all possible values. - -
- -Example sysctl.conf - -This example `/etc/sysctl.conf` is used for a singleuser Continuwuity instance, hosted on an 8GB RAM machine with 4 cores. The goal here is to encourage RAM usage and increase adequate buffer for network activities, as the machine runs on a high-latency network environment. - -DO NOT copy-paste this directly, please consult this only as a reference example and only apply gradual changes to your system after you've understood their effects. - -```toml title=/etc/sysctl.conf -# DISK & RAM - -## disables slow SWAP entirely -vm.swappiness = 0 - -## decrease kernel tendency to reclaim directory/inode caches -vm.vfs_cache_pressure = 50 - -## increase max file descriptors allowed -## do this with the `nofile` increases in limits.conf -fs.file-max=1048576 -## increase max kernel threads, can help with performance -kernel.threads-max=100000 - -# NETWORKING - -## increase all network read/write buffers to 8MB -## helps increase network backlogs for busy connections -net.core.rmem_max=8388608 -net.core.wmem_max=8388608 -net.core.rmem_default=8388608 -net.core.wmem_default=8388608 - -## increase TCP-specific memories to match with above -net.ipv4.tcp_rmem=4096 131072 8388608 -net.ipv4.tcp_wmem=4096 131072 8388608 - -# applies TCP window scaling -net.ipv4.tcp_window_scaling=1 -# applies SYN cookie for protection against SYN floods -net.ipv4.tcp_syncookies=1 - -# increase range of ports assigned to outbound requests -# can help when there are plenty of outbound connections -net.ipv4.ip_local_port_range = 10000 65535 - -# enable the modern BBR congestion control algorithm -# with fq qdisc -net.core.default_qdisc = fq -net.ipv4.tcp_congestion_control = bbr -``` - -Once you're happy, run `sysctl -p` to apply the changes. - -
- -[arch-linux-sysctl]: https://wiki.archlinux.org/title/Sysctl -[sysctl-docs]: https://www.kernel.org/doc/html/latest/admin-guide/sysctl/