Created
September 7, 2019 16:41
-
-
Save ruslander/6c62423f4c11f3a93d244575dd0bd4a9 to your computer and use it in GitHub Desktop.
multiple wrongs don't make it right
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
Parallel queues model with PDQ | |
Took as an example the "Internet Provider" from "The practical Performance Analyst". | |
#!/usr/bin/perl | |
use pdq; | |
# Globals | |
$arrivRate = 3; | |
$servTime = 2; | |
$engs = 10; | |
# Initialize PDQ and add a comment about the model | |
pdq::Init("Internet Service Provilder"); | |
# Define the workload and circuit type | |
pdq::CreateOpen("Support", $arrivRate); | |
# Define the queueing center | |
#pdq::CreateNode("Server", $pdq::CEN, $pdq::FCFS); | |
pdq::CreateMultiNode($engs, "Eng", $pdq::MSO, $pdq::FCFS); | |
# Define service demand due to workload on the queueing center | |
pdq::SetDemand("Eng", "Support", $servTime); | |
# Change units labels to suit | |
pdq::SetWUnit("Cust"); | |
pdq::SetTUnit("Min"); | |
# Solve the model | |
# Must use the Canonical method for an open network | |
pdq::Solve($pdq::CANON); | |
# Generate a generic performance report | |
pdq::Report(); | |
And I know it is wrong beacuse should give R=5min. | |
Changing $engs to 18 should change to R=3min. Glanced through | |
PDQ docs but cannot figure out what I'm doing wrong :) | |
If it is a quick answer then would appreciate your help. Otherwise | |
it is not worth ir :D | |
As always thank you very much! |
DrQz
commented
Sep 7, 2019
# parafast.r
#
# Gunther's theorem (1996): Parallel processing is just fast sequential processing.
#
# Show equivalence of:
# 1) k-parallel queues each with service time S
# 2) k-tandem queues each with speed S/k
#
# Created by NJG on Wednesday, October 7, 2009
library(pdq)
workname <- "AllWork"
arrivrate <- 0.5
servtime <- 1.0
paraQMax <- 2
paraname <- 1:paraQMax
Init("Fast Serial Queues")
CreateOpen(workname, arrivrate)
CreateNode("FastQ", CEN, FCFS)
SetDemand("FastQ", workname, servtime/paraQMax)
Solve(CANON)
# Compare with analytic formula: Rk = (S/k) / (1 - (S/k))
cat(sprintf("Fast serial queues: %d\n", paraQMax))
rtimeFast <- (servtime/paraQMax) / (1 - (arrivrate * (servtime / paraQMax)))
cat(sprintf("FastQ Eqn: R = %6.4f\n", rtimeFast))
cat(sprintf("FastQ PDQ: R = %6.4f\n", GetResidenceTime("FastQ", workname, TRANS)))
cat("---\n")
Init("Parallel Queues")
CreateOpen(workname, arrivrate)
for (k in 1:paraQMax) {
paraname[k] <- sprintf("ParaQ%d", k)
CreateNode(paraname[k], CEN, FCFS)
SetDemand(paraname[k], workname, servtime / paraQMax)
}
Solve(CANON)
# Compare with analytic formula: Rpara = S / (1 - (S/k))
rtimePara <- servtime/(1-((arrivrate/paraQMax)*servtime))
cat(sprintf("Parallel queues: %d\n", paraQMax))
cat(sprintf("ParaQ Eqn: R = %6.4f\n", rtimePara))
cat(sprintf("ParaQ PDQ: R = %6.4f (Residence Time)\n",
GetResidenceTime(paraname[1], workname, TRANS)))
cat(sprintf("ParaQ PDQ: R = %6.4f (Residence Time x %d)\n",
GetResidenceTime(paraname[1], workname, TRANS) * paraQMax, paraQMax))
cat(sprintf("ParaQ PDQ: R = %6.4f (Response Time sum)\n",
GetResponse(TRANS, workname)))
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment