From ebbf9424690d331c38abdb789adf18baf8f7dff6 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 17 Sep 2019 15:12:37 +0200 Subject: [PATCH] Better link usage! --- r/thunder_configure.R | 54 +++++++++++++++++++++++++++++++++++++++---- src/donar_client.c | 4 ++-- src/donar_client.h | 2 +- src/donar_server.c | 10 ++++---- src/donar_server.h | 2 +- 5 files changed, 58 insertions(+), 14 deletions(-) diff --git a/r/thunder_configure.R b/r/thunder_configure.R index 99c7afd..30c55ea 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_16.csv") +thunder_ms <- read.csv("thunder_configure_17.csv") thunder_ms <- sqldf("select run,ident,jmax,links,latency, CAST(latency as real) / 1000. as lat_ms from thunder_ms") thunder_ms$links <- as.factor(thunder_ms$links) @@ -17,9 +17,9 @@ v1 <- ggplot(data = thunder_ms, aes(x = jmax, y=lat_ms, fill=links)) + annotate("text", x=7, y=550, label= "high", color="DarkGreen") + annotate("text", x=7, y=1000, label= "acceptable", color="red") + coord_cartesian(xlim = c(1, 7)) + - ylim(0,1000) + + #ylim(0,1000) + scale_fill_grey() + - #scale_y_log10() + + scale_y_log10() + ylab("latency (ms)") + xlab("max allowed jitter") + theme_classic() @@ -37,7 +37,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_16_bw.csv") +thunder_bw <- read.csv("thunder_configure_17_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) @@ -84,6 +84,7 @@ where will_change='True' v5 <- ggplot(data = downtime, aes(x=sorting, y=dur)) + geom_violin() + + geom_boxplot(width=0.1, outlier.shape = NA) + scale_y_log10() + ylab("Downtime (in sec)") + xlab("Sorted links") + @@ -121,6 +122,7 @@ select down_link_count, 1.0*durations_global/1000 as dur from gobal_links where 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() + + geom_boxplot(width=0.1, outlier.shape = NA) + scale_y_log10() + ylab("Downtime (in sec)") + xlab("Number of links down at once") + @@ -140,8 +142,50 @@ where ") latency_evol$sorting <- as.factor(latency_evol$sorting) -ggplot(data=latency_evol, aes(x=ident,y=lat_ms)) + +v8 <- ggplot(data=latency_evol, aes(x=ident,y=lat_ms)) + geom_line() + + xlab("Call duration") + + 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 '%-24' ") +#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) + +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") + + xlab("Call duration") + + scale_fill_grey() + theme_classic() +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") +tdb_ag_2 <- sqldf("select run,count,oc,row_number() OVER (partition by count order by run) as sorting from tdb_ag") +tdb_ag_2$sorting <- as.factor(tdb_ag_2$sorting) +tdb_ag_2$count <- as.factor(tdb_ag_2$count) + +v10 <- ggplot(data = tdb_ag_2, aes(x=count, y=oc, fill=sorting)) + + geom_bar(stat="summary",position = "dodge") + + #grom_bar() + + #scale_y_log10() + + scale_y_continuous() + + ylab("Occurence") + + xlab("Packets dropped in a row") + + scale_fill_grey() + + theme_classic() + +thunder_red <- read.csv("thunder_configure_16_red.csv") +tred <- sqldf("select * from thunder_red WHERE run LIKE '%-24'") + +t3 <- plot_grid(v8, v9, v10, labels = c('A', 'B', 'C'), ncol=2) diff --git a/src/donar_client.c b/src/donar_client.c index 14314af..a175467 100644 --- a/src/donar_client.c +++ b/src/donar_client.c @@ -92,10 +92,10 @@ void donar_client(struct donar_client_ctx* ctx, struct donar_params* dp) { init_socks5_sinks(ctx); printf("--- Socks5 connection process started\n"); - load_onion_services (ctx, dp->onion_file, CLIENT_PORT_SIZE); + load_onion_services (ctx, dp->onion_file, dp->links); printf("--- Onion services loaded\n"); - for (int i = 0; i < CLIENT_PORT_SIZE; i++) { + for (int i = 0; i < dp->links; i++) { init_socks5_client(ctx, i); } printf("--- TCP Clients Connected\n"); diff --git a/src/donar_client.h b/src/donar_client.h index 32d188d..ad44f12 100644 --- a/src/donar_client.h +++ b/src/donar_client.h @@ -7,7 +7,7 @@ #include "proxy.h" #include "donar_init.h" -#define CLIENT_PORT_SIZE 8 +#define CLIENT_PORT_SIZE 64 struct donar_client_ctx { struct tor_os_str tos; diff --git a/src/donar_server.c b/src/donar_server.c index 2208fa0..bfb1729 100644 --- a/src/donar_server.c +++ b/src/donar_server.c @@ -22,7 +22,7 @@ void destroy_resources(struct tor_os_str* tos, struct tor_ctl* tctl) { tor_os_free (tos); } -void init_tcp_servers(struct donar_server_ctx* ctx) { +void init_tcp_servers(struct donar_server_ctx* ctx, int nlinks) { char url[1024]; struct evt_core_cat cat = {0}; struct evt_core_fdinfo fdinfo = {0}; @@ -31,7 +31,7 @@ void init_tcp_servers(struct donar_server_ctx* ctx) { char buffer[6]; int err, sock = 0; - for (int i = 0; i < PORT_SIZE; i++) { + for (int i = 0; i < nlinks; i++) { sprintf (buffer, "%d", ctx->ports[i]); //@FIXME shouldn't listen on 0.0.0.0 but 127.13.3.7 is not compatible with docker sock = create_tcp_server ("0.0.0.0", buffer); @@ -70,13 +70,13 @@ void donar_server(struct donar_server_ctx* ctx, struct donar_params* dp) { algo_main_init(&ctx->evts, &ap); printf("--- Algorithm initialized\n"); - for (uint16_t i = 0; i < PORT_SIZE ; i++) { + for (uint16_t i = 0; i < dp->links ; i++) { ctx->ports[i] = 7500 + i; } - create_onion_services (&(ctx->tos), &(ctx->tctl), ctx->ports, PORT_SIZE, dp->tof); + create_onion_services (&(ctx->tos), &(ctx->tctl), ctx->ports, dp->links, dp->tof); printf("--- Onion services created\n"); - init_tcp_servers(ctx); + init_tcp_servers(ctx, dp->links); printf("--- TCP servers are listening\n"); g_ptr_array_foreach (dp->remote_ports, (void(*)(void*, void*))init_udp_remote, &(ctx->evts)); diff --git a/src/donar_server.h b/src/donar_server.h index 37e9404..44dd245 100644 --- a/src/donar_server.h +++ b/src/donar_server.h @@ -11,7 +11,7 @@ #include "donar_init.h" #include "proxy.h" -#define PORT_SIZE 8 +#define PORT_SIZE 64 struct donar_server_ctx { struct tor_os_str tos;