From b2fb6296a128381fa5145022db1fba16d777cf0c Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 17 Sep 2019 00:03:48 +0200 Subject: [PATCH] WIP try to improve Donar --- r/thunder_configure.R | 18 +++++++++--------- scripts/Makefile | 6 +++--- src/algo_thunder.c | 13 +++++++++---- src/packet.h | 1 + src/proxy.h | 1 + 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/r/thunder_configure.R b/r/thunder_configure.R index d70aea7..0bb01a1 100644 --- a/r/thunder_configure.R +++ b/r/thunder_configure.R @@ -3,7 +3,7 @@ library(sqldf) library(plyr) library(cowplot) -thunder_ms <- read.csv("thunder_configure_13.csv") +thunder_ms <- read.csv("thunder_configure_14.csv") thunder_ms <- sqldf("select run,jmax,links,latency, CAST(latency as real) / 1000. as lat_ms from thunder_ms") thunder_ms$links <- as.factor(thunder_ms$links) @@ -13,9 +13,9 @@ v1 <- ggplot(data = thunder_ms, aes(x = jmax, y=lat_ms, fill=links)) + geom_violin() + geom_hline(yintercept=800, color = "red", linetype="dashed") + geom_hline(yintercept=400, color = "DarkGreen") + - annotate("text", x=8, y=550, label= "high", color="DarkGreen") + - annotate("text", x=7.7, y=1000, label= "acceptable", color="red") + - coord_cartesian(xlim = c(1, 8)) + + annotate("text", x=6, y=550, label= "high", color="DarkGreen") + + annotate("text", x=5.7, y=1000, label= "acceptable", color="red") + + coord_cartesian(xlim = c(1, 6)) + scale_fill_grey() + #scale_y_log10() + ylab("latency (ms)") + @@ -35,7 +35,7 @@ v2 <- ggplot(data = thunder_rcv, aes(x = jmax, y=dlv, fill=links)) + xlab("max allowed jitter") + theme_classic() -thunder_bw <- read.csv("thunder_configure_13_bw.csv") +thunder_bw <- read.csv("thunder_configure_14_bw.csv") 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) @@ -53,7 +53,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_13_links.csv") +thunder_links <- read.csv("thunder_configure_14_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) @@ -83,7 +83,7 @@ where will_change='True' v5 <- ggplot(data = downtime, aes(x=sorting, y=dur)) + geom_violin() + scale_y_log10() + - ylab("Downtime duration (in sec)") + + ylab("Downtime (in sec)") + xlab("Sorted links") + theme_classic() @@ -120,12 +120,12 @@ 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() + scale_y_log10() + - ylab("Downtime duration (in sec)") + + ylab("Downtime (in sec)") + xlab("Number of links down at once") + theme_classic() t2 <- plot_grid(v4, v5, v6, v7, labels = c('A', 'B', 'C', 'D'), ncol=2) -t2 + ggsave("thunder_links.png", dpi=300, dev='png', height=15, width=15, units="cm") +t2 + ggsave("thunder_links.png", dpi=300, dev='png', height=12, width=15, units="cm") diff --git a/scripts/Makefile b/scripts/Makefile index e5dcc75..3d13f2a 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -314,15 +314,15 @@ thunder_configure_2_full: thunder_configure_2_full_parse: @. parse_lib.sh && \ - parse_thunder thunder_configure_2 27 + parse_thunder thunder_configure_2 19 thunder_configure_2_full_parse_bw: @. parse_lib.sh && \ - parse_thunder_bw thunder_configure_2 27 + parse_thunder_bw thunder_configure_2 19 thunder_configure_2_full_parse_links: @. parse_lib.sh && \ - parse_thunder_links thunder_configure_2 27 + parse_thunder_links thunder_configure_2 19 tor_just_many_latencies: ./run-3 \ diff --git a/src/algo_thunder.c b/src/algo_thunder.c index 07b449e..4d11376 100644 --- a/src/algo_thunder.c +++ b/src/algo_thunder.c @@ -101,6 +101,7 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu to_fdinfo = NULL; do { thunderc->selected_link = (thunderc->selected_link + 1) % thunderc->total_links; + thunderc->to_increment[thunderc->selected_link]++; sprintf(url, "tcp:write:127.0.0.1:%d", 7500 + thunderc->selected_link); to_fdinfo = evt_core_get_from_url (ctx, url); } while (to_fdinfo == NULL && --protect2 >= 0); @@ -109,6 +110,9 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu goto schedule_release; } + // We let some time for blacklisted links to recover + if (is_blacklisted (thunderc, thunderc->selected_link) && thunderc->to_increment[thunderc->selected_link] < 10) continue; + //printf("URL %s has been retained\n", url); // 2. We create the packet template @@ -116,8 +120,10 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu .fmt.headers.cmd = CMD_LINK_MONITORING_THUNDER, .fmt.headers.size = thunderc->monit_pkt_size, .fmt.headers.flags = 0, + .fmt.content.link_monitoring_thunder.to_increment = thunderc->to_increment[thunderc->selected_link], .fmt.content.link_monitoring_thunder.links_status = {} }; + thunderc->to_increment[thunderc->selected_link] = 0; // 3. We append the template to the buffer struct buffer_packet* bp_dup = dup_buffer_tow (&app_ctx->br, bp, to_fdinfo); @@ -218,7 +224,7 @@ void classify(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct b // 1. Update link info int link_id = url_get_port_int(fdinfo->url) - 7500; - thunderc->received_pkts_on_link[link_id]++; + thunderc->received_pkts_on_link[link_id] += ap->fmt.content.link_monitoring_thunder.to_increment; //printf("Received %ld packets on link %d\n", thunderc->received_pkts_on_link[link_id], link_id); struct link_info *li = &ap->fmt.content.link_monitoring_thunder.links_status; @@ -407,9 +413,8 @@ void adapt(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buff delivered++; } - if (delivered != 1) { - //printf("[algo_thunder] Delivered %ld packets (now id=%d)\n", delivered, thunderc->recv_id); - } + + printf("[algo_thunder] Delivered %ld packets (now id=%d)\n", delivered, thunderc->recv_id); mv_buffer_rtof (&app_ctx->br, fdinfo); if (ctx->verbose > 1) fprintf(stderr, " [algo_thunder] Adapt done\n"); diff --git a/src/packet.h b/src/packet.h index 0a46c71..16a3279 100644 --- a/src/packet.h +++ b/src/packet.h @@ -57,6 +57,7 @@ union abstract_packet { union { struct { + uint8_t to_increment; struct link_info links_status; } link_monitoring_thunder; struct { diff --git a/src/proxy.h b/src/proxy.h index 69705f2..82cc68c 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -105,6 +105,7 @@ struct thunder_ctx { uint16_t emit_id; uint8_t selected_link; uint8_t total_links; + uint8_t to_increment[MAX_LINKS]; uint64_t delta_t_per_link[MAX_LINKS]; uint64_t rcv_delta_t_per_link[MAX_LINKS]; uint64_t received_pkts_on_link[MAX_LINKS];