PDQ-R: {\em Pretty Damn Quick} for R Statistical Computing
PDQ-R: Pretty Damn Quick for R Statistical Computing
This page was last updated on Sep 4, 2015
Contents
1 What Is It?
2 Where Is It?
3 PDQ-R Training
4 PDQ-R Example
5 Feedback
1 What Is It?
PDQ (Pretty Damn Quick) is an open source software package that supports the constuction of
queueing models
for calculating performance metrics associated with computer systems, data networks,
manufacturing systems, fab lines, supply-chain management, etc. It is not a simulator and
therefore is guaranteed to calculate the correct steady-state statistical means.
It can, of course, be used
in combination with a simulator. The example below shows how PDQ was used to find errors in a
communications-network simulation.
R is an open-source system for statistical computation and graphical display of data. It
consists of a language called R (based on the original language called S)
together with a run-time environment
that supports graphics, a debugger, access to certain system functions, and
the ability to run programs stored in script files. For more information about R,
read this FAQ.
The integration of PDQ
with R is very significant because R does not have a
qeueing network solver, but now with PDQ-R you can:
- import data using standard R commands
- manipulate those data statistically
- extract PDQ input parameters, e.g., arrival rates, service times
- set up a PDQ model within your R script
- solve your PDQ model and display results using the R plotting capability
- compare those PDQ-R outputs with other imported R data
- rinse and repeat
This combination R and PDQ is particularly powerful for doing computer performance
analysis and capacity planning.
2 Where Is It?
PDQ-R is not yet available from the
CRAN repository,
so you will need to:
- Download it separately from the Performance Dynamics
web page.
- Install it using the sudo make command for the top-level make file in the PDQ download.
This means you will need to have root privileges.
3 PDQ-R Training
A training class,
which includes instructions on how to apply R computer performance
analysis and capacity planning, is held every August in California.
Examples of how to apply PDQ to performance
analysis and capacity planning are provied in the books:
4 PDQ-R Example
The following PDQ-R example is the same as the
communications network example shown in PyDQ (Python PDQ) and is based on
the following queueing network diagram.
This Jackson queueing network is a good example because it demonstrates the intrinsic
ability of R to solve a set of simultaneous linear traffic equations within the
same script that contains the PDQ model. The queueing nodes Comp1, Comp2,
Comp3 have been relabeled Router1, Router2, Router3 in the PDQ-R code and
the Greek λ symbol for network traffic is denoted simply by L.
# Jackson network example
# Created by NJG on Saturday, March 7, 2009
# Updated by NJG on Friday, September 4, 2015
library(pdq)
# Arrival rate into the network:
arate <- 0.50
# Node service times:
stime <- c(1.0,2.0,1.0)
# Set up traffic eqns from network diagram:
# L1 = 0.5 + 0.2 L3
# L2 = 0.5 L1
# L3 = 0.5 L1 + 0.8 L2
# Rearrange the terms into matrix form:
# 1.0 L1 + 0.0 L2 - 0.2 L3 = 0.5
# -0.5 L1 + 1.0 L2 + 0.0 L3 = 0.0
# -0.5 L1 - 0.8 L2 + 1.0 L3 = 0.0
# All diagonal coeffs should be 1.0
# Map the coeffs into R matrices:
A <- matrix(c(1.0,0.0,-0.2, -0.5,1.0,0.0, -0.5,-0.8,1.0), 3, 3, byrow=TRUE)
B <- c(0.5,0.0,0.0)
# Solve for the local throughputs (L):
L <- solve(A,B)
# Use L matrix to calculate visit ratios at each router
v <- c(L[1]/arate, L[2]/arate, L[3]/arate)
# Service demands at each node:
sd <- c(v[1]*stime[1], v[2]*stime[2], v[3]*stime[3])
#
# Set up PDQ-R model of the Jackson network
#------------------------------------------
pdq::Init("Jackson Network in PDQ-R")
wname <- "Traffic"
rname <- c("Router1", "Router2", "Router3")
# Create the traffic arriving into the network
pdq::CreateOpen(wname, arate)
pdq::SetWUnit("Msg")
pdq::SetTUnit("Sec")
# Create network routers
for(i in 1:length(rname)) {
pdq::CreateNode(rname[i], CEN, FCFS)
pdq::SetDemand(rname[i], wname, sd[i])
}
pdq::Solve(CANON)
pdq::Report()
print("Check traffic eqns:")
cat(sprintf("L1: %f == %f: 0.5 + 0.2 L3\n", L[1], (0.5 + 0.2*L[3]), L[3]))
cat(sprintf("L2: %f == %f: 0.5 L1\n", L[2], (0.5*L[1])))
cat(sprintf("L3: %f == %f: 0.5 L1 + 0.8 L2\n", L[3], (0.5*L[1] + 0.8*L[2])))
Running this R script, produces the following PDQ report.
PRETTY DAMN QUICK REPORT
==========================================
*** on Fri Sep 4 06:12:57 2015 ***
*** for Jackson Network in PDQ-R ***
*** PDQ Version 6.2.0 Build 082015 ***
==========================================
==========================================
******** PDQ Model INPUTS ********
==========================================
WORKLOAD Parameters:
Node Sched Resource Workload Class Demand
---- ----- -------- -------- ----- ------
1 FCFS Router1 Traffic Open 1.2195
1 FCFS Router2 Traffic Open 1.2195
1 FCFS Router3 Traffic Open 1.0976
Queueing Circuit Totals
Streams: 1
Nodes: 3
Traffic 0.5000 3.5366
==========================================
******** PDQ Model OUTPUTS ********
==========================================
Solution Method: CANON
******** SYSTEM Performance ********
Metric Value Unit
------ ----- ----
Workload: "Traffic"
Number in system 4.3412 Msg
Mean throughput 0.5000 Msg/Sec
Response time 8.6824 Sec
Stretch factor 2.4550
Bounds Analysis:
Max throughput 0.8200 Msg/Sec
Min response 3.5366 Sec
******** RESOURCE Performance ********
Metric Resource Work Value Unit
------ -------- ---- ----- ----
Capacity Router1 Traffic 1 Servers
Throughput Router1 Traffic 0.5000 Msg/Sec
In service Router1 Traffic 0.6098 Msg
Utilization Router1 Traffic 60.9756 Percent
Queue length Router1 Traffic 1.5625 Msg
Waiting line Router1 Traffic 0.9527 Msg
Waiting time Router1 Traffic 1.9055 Sec
Residence time Router1 Traffic 3.1250 Sec
Capacity Router2 Traffic 1 Servers
Throughput Router2 Traffic 0.5000 Msg/Sec
In service Router2 Traffic 0.6098 Msg
Utilization Router2 Traffic 60.9756 Percent
Queue length Router2 Traffic 1.5625 Msg
Waiting line Router2 Traffic 0.9527 Msg
Waiting time Router2 Traffic 1.9055 Sec
Residence time Router2 Traffic 3.1250 Sec
Capacity Router3 Traffic 1 Servers
Throughput Router3 Traffic 0.5000 Msg/Sec
In service Router3 Traffic 0.5488 Msg
Utilization Router3 Traffic 54.8780 Percent
Queue length Router3 Traffic 1.2162 Msg
Waiting line Router3 Traffic 0.6674 Msg
Waiting time Router3 Traffic 1.3349 Sec
Residence time Router3 Traffic 2.4324 Sec
[1] "Check traffic eqns:"
L1: 0.609756 == 0.609756: 0.5 + 0.2 L3
L2: 0.304878 == 0.304878: 0.5 L1
L3: 0.548780 == 0.548780: 0.5 L1 + 0.8 L2
5 Feedback
New versions of PDQ are released periodically. Please fill out this
form
if you would like to notified by email.
File translated from
TEX
by
TTH,
version 3.81.
On 4 Sep 2015, 06:20.