diff --git a/r/thunder_configure.R b/r/thunder_configure.R index 4be1642..58f5367 100644 --- a/r/thunder_configure.R +++ b/r/thunder_configure.R @@ -14,8 +14,8 @@ v1 <- ggplot(data = thunder_ms, aes(x = jmax, y=lat_ms, fill=links)) + geom_boxplot(outlier.size=0.1) + geom_hline(yintercept=800, color = "red", linetype="dashed") + geom_hline(yintercept=400, color = "DarkGreen") + - annotate("text", x=7, y=550, label= "high", color="DarkGreen") + - annotate("text", x=7, y=1000, label= "acceptable", color="red") + + 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(0,1000) + scale_fill_grey() + @@ -30,14 +30,21 @@ thunder_rcv <- sqldf("select run,jmax,links,(9900-COUNT(latency)*1.0)/9900 as dl 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)) + - geom_boxplot(outlier.size=0.1) + + #geom_boxplot(outlier.size=0.1) + + geom_violin(scale='width') + scale_y_continuous(labels = scales::percent) + scale_fill_grey() + + coord_cartesian(ylim = c(0,0.2)) + + #scale_y_log10(labels = scales::percent) + ylab("dropped packets") + xlab("max allowed jitter") + theme_classic() +<<<<<<< HEAD thunder_bw <- read.csv("thunder_configure_21_bw.csv") +======= +thunder_bw <- read.csv("thunder_configure_20_bw.csv") +>>>>>>> 1bd4c2aa8469d54046c78999147c638b22ea6f75 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) @@ -45,7 +52,7 @@ thunder_bw$links <- as.factor(thunder_bw$links) v3 <- ggplot(data = thunder_bw, aes(x = jmax, y=sent_ratio, fill=links)) + geom_boxplot(outlier.size=0.1) + #scale_y_log10() + - #scale_y_log10(labels = scales::percent) + + coord_cartesian(ylim = c(1,2)) + scale_fill_grey() + ylab("bandwidth ratio") + xlab("max allowed jitter") + @@ -55,7 +62,7 @@ v3 <- ggplot(data = thunder_bw, aes(x = jmax, y=sent_ratio, fill=links)) + 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") -thunder_links <- read.csv("thunder_configure_16_links.csv") +thunder_links <- read.csv("thunder_configure_partial_links.csv") 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) @@ -92,7 +99,7 @@ v5 <- ggplot(data = downtime, aes(x=sorting, y=dur)) + gobal_links <- sqldf( " -select ts,run,durations_global,8-COUNT(status) as down_link_count,xp_time +select ts,run,durations_global,12-COUNT(status) as down_link_count,xp_time from thunder_links where will_change_global='True' and status='up' and durations_global > 0 group by ts,run,durations_global @@ -148,16 +155,16 @@ v8 <- ggplot(data=latency_evol, aes(x=ident,y=lat_ms)) + ylab("Latency (ms)") + theme_classic() -thunder_drop <- read.csv("thunder_configure_16_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 '%-26' ") +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' ") #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) -thunder_drop_2$packet_range <- factor( - mapvalues(thunder_drop_2$packet_range, cats, cats), - levels = cats, - ordered = TRUE) +#thunder_drop_2$packet_range <- factor( +# mapvalues(thunder_drop_2$packet_range, cats, cats), +# levels = cats, +# ordered = TRUE) v9 <- ggplot(data = thunder_drop_2, aes(x=packet_range, y=packet_ratio,fill=sorting)) + geom_bar(stat="summary",position = "dodge") + @@ -171,8 +178,8 @@ v9 <- ggplot(data = thunder_drop_2, aes(x=packet_range, y=packet_ratio,fill=sort theme_classic() + theme(axis.text.x = element_text(angle = 45, hjust = 1), legend.key.size = unit(0.2, "cm")) -thunder_drop_burst <- read.csv("thunder_configure_16_drop_burst.csv") -tdb_ag <- sqldf("select run,count,COUNT(count) as oc from thunder_drop_burst where run LIKE '%-24' group by run,count") +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") tdb_ag_2 <- sqldf( " select @@ -203,7 +210,7 @@ v10 <- ggplot(data = tdb_ag_2, aes(x=count, y=oc_ratio)) + scale_fill_grey() + theme_classic() -thunder_red <- read.csv("thunder_configure_16_red.csv") +thunder_red <- read.csv("thunder_configure_partial_red.csv") tred <- sqldf( " select @@ -217,7 +224,7 @@ from thunder_red tr, (select run,SUM(occur) as total from thunder_red group by run) as ag WHERE - tr.run LIKE '%-26' + tr.run LIKE '%-23' and tr.run = ag.run ") @@ -236,10 +243,19 @@ t3 <- plot_grid(v8, v9, v10, v11, labels = c('A', 'B', 'C', 'D'), ncol=2) t3 + ggsave("thunder_packets.png", dpi=300, dev='png', height=12, width=15, units="cm") tor_multi_lat <- read.csv("tor_just_many_latencies.csv") -tor_drop <- sqldf("select run,conf,1.0*MAX(ident)/33 as last_one from tor_multi_lat group by run,conf") -v12 <- ggplot(data=tor_drop,aes(x=last_one)) + +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')))) + stat_ecdf(pad = FALSE) + ylab("% broken links") + + labs(linetype="Pkt/sec") + coord_cartesian(xlim = c(0, 300), ylim = c(0,0.5)) + scale_y_continuous(labels = scales::percent) + xlab("Elapsed time (sec)") + @@ -252,21 +268,158 @@ library(purrr) library(tidyr) tor_lat_stack <- tor_multi_lat %>% +<<<<<<< HEAD +======= + dplyr::mutate(latency = latency / 1000) %>% +>>>>>>> 1bd4c2aa8469d54046c78999147c638b22ea6f75 dplyr::group_by(run,conf) %>% dplyr::summarise( id = paste(first(run),first(conf)), min = min(latency), - max = max(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), - q25 = quantile(latency,0.25), - median = median(latency), - median_sort = median(latency), - q75 = quantile(latency,0.75), - q95 = quantile(latency,0.95), - q99 = quantile(latency,0.99) + median_sort = median(latency) ) tor_lat_stack <- gather(tor_lat_stack, 'min', 'max', 'q25', 'median', 'q75', 'q95', 'q99', key="quantile_name", value="quantile_value") -ggplot(tor_lat_stack, aes(x=id,y=quantile_value,fill=quantile_name)) + - ylim(0,1000000) + - geom_bar(stat="identity", position="dodge") +v13 <- ggplot(tor_lat_stack, 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")) + +v14 <- ggplot(tor_lat_stack, 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")) + +v15 <- ggplot(tor_lat_stack, 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') + +v16 <- ggplot(tor_lat_stack, 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') + +t4 <- plot_grid(v16, v15, v14, v13, labels = c('A', 'B', 'C', 'D'), ncol=1) +t4 + ggsave("tor_30ms.png", dpi=300, dev='png', height=20, width=15, units="cm") + + +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") + diff --git a/scripts/Makefile b/scripts/Makefile index 98a0c2d..7758421 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -228,9 +228,37 @@ thunder_configure_full_parse: @. parse_lib.sh && \ parse_thunder thunder_configure 6 +thunder_configure_2_part: + ./run-3 \ + 2,thunder_configure_2. \ + thunder-client 9900 30 100 2 ${jmax}, \ + thunder-client 9900 30 100 4 ${jmax}, \ + thunder-client 9900 30 100 6 ${jmax}, \ + thunder-client 9900 30 100 8 ${jmax}, \ + thunder-client 9900 30 100 12 ${jmax}, \ + thunder-client 9900 30 100 16 ${jmax}. \ + thunder-server 2 ${jmax}, \ + thunder-server 4 ${jmax}, \ + thunder-server 6 ${jmax}, \ + thunder-server 8 ${jmax}, \ + thunder-server 12 ${jmax}, \ + thunder-server 16 ${jmax}. \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple. \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple, \ + tor2 -f /etc/torrc_simple + thunder_configure_2_full: ./run-3 \ - 2,thunder_configure_2. \ + 16,thunder_configure_2. \ thunder-client 9900 30 100 2 50, \ thunder-client 9900 30 100 2 150, \ thunder-client 9900 30 100 2 250, \ @@ -410,19 +438,19 @@ thunder_configure_2_full_parse_bw: thunder_configure_2_full_parse_links: @. parse_lib.sh && \ - parse_thunder_links thunder_configure_2 27 + parse_thunder_links thunder_configure_2 41 thunder_configure_2_full_parse_drop: @. parse_lib.sh && \ - parse_thunder_drop thunder_configure_2 27 + parse_thunder_drop thunder_configure_2 41 thunder_configure_2_full_parse_drop_burst: @. parse_lib.sh && \ - parse_thunder_drop_burst thunder_configure_2 27 + parse_thunder_drop_burst thunder_configure_2 41 thunder_configure_2_full_parse_red: @. parse_lib.sh && \ - parse_thunder_red thunder_configure_2 27 + parse_thunder_red thunder_configure_2 41 tor_just_many_latencies: ./run-3 \ @@ -616,3 +644,54 @@ thunder_configure_2_part_parse_red: @. parse_lib.sh && \ parse_thunder_red thunder_configure_2 ${nrep} +thunder_guards: + ./run-3 \ + 16,thunder_configure_2. \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250, \ + thunder-client 9900 30 100 12 250. \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250, \ + thunder-server 12 250. \ + tor2 -f /etc/torrc_guard_2, \ + tor2 -f /etc/torrc_guard_4, \ + tor2 -f /etc/torrc_guard_6, \ + tor2 -f /etc/torrc_guard_8, \ + tor2 -f /etc/torrc_guard_10, \ + tor2 -f /etc/torrc_guard_12, \ + tor2 -f /etc/torrc_guard_2, \ + tor2 -f /etc/torrc_guard_4, \ + tor2 -f /etc/torrc_guard_6, \ + tor2 -f /etc/torrc_guard_8, \ + tor2 -f /etc/torrc_guard_10, \ + tor2 -f /etc/torrc_guard_12. \ + tor2 -f /etc/torrc_guard_2, \ + tor2 -f /etc/torrc_guard_4, \ + tor2 -f /etc/torrc_guard_6, \ + tor2 -f /etc/torrc_guard_8, \ + tor2 -f /etc/torrc_guard_10, \ + tor2 -f /etc/torrc_guard_12, \ + tor2 -f /etc/torrc_guard_2, \ + tor2 -f /etc/torrc_guard_4, \ + tor2 -f /etc/torrc_guard_6, \ + tor2 -f /etc/torrc_guard_8, \ + tor2 -f /etc/torrc_guard_10, \ + tor2 -f /etc/torrc_guard_12 diff --git a/scripts/parse_lib.sh b/scripts/parse_lib.sh index be644f0..e18ace7 100644 --- a/scripts/parse_lib.sh +++ b/scripts/parse_lib.sh @@ -54,7 +54,7 @@ parse_thunder_links() { echo "run,ts,link_id,status,delta,duration,will_change,xp_time,durations_global,will_change_global" get_xp $1 | while read r; do for i in $(seq 0 1 $2); do - grep -q 'thunder-client 9900 30 100 8 450' out/$r-$i/info.txt && cat out/$r-$i/log/client-donar-stdout.log | ./links_parse.py $r-$i || true + grep -q 'thunder-client 9900 30 100 12 250' out/$r-$i/info.txt && cat out/$r-$i/log/client-donar-stdout.log | ./links_parse.py $r-$i || true done done } diff --git a/src/algo_thunder.c b/src/algo_thunder.c index 3bcad7b..2443d74 100644 --- a/src/algo_thunder.c +++ b/src/algo_thunder.c @@ -6,7 +6,7 @@ #include "timer.h" #include "proxy.h" -#define PROBE_EVERY 3 +#define PROBE_EVERY 2 uint64_t compute_delta(struct timespec* prev_time, uint64_t max, uint8_t update) { struct timespec curr; int secs, nsecs; @@ -396,7 +396,8 @@ void adapt(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buff int64_t estimation_index = i > sorted_occurencies - 1 ? sorted_occurencies - 1 : i; if (sorted_estimation[estimation_index] > thunderc->allowed_jitter_ms) { - continue; + printf("Would have dropped %d\n",i); + //continue; } // Find destination