Last active
October 12, 2024 05:01
-
-
Save etherbiswas/85448feb709243a0df7349f9a08d4333 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable IPv4 forwarding (default) | |
net.ipv4.ip_forward = 0 | |
# Disable ICMP echo reply (if you need to reduce ping responses) | |
net.ipv4.icmp_echo_ignore_all = 1 | |
# Enable TCP SYN cookies (security against SYN flood attacks) | |
net.ipv4.tcp_syncookies = 1 | |
# Increase TCP buffer sizes for wireless and high throughput networks | |
net.ipv4.tcp_rmem = 8192 131072 67108864 # Set to 64MB max buffer size for high throughput | |
net.ipv4.tcp_wmem = 8192 131072 67108864 # Increased write buffer size for upload stability | |
# Enable TCP window scaling for higher throughput and bandwidth | |
net.ipv4.tcp_window_scaling = 1 | |
# Increase maximum number of incoming connections for heavy network usage | |
net.core.somaxconn = 4096 | |
# Increase maximum file descriptors for better handling of many files | |
fs.file-max = 2097152 | |
# Optimize scheduling for real-time tasks (audio, video) | |
kernel.sched_rt_runtime_us = 950000 | |
kernel.sched_rt_runtime_us = 2000000 | |
# Increase the maximum number of memory map areas per process | |
vm.max_map_count = 524288 # Increased for applications using a lot of mmap | |
# Lower swappiness to prioritize RAM over swap | |
vm.swappiness = 10 | |
# Adjust VFS cache pressure to avoid premature cache clearing | |
vm.vfs_cache_pressure = 50 | |
# Optimize dirty memory settings for faster disk writes | |
vm.dirty_ratio = 15 # Higher limit for dirty pages in percentage | |
vm.dirty_background_ratio = 5 # Start flushing at a lower percentage | |
# Increase shared memory limits for high-performance apps (e.g., databases) | |
kernel.shmmax = 68719476736 # 64GB shared memory | |
kernel.shmall = 2097152 # Number of shared memory pages | |
# Adjust min_free_kbytes to improve memory handling under heavy load | |
vm.min_free_kbytes = 262144 # Set to 256MB to improve stability on high memory load | |
# Increase TCP connection backlog | |
net.ipv4.tcp_max_syn_backlog = 8192 # Handle more simultaneous connection requests | |
# Disable IPv6 (if not using it, as it may conflict with some networks) | |
net.ipv6.conf.all.disable_ipv6 = 1 | |
# Enable high memory limits for processes | |
kernel.panic = 10 | |
# Optimize VM overcommit handling | |
vm.overcommit_memory = 1 # Allow overcommit with heuristics to avoid OOM killer | |
vm.overcommit_ratio = 50 # Allow 50% of RAM for overcommitted allocations | |
# Decrease TCP timeout values to detect dead connections quicker | |
net.ipv4.tcp_fin_timeout = 15 | |
net.ipv4.tcp_keepalive_time = 600 # Set keepalive to 10 minutes | |
net.ipv4.tcp_keepalive_intvl = 30 # Reduced interval for keepalive probes | |
net.ipv4.tcp_keepalive_probes = 5 # Number of probes before closing a connection | |
# Wireless optimizations for Mediatek MT7922 | |
net.core.netdev_max_backlog = 10000 # Increase network backlog to handle bursts | |
net.core.rmem_max = 67108864 # Increase max receive buffer size (64MB) | |
net.core.wmem_max = 67108864 # Increase max send buffer size (64MB) | |
# Reduce TCP retransmission retries to improve latency and responsiveness | |
net.ipv4.tcp_retries2 = 8 | |
# Disable slow start after idle to maintain maximum throughput on Wi-Fi | |
net.ipv4.tcp_slow_start_after_idle = 0 | |
# Enable BBR (Bottleneck Bandwidth and RTT) congestion control for better performance on wireless | |
net.ipv4.tcp_congestion_control = bbr | |
# Set kernel network queue sizes to handle high throughput without packet loss | |
net.core.optmem_max = 25165824 # Increase optional memory for socket buffers (24MB) | |
net.ipv4.tcp_mem = 67108864 134217728 268435456 # Fine-tuned memory lisysctl: cannot stat /proc/sys/net/netfilter/nf_conntrack_max: No such file or directory | |
mits for TCP stack | |
# Disable Power Management for MT7922 to prevent Wi-Fi dropouts (use iwconfig or driver-specific methods) | |
# Adjust depending on your driver. If using `iwconfig`, run this separately after boot. | |
# sudo iwconfig wlan0 power off | |
# Set up IRQ balance for better multi-core CPU performance with networking | |
# Optional: You can add irqbalance service to optimize IRQ distribution across CPU cores | |
# sudo systemctl enable irqbalance | |
# Enable TCP Fast Open (TFO) for faster connection establishment | |
net.ipv4.tcp_fastopen = 3 # Enable TFO for both client and server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment