SHARE
TWEET

Untitled

a guest Feb 16th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. echo "Tunning system ......"
  3. #
  4. # Ubuntu configuration file for a server dedicated
  5. # to a NATS server process (gnatsd or nats-streaming-server)
  6. #
  7. # An experimental WIP
  8. #
  9. sysctl -w fs.file-max=13189848
  10.  
  11. # Not all systems have netfilter installed.
  12. #sudo sysctl -w net.netfilter.nf_conntrack_tcp_timeout_time_wait=5
  13. #sudo sysctl -w net.netfilter.nf_conntrack_max=196608
  14.  
  15. # we need all the ports we can get.
  16. sysctl -w net.ipv4.ip_local_port_range="1025 65535"
  17.  
  18. # Keep the default sizes lower to scale # of connections.
  19. # For throughput on a smaller # of connections, increase it
  20. sysctl -w net.ipv4.tcp_rmem="4096 4096 16777216"
  21. sysctl -w net.ipv4.tcp_wmem="4096 4096 16777216"
  22. sysctl -w net.ipv4.tcp_max_syn_backlog=32768
  23.  
  24. # Increase backlogs for processing.  Usually gnatsd
  25. # won't fall behind (unless swapping out), but be
  26. # safe.
  27. sysctl -w net.core.somaxconn=32768
  28. sysctl -w net.core.netdev_max_backlog=32678
  29. sysctl -w net.core.rmem_max=16777216
  30. sysctl -w net.core.wmem_max=16777216
  31.  
  32. # VM is bad for us, reduce swapping (TODO: Go down to 0?)
  33. sysctl -w vm.swappiness=1
  34. sysctl -w vm.dirty_background_ratio=10
  35. sysctl -w vm.dirty_ratio=15
  36.  
  37. # increase max fds, more important for streaming, but just be greedy.
  38. # if we had other processes here, be a bit more conservative.
  39. u=`id -u -n`
  40. echo "$u hard nofile 1024000" > max_fds.conf
  41. echo "$u soft nofile 1024000" >> max_fds.conf
  42. mv max_fds.conf /etc/security/limits.d
  43.  
  44. # echo $1       monitorhost  >> /etc/hosts
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top