benchmarks/rpc-amplification.R

98 lines
3.9 KiB
R
Executable File

#!/usr/bin/env Rscript
system("mkdir -p ~/R")
.libPaths(c("~/R", .libPaths()))
repo <- "https://cran.r-project.org"
if (!require(tidyverse)) install.packages("tidyverse", repos=repo); library(tidyverse)
if (!require(svglite)) install.packages("svglite", repos=repo); library(svglite)
system("mkdir -p $HOME/.local/bin")
Sys.getenv("HOME") -> home
Sys.setenv(PATH = paste(paste(home, "/go/bin", sep=""), paste(home, "/.local/bin", sep=""), Sys.getenv("PATH"), sep=":"))
system("echo $PATH")
if (!file.exists("~/.local/bin/garage")) {
system("wget https://garagehq.deuxfleurs.fr/_releases/v0.5.0/x86_64-unknown-linux-musl/garage -O $HOME/.local/bin/garage")
system("chmod +x $HOME/.local/bin/garage")
}
if (!file.exists("~/.local/bin/minio")) {
# The following link will expire when this artifact will be moved to the archive/ folder.
# When it will fail, go to the parent directory of this URL, then select archive, and replace with the new URL.
system("wget https://dl.min.io/server/minio/release/linux-amd64/minio.RELEASE.2021-11-24T23-19-33Z -O $HOME/.local/bin/minio")
system("chmod +x $HOME/.local/bin/minio")
}
if (!file.exists("~/.local/bin/mknet")) {
system("pip3 install --user git+https://git.deuxfleurs.fr/quentin/mknet")
}
if (!file.exists("~/go/bin/s3lat")) {
system("go install git.deuxfleurs.fr/quentin/s3lat@latest")
}
Sys.getenv("MKNET_DC") -> mknet_dc
if (mknet_dc == "") {
"./mknet/single-dc.yml" -> mknet_dc
}
if (!file.exists("50ms.garage.csv")) {
system("rm -fr /tmp/garage-testnet")
if (file.exists(".current_state.yml")) {
system("mknet destroy")
}
system(paste("mknet create", mknet_dc))
system("mknet run-all ./mknet/deploy_garage.sh")
system("mknet run dc1:dc1s1 ./mknet/bench_garage.sh")
system("mknet destroy")
print("sleeping for 5 secs to wait for teardown")
Sys.sleep(5)
}
if (!file.exists("50ms.minio.csv")) {
if (file.exists(".current_state.yml")) {
system("mknet destroy")
}
system(paste("mknet create", mknet_dc))
system("mknet run-all ./mknet/deploy_minio.py")
system("mknet run dc1:dc1s1 ./mknet/bench_minio.sh")
system("mknet destroy")
}
read_csv("50ms.garage.csv") %>% add_column(daemon="garage 0.5.0") -> a
read_csv("50ms.minio.csv") %>% add_column(daemon="minio RELEASE.2021-11-24T23-19-33Z") -> b
bind_rows(a,b) %>% group_by(daemon,endpoint) %>% summarise(
time_mean = mean(nanoseconds) / 1000 / 1000,
time_max = max(nanoseconds) / 1000 / 1000,
time_min = min(nanoseconds) / 1000 / 1000
) -> c
mknet_dc -> st
if (st == "./mknet/single-dc.yml") {
st <- "100 measurements, 5 nodes, 100ms RTT + 20ms jitter between nodes\nno contention: latency is due to intra-cluster communications\ncolored bar = mean latency, error bar = min and max latency"
} else if (st == "./mknet/multi-dc.yml") {
st <- "100 measurements, 6 nodes in 3 DC (2 nodes/DC), 100ms RTT + 20ms jitter between DC\nno contention: latency is due to intra-cluster communications\ncolored bar = mean latency, error bar = min and max latency"
} else if (st == "./mknet/with-vdsl.yml") {
st <- "100 measurements, 5 nodes in 3 zones (2 VDSL and 1 fiber), check ./mknet/with-vdsl.yml\nno contention: latency is due to intra-cluster communications\ncolored bar = mean latency, error bar = min and max latency"
}
ggplot(c, aes(x=endpoint,y=time_mean,fill=daemon,ymin=time_min,ymax=time_max)) +
geom_bar(stat="identity", position=position_dodge(),color="black") +
geom_errorbar(position=position_dodge(.9),width=.2) +
scale_y_continuous(expand=c(0,0))+
coord_flip() +
labs(
x="S3 Endpoint",
y="Latency (ms)",
fill="Daemon",
caption="Get the code to reproduce this graph at https://git.deuxfleurs.fr/quentin/benchmarks",
title="S3 endpoint latency in a simulated geo-distributed cluster",
subtitle=st) +
theme_classic() +
theme(legend.position = c(.8, .3))
ggsave("png/rpc-amplification.png", width=200, height=110, units="mm")