-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add resource limits for tiler - cache staging Update script to evaluate resource usage Rename file rm_tegola_ps Remove time ffor tiler-cache Update script Evalute cpu usage tiler-cache
- Loading branch information
Showing
6 changed files
with
44 additions
and
39 deletions.
There are no files selected for viewing
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
set -e | ||
PROCESS_NAME="tegola" | ||
SLEEP_INTERVAL=20 | ||
CPU_USAGE_THRESHOLD=70 | ||
|
||
check_total_cpu_usage() { | ||
local total_cpu_usage=0 | ||
for cpu in $(ps -eo comm,pcpu | grep ${PROCESS_NAME} | awk '{print $2}'); do | ||
total_cpu_usage=$(echo "$total_cpu_usage + $cpu" | bc) | ||
done | ||
echo $total_cpu_usage | ||
} | ||
|
||
while true; do | ||
total_cpu_usage=$(check_total_cpu_usage) | ||
total_cpu_usage=${total_cpu_usage%.*} | ||
echo "Total cpu usage: $total_cpu_usage" | ||
if [[ $total_cpu_usage -gt $CPU_USAGE_THRESHOLD ]]; then | ||
echo "Total CPU usage of ${PROCESS_NAME} processes is ${total_cpu_usage}%, which is greater than the threshold of ${CPU_USAGE_THRESHOLD}%." | ||
|
||
echo "Terminating all ${PROCESS_NAME} processes..." | ||
killall -9 ${PROCESS_NAME} | ||
|
||
echo "Manually clearing S3 cache..." | ||
aws s3 rm s3://${TILER_CACHE_BUCKET}/mnt/data/osm/ --recursive | ||
fi | ||
|
||
sleep $SLEEP_INTERVAL | ||
done |
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
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