tor_multipath_voip/r/thunder_configure.R

432 lines
16 KiB
R
Raw Normal View History

2019-09-14 14:26:57 +00:00
library(ggplot2)
library(sqldf)
library(plyr)
library(cowplot)
2019-09-23 14:32:59 +00:00
thunder_ms <- read.csv("thunder_22.csv")
2019-09-16 23:40:32 +00:00
thunder_ms <- sqldf("select run,ident,jmax,links,latency, CAST(latency as real) / 1000. as lat_ms from thunder_ms")
2019-09-14 17:15:22 +00:00
thunder_ms$links <- as.factor(thunder_ms$links)
thunder_ms$jmax <- as.factor(thunder_ms$jmax)
2019-09-19 16:23:55 +00:00
ggplot(data = thunder_ms, aes(x = links, y=lat_ms)) +
#geom_violin() +
geom_boxplot(outlier.size=0.1) +
geom_hline(yintercept=800, color = "red", linetype="dashed") +
geom_hline(yintercept=400, color = "DarkGreen") +
annotate("text", x=7.1, y=650, label= "high", color="DarkGreen") +
annotate("text", x=7, y=1200, label= "acceptable", color="red") +
coord_cartesian(xlim = c(1, 7), ylim = c(0, 1000)) +
#ylim(0,1000) +
scale_fill_grey() +
#scale_y_log10() +
ylab("latency (ms)") +
xlab("links") +
theme_classic()
2019-09-14 17:15:22 +00:00
v1 <- ggplot(data = thunder_ms, aes(x = jmax, y=lat_ms, fill=links)) +
2019-09-17 06:33:55 +00:00
#geom_violin() +
geom_boxplot(outlier.size=0.1) +
2019-09-16 16:00:15 +00:00
geom_hline(yintercept=800, color = "red", linetype="dashed") +
geom_hline(yintercept=400, color = "DarkGreen") +
2019-09-18 06:53:01 +00:00
annotate("text", x=7.1, y=650, label= "high", color="DarkGreen") +
annotate("text", x=7, y=1200, label= "acceptable", color="red") +
2019-09-19 07:51:37 +00:00
coord_cartesian(xlim = c(1, 7), ylim = c(0, 1000)) +
2019-09-17 13:12:37 +00:00
#ylim(0,1000) +
2019-09-14 17:15:22 +00:00
scale_fill_grey() +
2019-09-19 07:51:37 +00:00
#scale_y_log10() +
2019-09-14 17:15:22 +00:00
ylab("latency (ms)") +
xlab("max allowed jitter") +
theme_classic()
2019-09-16 16:00:15 +00:00
#v1 + ggsave("thunder_configure_ms.png", dpi=300, dev='png', height=5, width=15, units="cm")
2019-09-14 17:15:22 +00:00
2019-09-19 16:23:55 +00:00
thunder_rcv <- sqldf("select run,jmax,links,(9900-COUNT(latency)*1.0)/9900 as dlv from thunder_ms group by jmax,links,run")
2019-09-16 07:56:34 +00:00
thunder_rcv$jmax <- as.factor(thunder_rcv$jmax)
thunder_rcv$links <- as.factor(thunder_rcv$links)
v2 <- ggplot(data = thunder_rcv, aes(x = jmax, y=dlv, fill=links)) +
2019-09-19 07:51:37 +00:00
geom_boxplot(outlier.size=0.1) +
#geom_violin(scale='width') +
2019-09-16 07:56:34 +00:00
scale_y_continuous(labels = scales::percent) +
scale_fill_grey() +
2019-09-18 06:53:01 +00:00
#scale_y_log10(labels = scales::percent) +
2019-09-16 07:56:34 +00:00
ylab("dropped packets") +
xlab("max allowed jitter") +
theme_classic()
2019-09-19 16:23:55 +00:00
thunder_bw <- read.csv("thunder_22_bw.csv")
2019-09-16 07:56:34 +00:00
thunder_bw <- sqldf("select run,jmax,links,udp_sent,udp_rcv,cells_sent,cells_rcv,1.0*cells_sent/udp_sent as sent_ratio,1.0*cells_rcv/udp_rcv as rcv_ratio from thunder_bw where udp_sent > 4000")
thunder_bw$jmax <- as.factor(thunder_bw$jmax)
thunder_bw$links <- as.factor(thunder_bw$links)
v3 <- ggplot(data = thunder_bw, aes(x = jmax, y=sent_ratio, fill=links)) +
2019-09-17 06:33:55 +00:00
geom_boxplot(outlier.size=0.1) +
2019-09-16 12:40:58 +00:00
#scale_y_log10() +
2019-09-23 14:32:59 +00:00
coord_cartesian(ylim = c(1,4)) +
2019-09-16 07:56:34 +00:00
scale_fill_grey() +
ylab("bandwidth ratio") +
xlab("max allowed jitter") +
theme_classic()
t1 <- plot_grid(v1, v2, v3, labels = c('A', 'B', 'C'), ncol=1)
t1 + ggsave("thunder_configure.png", dpi=300, dev='png', height=15, width=15, units="cm")
2019-09-16 17:20:38 +00:00
2019-09-19 07:51:37 +00:00
thunder_links <- read.csv("thunder_configure_20_links.csv")
2019-09-16 17:20:38 +00:00
links_down_at_least_once <- sqldf("select run,xp_time,link_id, COUNT(status) as downcount, SUM(delta) as elapsed from thunder_links where status='down' group by run,link_id,xp_time")
links_down_at_least_once2 <- sqldf("select row_number () OVER (PARTITION BY run ORDER BY elapsed DESC) sorting,run,link_id,downcount,elapsed,xp_time,1.0*elapsed/xp_time down_ratio from links_down_at_least_once")
links_down_at_least_once2$sorting <- as.factor(links_down_at_least_once2$sorting)
2019-09-16 20:53:34 +00:00
v4 <- ggplot(data = links_down_at_least_once2, aes(x = sorting, y=down_ratio)) +
#geom_violin() +
#geom_boxplot(width=0.2) +
#scale_y_log10() +
#scale_y_log10(labels = scales::percent) +
geom_bar(stat="summary") +
2019-09-16 17:20:38 +00:00
#scale_y_log10() +
2019-09-16 20:53:34 +00:00
scale_y_continuous(labels = scales::percent) +
2019-09-16 17:20:38 +00:00
scale_fill_grey() +
2019-09-16 21:07:38 +00:00
ylab("Cumulated downtime") +
2019-09-16 21:10:35 +00:00
xlab("Sorted links") +
2019-09-16 17:20:38 +00:00
theme_classic()
2019-09-16 20:53:34 +00:00
downtime <- sqldf(
"
select sorting,1.0*duration/1000 as dur
from thunder_links as tl
inner join links_down_at_least_once2 as l2 on
tl.run = l2.run
and tl.link_id = l2.link_id
where will_change='True'
and status='down'")
v5 <- ggplot(data = downtime, aes(x=sorting, y=dur)) +
geom_violin() +
2019-09-17 13:12:37 +00:00
geom_boxplot(width=0.1, outlier.shape = NA) +
2019-09-16 20:53:34 +00:00
scale_y_log10() +
2019-09-16 22:03:48 +00:00
ylab("Downtime (in sec)") +
2019-09-16 21:10:35 +00:00
xlab("Sorted links") +
2019-09-16 20:53:34 +00:00
theme_classic()
gobal_links <- sqldf(
"
2019-09-18 06:53:01 +00:00
select ts,run,durations_global,12-COUNT(status) as down_link_count,xp_time
2019-09-16 20:53:34 +00:00
from thunder_links
where will_change_global='True' and status='up' and durations_global > 0
group by ts,run,durations_global
")
down_group_ratio <- sqldf(
"
select run,1.0 * SUM(durations_global)/xp_time as down_ratio, down_link_count
from gobal_links
where down_link_count >= 0
group by run,down_link_count,xp_time
")
down_group_ratio$down_link_count <- as.factor(down_group_ratio$down_link_count)
v6 <- ggplot(data = down_group_ratio, aes(x=down_link_count, y=down_ratio)) +
geom_bar(stat="summary") +
#scale_y_log10() +
scale_y_continuous(labels = scales::percent) +
2019-09-16 21:07:38 +00:00
ylab("Cumulated downtime") +
xlab("Number of links down at once") +
2019-09-16 20:53:34 +00:00
theme_classic()
2019-09-16 21:07:38 +00:00
downtime_group <- sqldf(
"
select down_link_count, 1.0*durations_global/1000 as dur from gobal_links where down_link_count >= 0
")
downtime_group$down_link_count <- as.factor(downtime_group$down_link_count)
v7 <- ggplot(data = downtime_group, aes(x=down_link_count, y=dur)) +
geom_violin() +
2019-09-17 13:12:37 +00:00
geom_boxplot(width=0.1, outlier.shape = NA) +
2019-09-16 21:07:38 +00:00
scale_y_log10() +
2019-09-16 22:03:48 +00:00
ylab("Downtime (in sec)") +
2019-09-16 21:07:38 +00:00
xlab("Number of links down at once") +
theme_classic()
2019-09-16 20:53:34 +00:00
2019-09-16 21:07:38 +00:00
t2 <- plot_grid(v4, v5, v6, v7, labels = c('A', 'B', 'C', 'D'), ncol=2)
2019-09-16 22:03:48 +00:00
t2 + ggsave("thunder_links.png", dpi=300, dev='png', height=12, width=15, units="cm")
2019-09-16 20:53:34 +00:00
2019-09-16 23:30:43 +00:00
latency_evol <- sqldf(
"
2019-09-16 23:40:32 +00:00
select sorting,lat_ms,ident,tm.jmax,tm.links
2019-09-16 23:30:43 +00:00
from
thunder_ms as tm,
2019-09-16 23:40:32 +00:00
(select run,jmax,links,row_number () OVER (ORDER BY links DESC) sorting from thunder_ms group by run,jmax,links ORDER BY links DESC limit 0,1) as sel_run
2019-09-16 23:30:43 +00:00
where
tm.run = sel_run.run and tm.jmax = sel_run.jmax and tm.links = sel_run.links
")
2019-09-16 20:53:34 +00:00
2019-09-16 23:40:32 +00:00
latency_evol$sorting <- as.factor(latency_evol$sorting)
2019-09-17 13:12:37 +00:00
v8 <- ggplot(data=latency_evol, aes(x=ident,y=lat_ms)) +
2019-09-16 23:40:32 +00:00
geom_line() +
2019-09-17 14:44:49 +00:00
xlab("Packet identifier") +
ylab("Latency (ms)") +
2019-09-17 13:12:37 +00:00
theme_classic()
2019-09-18 06:53:01 +00:00
thunder_drop <- read.csv("thunder_configure_partial_drop.csv")
thunder_drop_2 <- sqldf("select run, packet_range, 1.0*count / 990 as packet_ratio, row_number() OVER (partition by packet_range order by run) sorting from thunder_drop where run LIKE '%-23' ")
2019-09-17 13:12:37 +00:00
#cats <- c("0-989","990-1979","1980-2969","2970-3959","3960-4949","4950-5939","5940-6929","6930-7919","7920-8909","8910-9899")
thunder_drop_2$packet_range <- as.factor(thunder_drop_2$packet_range)
thunder_drop_2$sorting <- as.factor(thunder_drop_2$sorting)
2019-09-18 06:53:01 +00:00
#thunder_drop_2$packet_range <- factor(
# mapvalues(thunder_drop_2$packet_range, cats, cats),
# levels = cats,
# ordered = TRUE)
2019-09-17 13:12:37 +00:00
v9 <- ggplot(data = thunder_drop_2, aes(x=packet_range, y=packet_ratio,fill=sorting)) +
geom_bar(stat="summary",position = "dodge") +
#grom_bar() +
#scale_y_log10() +
scale_y_continuous(labels = scales::percent) +
ylab("Packets dropped") +
2019-09-17 14:44:49 +00:00
xlab("Packet identifier") +
labs(fill="Run") +
2019-09-17 13:12:37 +00:00
scale_fill_grey() +
2019-09-17 14:44:49 +00:00
theme_classic() +
theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.key.size = unit(0.2, "cm"))
2019-09-17 13:12:37 +00:00
2019-09-18 06:53:01 +00:00
thunder_drop_burst <- read.csv("thunder_configure_partial_drop_burst.csv")
tdb_ag <- sqldf("select run,count,COUNT(count) as oc from thunder_drop_burst where run LIKE '%-23' group by run,count")
2019-09-17 13:59:38 +00:00
tdb_ag_2 <- sqldf(
"
select
td.run as r,
count,
oc,
total,
1.0 * oc / total as oc_ratio,
row_number() OVER (partition by count order by td.run) as sorting
from
tdb_ag as td,
(select run,SUM(oc) as total from tdb_ag group by run) as ag
where
td.run = ag.run
")
2019-09-17 13:12:37 +00:00
tdb_ag_2$sorting <- as.factor(tdb_ag_2$sorting)
tdb_ag_2$count <- as.factor(tdb_ag_2$count)
2019-09-17 13:59:38 +00:00
v10 <- ggplot(data = tdb_ag_2, aes(x=count, y=oc_ratio)) +
2019-09-17 13:36:07 +00:00
#geom_bar(stat="summary",position = "dodge") +
2019-09-17 13:12:37 +00:00
#scale_y_log10() +
2019-09-17 13:36:07 +00:00
geom_violin(scale='width') +
geom_boxplot(width=0.1, outlier.shape=NA) +
2019-09-17 13:59:38 +00:00
scale_y_continuous(labels = scales::percent) +
ylab("% observed drops") +
xlab("Packets lost during the drop") +
2019-09-17 13:12:37 +00:00
scale_fill_grey() +
2019-09-16 23:40:32 +00:00
theme_classic()
2019-09-18 06:53:01 +00:00
thunder_red <- read.csv("thunder_configure_partial_red.csv")
2019-09-17 13:59:38 +00:00
tred <- sqldf(
"
select
tr.run as r,
delivered_at_once,
1.0 * occur / total as occur_ratio,
occur,
total,
row_number() OVER (partition by delivered_at_once order by tr.run) as sorting
from
thunder_red tr,
(select run,SUM(occur) as total from thunder_red group by run) as ag
WHERE
2019-09-18 06:53:01 +00:00
tr.run LIKE '%-23'
2019-09-17 13:59:38 +00:00
and tr.run = ag.run
")
2019-09-17 13:36:07 +00:00
tred$sorting <- as.factor(tred$sorting)
tred$delivered_at_once <- as.factor(tred$delivered_at_once)
2019-09-17 13:59:38 +00:00
v11 <- ggplot(data = tred, aes(x=delivered_at_once, y=occur_ratio)) +
2019-09-17 13:36:07 +00:00
#geom_bar(stat="summary",position = "dodge") +
geom_violin(scale='width') +
2019-09-17 13:59:38 +00:00
xlab('Fresh packets per cell') +
ylab('% of received cells') +
scale_y_continuous(labels = scales::percent) +
2019-09-17 13:36:07 +00:00
geom_boxplot(width=0.1, outlier.shape=NA) +
theme_classic()
2019-09-16 20:53:34 +00:00
2019-09-17 13:36:07 +00:00
t3 <- plot_grid(v8, v9, v10, v11, labels = c('A', 'B', 'C', 'D'), ncol=2)
2019-09-17 14:44:49 +00:00
t3 + ggsave("thunder_packets.png", dpi=300, dev='png', height=12, width=15, units="cm")
2019-09-17 17:52:02 +00:00
tor_multi_lat <- read.csv("tor_just_many_latencies.csv")
2019-09-17 21:05:52 +00:00
tor_multi_lat_100 <- read.csv("tor_just_many_latencies_100.csv")
tor_drop <- sqldf(
"
select run,conf,1.0*MAX(ident)/33 as last_one,'33' as pkt_sec from tor_multi_lat group by run,conf
union
select run,conf,1.0*MAX(ident)/10 as last_one, '10' as pkt_sec from tor_multi_lat_100 group by run,conf
")
v12 <- ggplot(data=tor_drop,aes(x=last_one, linetype=factor(pkt_sec, levels=c('33', '10')))) +
2019-09-17 17:52:02 +00:00
stat_ecdf(pad = FALSE) +
ylab("% broken links") +
2019-09-17 21:05:52 +00:00
labs(linetype="Pkt/sec") +
2019-09-17 17:52:02 +00:00
coord_cartesian(xlim = c(0, 300), ylim = c(0,0.5)) +
scale_y_continuous(labels = scales::percent) +
xlab("Elapsed time (sec)") +
theme_classic()
v12 + ggsave("broken.png", dpi=300, dev='png', height=5, width=15, units="cm")
library(dplyr)
library(purrr)
library(tidyr)
tor_lat_stack <- tor_multi_lat %>%
2019-09-17 21:05:52 +00:00
dplyr::mutate(latency = latency / 1000) %>%
2019-09-17 17:52:02 +00:00
dplyr::group_by(run,conf) %>%
dplyr::summarise(
id = paste(first(run),first(conf)),
2019-11-27 15:08:44 +00:00
P0 = min(latency),
P25 = quantile(latency,0.25) - min(latency),
P50 = median(latency) - quantile(latency,0.25),
P75 = quantile(latency,0.75) - median(latency),
P95 = quantile(latency,0.95) - quantile(latency,0.75),
P99 = quantile(latency,0.99) - quantile(latency,0.95),
P100 = max(latency) - quantile(latency,0.99),
2019-09-17 17:52:02 +00:00
max_sort = max(latency),
2019-09-17 21:05:52 +00:00
median_sort = median(latency)
2019-09-17 17:52:02 +00:00
)
2019-11-27 15:08:44 +00:00
tor_lat_stack <- gather(tor_lat_stack, 'P0', 'P100', 'P25', 'P50', 'P75', 'P95', 'P99', key="quantile_name", value="quantile_value")
2019-09-17 21:05:52 +00:00
v13 <- ggplot(tor_lat_stack, aes(
x=reorder(id,median_sort),
y=quantile_value,
2019-11-27 15:08:44 +00:00
fill=factor(quantile_name, levels=c('P100','P99','P95','P75', 'P50', 'P25', 'P0')))
2019-09-17 21:05:52 +00:00
) +
coord_cartesian(ylim = c(0,1500)) +
2019-11-27 15:08:44 +00:00
labs(fill="Percentile")+
2019-09-17 21:05:52 +00:00
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"))
v14 <- ggplot(tor_lat_stack, aes(
x=reorder(id,median_sort),
y=quantile_value,
2019-11-27 15:08:44 +00:00
fill=factor(quantile_name, levels=c('P100','P99','P95','P75', 'P50', 'P25', 'P0')))
2019-09-17 21:05:52 +00:00
) +
#coord_cartesian(ylim = c(0,1500)) +
2019-11-27 15:08:44 +00:00
labs(fill="Percentile")+
2019-09-17 21:05:52 +00:00
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(),axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"))
v15 <- ggplot(tor_lat_stack, aes(
x=reorder(id,max_sort),
y=quantile_value,
2019-11-27 15:08:44 +00:00
fill=factor(quantile_name, levels=c('P100','P99','P95','P75', 'P50', 'P25', 'P0')))
2019-09-17 21:05:52 +00:00
) +
coord_cartesian(ylim = c(0,1500)) +
2019-11-27 15:08:44 +00:00
labs(fill="Percentile")+
2019-09-17 21:05:52 +00:00
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"), plot.tag.position='top')
v16 <- ggplot(tor_lat_stack, aes(
x=reorder(id,max_sort),
y=quantile_value,
2019-11-27 15:08:44 +00:00
fill=factor(quantile_name, levels=c('P100','P99','P95','P75', 'P50', 'P25', 'P0')))
2019-09-17 21:05:52 +00:00
) +
#coord_cartesian(ylim = c(0,1500)) +
2019-11-27 15:08:44 +00:00
labs(fill="Percentile")+
2019-09-17 21:05:52 +00:00
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"),plot.tag.position='bottom')
2019-11-27 15:08:44 +00:00
t4 <- plot_grid(v16, v15, v14, v13, align = "v", axis = "l", labels = c('A', 'B', 'C', 'D'), ncol=1)
t4 + ggsave("tor_30ms.pdf", dpi=150, dev='pdf', height=15, width=12, units="cm")
2019-09-17 21:05:52 +00:00
tor_lat_stack_100 <- tor_multi_lat_100 %>%
dplyr::mutate(latency = latency / 1000) %>%
dplyr::group_by(run,conf) %>%
dplyr::summarise(
id = paste(first(run),first(conf)),
min = min(latency),
q25 = quantile(latency,0.25) - min(latency),
median = median(latency) - quantile(latency,0.25),
q75 = quantile(latency,0.75) - median(latency),
q95 = quantile(latency,0.95) - quantile(latency,0.75),
q99 = quantile(latency,0.99) - quantile(latency,0.95),
max = max(latency) - quantile(latency,0.99),
max_sort = max(latency),
median_sort = median(latency)
)
tor_lat_stack_100 <- gather(tor_lat_stack_100, 'min', 'max', 'q25', 'median', 'q75', 'q95', 'q99', key="quantile_name", value="quantile_value")
v17 <- ggplot(tor_lat_stack_100, aes(
x=reorder(id,median_sort),
y=quantile_value,
fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min')))
) +
coord_cartesian(ylim = c(0,1500)) +
labs(fill="quantile")+
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"))
v18 <- ggplot(tor_lat_stack_100, aes(
x=reorder(id,median_sort),
y=quantile_value,
fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min')))
) +
#coord_cartesian(ylim = c(0,1500)) +
labs(fill="quantile")+
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(),axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"))
v19 <- ggplot(tor_lat_stack_100, aes(
x=reorder(id,max_sort),
y=quantile_value,
fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min')))
) +
coord_cartesian(ylim = c(0,1500)) +
labs(fill="quantile")+
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"), plot.tag.position='top')
v20 <- ggplot(tor_lat_stack_100, aes(
x=reorder(id,max_sort),
y=quantile_value,
fill=factor(quantile_name, levels=c('max','q99','q95','q75', 'median', 'q25', 'min')))
) +
#coord_cartesian(ylim = c(0,1500)) +
labs(fill="quantile")+
xlab("Tor circuits") +
ylab("RTT (ms)") +
geom_bar(stat="identity", position="stack",width=1) +
scale_fill_grey() +
theme_classic() +
theme(axis.text.x=element_blank(), axis.ticks.x = element_blank(), legend.key.size = unit(0.2, "cm"),plot.tag.position='bottom')
t5 <- plot_grid(v20, v19, v18, v17, labels = c('A', 'B', 'C', 'D'), ncol=1)
t5 + ggsave("tor_100ms.png", dpi=300, dev='png', height=20, width=15, units="cm")