Let’s assume you have a complex performance issue on a couple of linux servers. Usually you may try using iostat to try to catch the issue when it’s happening and see which performance item is creating the bottleneck.
To catch the performance issue I’ll recommend to use iostat to send the info to a file and then process it. You can try something like this:
rightnow=$(date +%Y%m%d%H%M%S)
thishost=$(hostname)
sudo iostat -c -d -x -t -m 1 1200 > iostat.out.$thishost.$rightnow
egrep "^[sd].*" iostat.out.$thishost.$rightnow > iostat.out.$thishost.$rightnow.csv
head iostat.out.$thishost.$rightnow | grep "D" >head.csv
{ cat head.csv ; cat iostat.out.$thishost.$rightnow.csv ; } > iostat.out.$thishost.$rightnow.txt
sed 's/ \{1,\}/;/g' iostat.out.$thishost.$rightnow.txt >iostat.out.$thishost.$rightnow.csv
Now you have a file that can be opened using R.
I’ll give you a couple of examples that can be quite useful for analysis. This will assume you have two files: each one from a different host.
´´´ R
xx <- read.table(“/temp/wegalihs01.csv”, header=TRUE, sep=”;”, quote=”\”“, na.strings = “NA”, as.is = TRUE)
yy <- read.table(“/temp/wegalihs02.csv”, header=TRUE, sep=”;”, quote=”\”“, na.strings = “NA”, as.is = TRUE)
await1 <- xxawait < 1000 & xx$Device. == “dm-8”]
await1 <- await1[rep(1:length(await1))]
plot(as.vector(time(await1)), as.vector(await1), type = “l”)
await2 <- yyawait < 1000 & yy$Device. == “dm-8”]
await2 <- await2[rep(1:length(await2))]
plot(as.vector(time(await2)), as.vector(await2), type = “l”)
times1 <- ts(await1,freq=60*1)
times2 <- ts(await2,freq=60*1)
plot(stl(times, “periodic”))
par(mfrow=c(1,1))
plot(stl(times1, “periodic”)$”time.series”[,”trend”], col=”red”)
par(new=TRUE)
plot(stl(times2, “periodic”)$”time.series”[,”trend”], col=”blue”)
Check Reads & Writes
await1 <- xxDevice. == “dm-8”]
await1 <- await1[rep(1:length(await1))]
plot(as.vector(time(await1)), as.vector(await1), type = “l”)
await2 <- xxDevice. == “dm-8”]
await2 <- await2[rep(1:length(await2))]
plot(as.vector(time(await2)), as.vector(await2), type = “l”)
times1 <- ts(await1,freq=60*1)
times2 <- ts(await2,freq=60*1)
plot(stl(times, “periodic”))
par(mfrow=c(2,2))
plot(stl(times1, “periodic”)”time.series”[,”trend”], col=”blue”)
´´´
No comments:
Post a Comment