sysctl openwrt latency
  1. cat << 'EOF' > /etc/sysctl.d/99-latency.conf
  2. # --- Queueing & TCP Congestion ---
  3. # Pair CAKE/FQ with BBR for minimal bufferbloat and fast recovery
  4. net.core.default_qdisc = cake
  5. net.ipv4.tcp_congestion_control = bbr
  6.  
  7. # --- Reduce Bufferbloat & Latency Spikes ---
  8. # Shrink max backlog queues to drop/process stale packets faster
  9. net.core.netdev_max_backlog = 1000
  10. net.ipv4.tcp_max_syn_backlog = 1024
  11. net.ipv4.tcp_max_tw_buckets = 10000
  12.  
  13. # --- Fast Packet Processing & TCP Timers ---
  14. # Enable Fast Open to eliminate SYN-ACK round trips
  15. net.ipv4.tcp_fastopen = 3
  16. # Disable slow start after idle so connection bursts don't ramp up latency
  17. net.ipv4.tcp_slow_start_after_idle = 0
  18. # Enable selective ACKs and explicit congestion notification
  19. net.ipv4.tcp_sack = 1
  20. net.ipv4.tcp_dsack = 1
  21. net.ipv4.tcp_ecn = 1
  22. # Reduce orphan retries for faster socket cleanup
  23. net.ipv4.tcp_orphan_retries = 1
  24.  
  25. # --- Memory & Socket Buffers (Optimized for Small Packets / Low Delay) ---
  26. # Keep socket buffers modest to prevent deep queuing at the socket layer
  27. net.core.rmem_default = 262144
  28. net.core.wmem_default = 262144
  29. net.core.rmem_max = 4194304
  30. net.core.wmem_max = 4194304
  31. net.ipv4.tcp_rmem = 4096 87380 4194304
  32. net.ipv4.tcp_wmem = 4096 65536 4194304
  33.  
  34. # --- Neighbor / ARP Table Latency Fixes ---
  35. # Keep ARP entries warm and prevent stale neighbor lookup delays
  36. net.ipv4.neigh.default.gc_stale_time = 120
  37. net.ipv4.neigh.default.base_reachable_time_ms = 30000
  38. EOF
Pasted 2026-09-08 11:35:44

Short link: