Factor tune_system() out of multinode-demo/ (#4138)

* Remove x bit from ulimit-n.sh

* Factor tune_system() out of multinode-demo/
This commit is contained in:
Michael Vines
2019-05-03 10:40:02 -07:00
committed by GitHub
parent 5b2a82a951
commit c8ed41167a
6 changed files with 52 additions and 44 deletions

View File

@ -25,8 +25,7 @@ fi
build() { build() {
$genPipeline && return $genPipeline && return
source ci/rust-version.sh stable source ci/rust-version.sh stable
source scripts/ulimit-n.sh
_ scripts/ulimit-n.sh
_ cargo +$rust_stable build --all _ cargo +$rust_stable build --all
} }

View File

@ -31,7 +31,11 @@ else
program="$solana_fullnode" program="$solana_fullnode"
fi fi
tune_system if [[ -z $CI ]]; then # Skip in CI
# shellcheck source=scripts/tune-system.sh
source "$SOLANA_ROOT"/scripts/tune-system.sh
fi
$solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger verify $solana_ledger_tool --ledger "$SOLANA_CONFIG_DIR"/bootstrap-leader-ledger verify

View File

@ -67,45 +67,6 @@ export RUST_BACKTRACE=1
# shellcheck source=scripts/configure-metrics.sh # shellcheck source=scripts/configure-metrics.sh
source "$SOLANA_ROOT"/scripts/configure-metrics.sh source "$SOLANA_ROOT"/scripts/configure-metrics.sh
tune_system() {
# Skip in CI
[[ -z $CI ]] || return 0
# shellcheck source=scripts/ulimit-n.sh
source "$SOLANA_ROOT"/scripts/ulimit-n.sh
# Reference: https://medium.com/@CameronSparr/increase-os-udp-buffers-to-improve-performance-51d167bb1360
if [[ $(uname) = Linux ]]; then
(
set -x +e
# test the existence of the sysctls before trying to set them
# go ahead and return true and don't exit if these calls fail
sysctl net.core.rmem_max 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.rmem_max=161061273 1>/dev/null 2>/dev/null
sysctl net.core.rmem_default 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.rmem_default=161061273 1>/dev/null 2>/dev/null
sysctl net.core.wmem_max 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.wmem_max=161061273 1>/dev/null 2>/dev/null
sysctl net.core.wmem_default 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.wmem_default=161061273 1>/dev/null 2>/dev/null
) || true
fi
if [[ $(uname) = Darwin ]]; then
(
if [[ $(sysctl net.inet.udp.maxdgram | cut -d\ -f2) != 65535 ]]; then
echo "Adjusting maxdgram to allow for large UDP packets, see BLOB_SIZE in src/packet.rs:"
set -x
sudo sysctl net.inet.udp.maxdgram=65535
fi
)
fi
}
fullnode_usage() { fullnode_usage() {
if [[ -n $1 ]]; then if [[ -n $1 ]]; then
echo "$*" echo "$*"

View File

@ -62,7 +62,11 @@ accounts: $accounts_config_dir
====================================================================== ======================================================================
EOF EOF
tune_system if [[ -z $CI ]]; then # Skip in CI
# shellcheck source=scripts/tune-system.sh
source "$SOLANA_ROOT"/scripts/tune-system.sh
fi
rsync_url() { # adds the 'rsync://` prefix to URLs that need it rsync_url() { # adds the 'rsync://` prefix to URLs that need it
declare url="$1" declare url="$1"

40
scripts/tune-system.sh Normal file
View File

@ -0,0 +1,40 @@
# |source| this file
#
# Adjusts system settings for optimal fullnode performance
#
# shellcheck source=scripts/ulimit-n.sh
source "$(dirname "${BASH_SOURCE[0]}")"/ulimit-n.sh
# Reference: https://medium.com/@CameronSparr/increase-os-udp-buffers-to-improve-performance-51d167bb1360
if [[ $(uname) = Linux ]]; then
(
set -x +e
# test the existence of the sysctls before trying to set them
# go ahead and return true and don't exit if these calls fail
sysctl net.core.rmem_max 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.rmem_max=161061273 1>/dev/null 2>/dev/null
sysctl net.core.rmem_default 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.rmem_default=161061273 1>/dev/null 2>/dev/null
sysctl net.core.wmem_max 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.wmem_max=161061273 1>/dev/null 2>/dev/null
sysctl net.core.wmem_default 2>/dev/null 1>/dev/null &&
sudo sysctl -w net.core.wmem_default=161061273 1>/dev/null 2>/dev/null
) || true
fi
if [[ $(uname) = Darwin ]]; then
(
if [[ $(sysctl net.inet.udp.maxdgram | cut -d\ -f2) != 65535 ]]; then
echo "Adjusting maxdgram to allow for large UDP packets, see BLOB_SIZE in src/packet.rs:"
set -x
sudo sysctl net.inet.udp.maxdgram=65535
fi
)
fi

2
scripts/ulimit-n.sh Executable file → Normal file
View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash # |source| this file
# #
# Adjust the maximum number of files that may be opened to as large as possible. # Adjust the maximum number of files that may be opened to as large as possible.
# #