-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make boot latency show up in instance Name tag, in CloudWatch and on …
…Monitoring tab
- Loading branch information
Showing
7 changed files
with
145 additions
and
36 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
#!/bin/bash | ||
# | ||
# Prints usage statistics and also, if work directory is not on tmpfs, keeps it | ||
# in cache to lower the chances of the directory entries to be evicted. | ||
# Prints usage statistics and also, if the target directory is not on tmpfs, | ||
# keeps it in cache to lower the chances of the directory entries to be evicted. | ||
# | ||
# Does it only when TZ is set. This prevents it from printing in debug dev | ||
# environment of the client for instance. | ||
# | ||
set -u -e | ||
|
||
prewarm_loop() { | ||
dir=$1 | ||
sleep 30 | ||
while :; do | ||
time_took=/tmp/time_took | ||
export TIMEFORMAT="%R sec" | ||
info=$({ time df -h --output=fstype,target,used "$WORK_DIR" | tail -n1 | sed -E 's/[[:space:]]+/ /g'; } 2>$time_took) | ||
info=$({ time df -h --output=fstype,target,used "$dir" | tail -n1 | sed -E 's/[[:space:]]+/ /g'; } 2>$time_took) | ||
if [[ "$info" != *tmpfs* ]]; then | ||
info=$({ time du -sh "$WORK_DIR" | sed -E 's/\s+/ /g'; } 2>$time_took) | ||
info=$({ time du -sh "$dir" | sed -E 's/\s+/ /g'; } 2>$time_took) | ||
fi | ||
uptime=$(uptime | sed -E -e 's/^\s*[0-9:]+\s+//' -e 's/\s+/ /g') | ||
echo "$(nice_date): Prewarm (took $(cat $time_took)): $info: $uptime" | ||
sleep 60 | ||
done | ||
} | ||
|
||
# Print "prewarm" stats only when TZ is set. This prevents it from printing in | ||
# debug dev environment of the client for instance. | ||
if [[ "$TZ" != "" ]]; then | ||
prewarm_loop & | ||
prewarm_loop "$WORK_DIR" & | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
#!/bin/bash | ||
# | ||
# Prints usage statistics and also, if the storage directory is not on tmpfs, | ||
# Prints usage statistics and also, if the target directory is not on tmpfs, | ||
# keeps it in cache to lower the chances of the directory entries to be evicted. | ||
# | ||
# Does it only when TZ is set. This prevents it from printing in debug dev | ||
# environment of the client for instance. | ||
# | ||
set -u -e | ||
|
||
prewarm_loop() { | ||
dir=$1 | ||
sleep 30 | ||
while :; do | ||
time_took=/tmp/time_took | ||
export TIMEFORMAT="%R sec" | ||
info=$({ time df -h --output=fstype,target,used "$STORAGE_DIR" | tail -n1 | sed -E 's/[[:space:]]+/ /g'; } 2>$time_took) | ||
info=$({ time df -h --output=fstype,target,used "$dir" | tail -n1 | sed -E 's/[[:space:]]+/ /g'; } 2>$time_took) | ||
if [[ "$info" != *tmpfs* ]]; then | ||
info=$({ time du -sh "$STORAGE_DIR" | sed -E 's/\s+/ /g'; } 2>$time_took) | ||
info=$({ time du -sh "$dir" | sed -E 's/\s+/ /g'; } 2>$time_took) | ||
fi | ||
uptime=$(uptime | sed -E -e 's/^\s*[0-9:]+\s+//' -e 's/\s+/ /g') | ||
echo "$(nice_date): Prewarm (took $(cat $time_took)): $info: $uptime" | ||
sleep 60 | ||
done | ||
} | ||
|
||
# Print "prewarm" stats only when TZ is set. This prevents it from printing in | ||
# debug dev environment of the client for instance. | ||
if [[ "$TZ" != "" ]]; then | ||
prewarm_loop & | ||
prewarm_loop "$STORAGE_DIR" & | ||
fi |
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