Skip to content
Snippets Groups Projects
Commit 625a774e authored by Roger Dingledine's avatar Roger Dingledine
Browse files

and two more things to move

svn:r18564
parent b182b6f9
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 8495 deletions
## Read data
t <- read.table("exit-capacity.dat", header=TRUE)
## Normalize columns
t[,2] <- t[,2]/max(t[,2])*100
t[,3] <- t[,3]/max(t[,3])*100
## Remove uninteresting ports
ports <- c(22, 25, 80, 119, 135, 443,
563, 8080, 6667)
t <- t[t$port %in% ports,]
## Plot
pdf("exit-capacity.pdf")
par(las=1)
col <- grey(c(1,4)/5)
barplot(t(as.matrix(t[,2:3])), names=t$port,
beside=TRUE, xlab="Port number",
ylab="Exit capacity available (%)",
col=col, cex.axis=0.8, cex.names=0.8)
par(xpd=TRUE)
legend(x="topright", legend=c("Nodes", "Bandwidth"),
fill=col, bty="n", inset=c(-0.05,-0.15))
dev.off()
port numExits totalBandwidth
21 115 39282983
22 116 41341901
25 5 1530934
80 315 60290055
119 16 13026366
135 7 1709809
443 326 60956345
445 8 1730289
563 102 24056338
1314 307 55315711
4661 7 1648369
8080 307 55318361
6667 116 41961767
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
## Load in data files
t1 = read.table("opt_1e-6.pickle.dat", header=TRUE)
t2 = read.table("opt_1e-3.pickle.dat", header=TRUE)
t3 = read.table("opt_1e-1.pickle.dat", header=TRUE)
t4 = read.table("opt_0.75.pickle.dat", header=TRUE)
t5 = read.table("opt_0.5.pickle.dat", header=TRUE)
t6 = read.table("opt_0.25.pickle.dat", header=TRUE)
t7 = read.table("opt_0.1.pickle.dat", header=TRUE)
tt = read.table("opt_tor.pickle.dat", header=TRUE)
## Calculate selection probabilties that Tor uses
o = t1$bw/sum(t1$bw)
#plot(t1$bw, cumsum(t1$prob), col="red", type="l")
#lines(t1$bw, cumsum(t2$prob), col="pink")
#lines(t1$bw, cumsum(t3$prob), col="blue")
#lines(t1$bw, cumsum(t4$prob), col="orange")
#lines(t1$bw, cumsum(t5$prob), col="purple")
#lines(t1$bw, cumsum(tt$prob))
## Plot probabiltieis
pdf("optimum-selection-probabilities.pdf")
col <- rainbow(8)
plot(t1$bw, t1$prob, col=col[1], type="b", ylim=c(0,0.035),xlab="Bandwidth (cells/s)",
ylab="Selection probability", frame.plot=FALSE)
lines(t1$bw, t2$prob, col=col[2], type="b")
lines(t1$bw, t3$prob, col=col[3], type="b")
lines(t1$bw, t4$prob, col=col[4], type="b")
lines(t1$bw, t5$prob, col=col[5], type="b")
## These are too messy
##lines(t1$bw, t6$prob, col=col[6], type="b")
##lines(t1$bw, t7$prob, col=col[7], type="b")
lines(t1$bw, tt$prob,col=col[8], type="b")
lines(t1$bw, o, type="l", lwd=2)
## Annotate graph
title(main="Optimum node selection probability")
x <- rep(8254.383, 4)
y <- c(0.03453717, 0.02553347, 0.02219589, 0.02048830)
par(xpd=TRUE)
text(x,y,c("50%", "75%", "90%", ">99%"), adj=c(0,0.5))
dev.off()
## Plot probabilities relative to what Tor does
pdf("relative-selection-probabilities.pdf")
plot(t1$bw, t1$prob-o, col=col[1], type="b", xlab="Bandwidth (cells/s)",
ylab="Selection probability - Tor's selection probability", frame.plot=FALSE, ylim=c(-0.002,0.015))
lines(t1$bw, t2$prob-o, col=col[2], type="b")
lines(t1$bw, t3$prob-o, col=col[3], type="b")
lines(t1$bw, t4$prob-o, col=col[4], type="b")
lines(t1$bw, t5$prob-o, col=col[5], type="b")
lines(t1$bw, tt$prob-o,col=col[8], type="b")
lines(range(t1$bw), rep(0,2), lty=2)
title(main="Selection probabilility compared to Tor")
x <- rep(8111.669, 4)
y <- c(1.396915e-02, 4.962766e-03, 1.635106e-03, 7.446809e-06)
par(xpd=TRUE)
text(x,y,c("50%", "75%", "90%", ">99%"), adj=c(0,0.5))
dev.off()
## The waiting time for a node (assuming no overloaded nodes)
## x: 1/bandwidth
## q: selection probability
## L: network load
wait <- function(x,q,L) {
a <- q*L*x*x
b <- 2*(1-q*x*L)
return (x + a/b)
}
## The weighted wait time
wwait <- function(x,q,L) {
return (q*wait(x,q,L))
}
## Average latency, returning NA for infinite
netLatency <- function(x, q, L) {
if (any(x*q*L <0 | x*q*L >1)) {
return (NA)
} else {
return (sum(wwait(x, q, L)))
}
}
## Load in data files
t1 <- read.table("opt_1e-6.pickle.dat", header=TRUE)
t2 <- read.table("opt_1e-3.pickle.dat", header=TRUE)
t3 <- read.table("opt_1e-1.pickle.dat", header=TRUE)
t4 <- read.table("opt_0.75.pickle.dat", header=TRUE)
t5 <- read.table("opt_0.5.pickle.dat", header=TRUE)
t6 <- read.table("opt_0.25.pickle.dat", header=TRUE)
t7 <- read.table("opt_0.1.pickle.dat", header=TRUE)
tt <- read.table("opt_tor.pickle.dat", header=TRUE)
## Node bandwidth and reciprocal
bw <- t1$bw
x <- 1/bw
## Calculate network capcity
capacity <- sum(bw)
## Calculate selection probabilties that Tor uses
torProb <- bw/sum(bw)
## Load values to try
varyLoad <- seq(0.01,0.93,0.01)
latencyTor <- c()
latency3 <- c()
latency4 <- c()
latency5 <- c()
for (L in varyLoad) {
latencyTor <- append(latencyTor,
netLatency(x, torProb, capacity*L))
latency3 <- append(latency3,
netLatency(x, t3$prob, capacity*L))
latency4 <- append(latency4,
netLatency(x, t4$prob, capacity*L))
latency5 <- append(latency5,
netLatency(x, t5$prob, capacity*L))
}
## Output graph
pdf("vary-network-load.pdf")
## Set up axes
yFac <- 1000
xFac <- 100
ylim <- range(na.omit(c(latencyTor, latency3, latency4, latency5)))
ylim <- c(0,0.015) * yFac
xlim <- c(0,1) * xFac
plot(NA, NA,
xlim=xlim, ylim=ylim,
frame.plot=FALSE,
xlab = "Network load (%)",
ylab = "Average queuing delay (ms)",
main = "Latency for varying network loads")
## Plot data
col <- rainbow(8)
lines(varyLoad*xFac, latency3*yFac, col=col[3])
lines(varyLoad*xFac, latency4*yFac, col=col[4])
lines(varyLoad*xFac, latency5*yFac, col=col[5])
lines(varyLoad*xFac, latencyTor*yFac)
## Plot points at which selection probabilities are optimal
par(xpd=TRUE)
points(c(0.9, 0.75, 0.5, 1)*xFac, rep(par("usr")[3], 4),
col=c(col[3:5], "black"), pch=20,
cex=2)
## Close output device
dev.off()
%%
%% This is file `prettyref.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% prettyref.dtx (with options: `style')
%%
%% Copyright (c) 1995 Kevin Ruland
%%
%%
%% prettyref v3.0
%%
%% Copyright 1995,1998. by Kevin Ruland kevin@rodin.wustl.edu
%%
\ProvidesPackage{prettyref}[1998/07/09 v3.0]
\def\newrefformat#1#2{%
\@namedef{pr@#1}##1{#2}}
\newrefformat{eq}{\textup{(\ref{#1})}}
\newrefformat{lem}{Lemma \ref{#1}}
\newrefformat{thm}{Theorem \ref{#1}}
\newrefformat{cha}{Chapter \ref{#1}}
\newrefformat{sec}{Section \ref{#1}}
\newrefformat{tab}{Table \ref{#1} on page \pageref{#1}}
\newrefformat{fig}{Figure \ref{#1} on page \pageref{#1}}
\def\prettyref#1{\@prettyref#1:}
\def\@prettyref#1:#2:{%
\expandafter\ifx\csname pr@#1\endcsname\relax%
\PackageWarning{prettyref}{Reference format #1\space undefined}%
\ref{#1:#2}%
\else%
\csname pr@#1\endcsname{#1:#2}%
\fi%
}
\endinput
%%
%% End of file `prettyref.sty'.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment