Last active
July 16, 2020 17:02
-
-
Save dosaboy/b54a065bd0117fdf5bd060accb34e048 to your computer and use it in GitHub Desktop.
This file contains 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
#!bin/bash -u | |
# upgrade swift packages | |
sudo apt update | |
sudo apt install swift --only-upgrade | |
# increase this from default of 100 to allow kernel to release xfs cache data more readily | |
sudo sysctl -w vm.vfs_cache_pressure=200 | |
# make a note of the following | |
free -lh | |
egrep "Slab|Reclaim" /proc/meminfo | |
manage () | |
{ | |
action=$1 | |
filter=${2:-""} | |
declare -a svcs=( | |
swift-account-auditor | |
swift-account-reaper | |
swift-account-replicator | |
swift-account | |
swift-container-auditor | |
swift-container-replicator | |
swift-container-sync | |
swift-container-updater | |
swift-container | |
swift-object-auditor | |
swift-object-replicator | |
swift-object-updater | |
swift-object | |
) | |
set -x | |
for svc in ${svcs[@]}; do | |
[ -z "$filter" ] || `echo $svc| grep -q $filter` || continue | |
sudo service $svc $action | |
done | |
set +x | |
# show what's running | |
[ -z "$filter" ] && \ | |
pgrep -alf /swift| awk '{print $3}'| sort| uniq || \ | |
pgrep -alf /swift| awk '{print $3}'| sort| uniq| grep $filter | |
} | |
# Stop the services | |
manage stop | |
# It might be necessary to manually kill -9 a remaining swift-object-replicator process | |
# repeat the following at least once (or until SReclaimable in /proc/meminfo is at an acceptable level) | |
sync | |
echo 2| sudo tee /proc/sys/vm/drop_caches | |
echo 1| sudo tee /proc/sys/vm/compact_memory | |
# make a note of the following | |
free -lh | |
egrep "Slab|Reclaim" /proc/meminfo | |
# Start services | |
manage start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment