Cockcroft Headroom Plot - Part 2 - R Version
July, 2008
by Adrian Cockcroft
|
About the Author
|
Adrian Cockcroft
Adrian is best known as the author of four books including Sun Performance and Tuning (2 editions); Resource Management; and Capacity Planning for Internet Services. In his 16 years at Sun he worked in technical sales and marketing, led creation of the BluePrints best practice publishing program, tested very complex integrated systems, was a leader of Sun's Six Sigma program and was the Chief Architect and Product Boss for Sun's High Performance Technical Computing business unit. In this time he gave many training classes and consulted with a wide range of customers, most notably as the on-site capacity planning consultant for the Salt Lake 2002 and Athens 2004 Olympic Games.
Joining eBay in 2004, he initially worked for Operations Architecture, investigating new platforms and providing guidance to the capacity planning groups at eBay and PayPal. As a founding member of eBay Research Labs in 2005, Adrian helped define the initial strategy for the Labs and an Innovation Forum. He researched operations related platforms and processes, lead research into advanced Skype plugin applications, contributed to development of the Skype4Java API and prototyped advanced wireless/mobile applications. During 2006 he published an IEEE paper on simulating large scale peer to peer networks, and a CMG paper on utilization measurement problems.
Adrian has consulted on architecture, scalability and performance for the Bebo.com social network, and is an advisory board member for Infovell and Holocosmos.
In 2007 Adrian joined Netflix as a Director of Web Engineering, directing a team responsible for research and development of scalable personalized web architectures.
Adrian filed two patents on capacity planning techniques while at Sun, and four patents related to peer to peer marketplaces while at eBay.
Adrian has a blog at http://perfcap.blogspot.com where he discusses capacity planning techniques, new computer technology, and how markets and innovation interact. He is also a member of the Homebrew Mobile Phone Club, and several local classic car clubs.
|
Tweaking the code resulted in a prettier version that also has a small time series view of the throughput in the top right corner.

The code for this is
chp <- function(x,y,xl="Throughput",yl="Response",tl="Throughput Time Series", ml="Cockcroft Headroom Plot") {
xhist <- hist(x,plot=FALSE)
yhist <- hist(y, plot=FALSE)
xrange <- c(0,max(x))
yrange <- c(0,max(y))
nf <- layout(matrix(c(2,4,1,3),2,2,byrow=TRUE), c(3,1), c(1,3), TRUE)
layout.show(nf)
par(mar=c(5,4,0,0))
plot(x, y, xlim=xrange, ylim=yrange, xlab=xl, ylab=yl)
par(mar=c(0,4,3,0))
barplot(xhist$counts, axes=FALSE, ylim=c(0, max(xhist$counts)), space=0, main=ml)
par(mar=c(5,0,0,1))
barplot(yhist$counts, axes=FALSE, xlim=c(0,max(yhist$counts)), space=0, horiz=TRUE)
par(mar=c(2.5,1.5,3,1))
plot(x, main=tl, cex.axis=0.8, cex.main=0.8, type="S")
}
Make a wrapper function to step through the data over time in chunks.
> chp.step <- function(x, y, steps=10, secs=1.0) {
xl <- length(x)
step <- xl/steps
for(n in 0:(steps-1)) {
Sys.sleep(secs)
chp(x[(1+n*step):min((n+1)*step,xl)],y[(1+n*step):min((n+1)*step,xl)])
}
}
To run this smoothly on windows, disable double buffering using
> options("windowsBuffered"=FALSE)
and close the graphics window so that a new one opens with the new option.
The data is displayed using the same calls as described in Part 1 (see May issue MeasureIT). The next step is to try some different data sets and work on detecting saturation automatically.
To display the time series of responses, substitute "y" instead of "x" for the last call to plot and it will show response time. The default title should also be changed. It's also easy to code this as a parameter. However there's not any space on the plot to fit both resp and throughput vs. time. It would mean quite a lot of rearrangement. It's very easy to get a plot vs. time using plot(r.s+w.s) or plot(asvc_t+wsvc_t) at the prompt.
The Cockcroft Headroom Plot - Part 3- R Version will appear in the August Issue.