Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add providerdelay experiment #29

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions experiments/providerdelay/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
set -euo pipefail
# set -x

EXP_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
CONFIGS="$EXP_DIR/image/configs/*.sh"
DOCKER_REPO=147263665150.dkr.ecr.eu-west-1.amazonaws.com
KUBO_IMAGE_NAME=thunderdome:providerdelay-kubo
KUBO_IMAGE=$DOCKER_REPO/$KUBO_IMAGE_NAME

WORKDIR=$(mktemp -d)
if [ ! -e "$WORKDIR" ]; then
>&2 echo "Failed to create temp directory"
exit 1
fi

trap 'rm -rf "$WORKDIR"' EXIT

echo "Using work directory $WORKDIR"
cd "$WORKDIR"
git clone https://github.com/iand/go-ipfs.git kubo

cd kubo
git switch feat/remove-provider-search-delay
docker build -t $KUBO_IMAGE_NAME .

aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin $DOCKER_REPO

docker tag $KUBO_IMAGE_NAME $KUBO_IMAGE
docker push $KUBO_IMAGE


cd "$EXP_DIR"

for cf in $CONFIGS
do
if [ -f "$cf" ]
then
file=${cf##*/}
name=${file%.sh}
# Build and push image
echo Building thunderdome:$name
docker build --build-arg config=$file --build-arg kuboimage=$KUBO_IMAGE -t thunderdome:$name image/
docker tag thunderdome:$name $DOCKER_REPO/thunderdome:$name
docker push $DOCKER_REPO/thunderdome:$name
else
>&2 echo "\"$cf\" was not a file"
exit 1
fi

done
9 changes: 9 additions & 0 deletions experiments/providerdelay/image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG kuboimage
FROM $kuboimage

ADD /container-init.d/* /container-init.d/
ARG config
ADD /configs/$config /container-init.d/
RUN chmod a+x /container-init.d/*

EXPOSE 8080
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '0'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '1000ms'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '100ms'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '200ms'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '20ms'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '500ms'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '50ms'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ipfs config --json Internal.Bitswap.ProviderSearchDelay '750ms'
33 changes: 33 additions & 0 deletions experiments/providerdelay/image/container-init.d/base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
## The shell in the go-ipfs container is busybox, so a version of ash
## Shellcheck might warn on things POSIX sh cant do, but ash can
## In Shellcheck, ash is an alias for dash, but busybox ash can do more than dash
## https://github.com/koalaman/shellcheck/blob/master/src/ShellCheck/Data.hs#L134
echo "setting config"
ipfs config --json AutoNAT '{
"ServiceMode": "enabled",
"Throttle": {
"GlobalLimit": 0,
"Interval": "1m",
"PeerLimit": 3
}
}'

ipfs config --json Datastore.BloomFilterSize '268435456'
ipfs config --json Datastore.StorageGCWatermark 90
ipfs config --json Datastore.StorageMax '"200GB"'
ipfs config --json Datastore.GCPeriod '"10m"'

ipfs config --json Pubsub.StrictSignatureVerification false

ipfs config --json Reprovider.Interval '"0"'

ipfs config --json Routing.Type '"dhtserver"'

ipfs config --json Swarm.ConnMgr.GracePeriod '"2m"'
ipfs config --json Swarm.ConnMgr.HighWater 5000
ipfs config --json Swarm.ConnMgr.LowWater 3000
ipfs config --json Swarm.ConnMgr.DisableBandwidthMetrics true

ipfs config --json Experimental.AcceleratedDHTClient true
ipfs config --json Experimental.StrategicProviding true
48 changes: 48 additions & 0 deletions experiments/providerdelay/image/container-init.d/gw-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
## The shell in the go-ipfs container is busybox, so a version of ash
## Shellcheck might warn on things POSIX sh cant do, but ash can
## In Shellcheck, ash is an alias for dash, but busybox ash can do more than dash
## https://github.com/koalaman/shellcheck/blob/master/src/ShellCheck/Data.hs#L134
echo "setting Gateway config"
ipfs config --json Gateway '{
"HTTPHeaders": {
"Access-Control-Allow-Origin": [
"*"
]
},
"RootRedirect": "",
"Writable": false,
"APICommands": [],
"NoFetch": false,
"NoDNSLink": false,
"PublicGateways": {
"dweb.link": {
"NoDNSLink": false,
"Paths": [
"/ipfs",
"/ipns",
"/api"
],
"UseSubdomains": true
},
"gateway.ipfs.io": {
"NoDNSLink": false,
"Paths": [
"/ipfs",
"/ipns",
"/api"
],
"UseSubdomains": false
},
"ipfs.io": {
"NoDNSLink": false,
"Paths": [
"/ipfs",
"/ipns",
"/api"
],
"UseSubdomains": false
}
}
}'

53 changes: 53 additions & 0 deletions tf/experiments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,59 @@ module "peering" {
}
}

module "providerdelay" {
source = "./modules/experiment"
name = "providerdelay"

ecs_cluster_id = module.ecs.cluster_id
vpc_subnets = module.vpc.public_subnets
security_groups = [aws_security_group.target.id]
execution_role_arn = aws_iam_role.ecsTaskExecutionRole.arn
log_group_name = aws_cloudwatch_log_group.logs.name
aws_service_discovery_private_dns_namespace_id = aws_service_discovery_private_dns_namespace.main.id
grafana_secrets = [
{ name = "GRAFANA_USER", valueFrom = "${data.aws_secretsmanager_secret.grafana-push-secret.arn}:username::" },
{ name = "GRAFANA_PASS", valueFrom = "${data.aws_secretsmanager_secret.grafana-push-secret.arn}:password::" }
]

shared_env = [
{ name = "IPFS_PROFILE", value = "server" },
]

targets = {
"providerdelay-0ms" = {
image = "147263665150.dkr.ecr.eu-west-1.amazonaws.com/thunderdome:providerdelay-0ms"
environment = []
}
"providerdelay-20ms" = {
image = "147263665150.dkr.ecr.eu-west-1.amazonaws.com/thunderdome:providerdelay-20ms"
environment = []
}
"providerdelay-50ms" = {
image = "147263665150.dkr.ecr.eu-west-1.amazonaws.com/thunderdome:providerdelay-50ms"
environment = []
}
"providerdelay-100ms" = {
image = "147263665150.dkr.ecr.eu-west-1.amazonaws.com/thunderdome:providerdelay-100ms"
environment = []
}
"providerdelay-200ms" = {
image = "147263665150.dkr.ecr.eu-west-1.amazonaws.com/thunderdome:providerdelay-200ms"
environment = []
}
"providerdelay-500ms" = {
image = "147263665150.dkr.ecr.eu-west-1.amazonaws.com/thunderdome:providerdelay-500ms"
environment = []
}
"providerdelay-1000ms" = {
image = "147263665150.dkr.ecr.eu-west-1.amazonaws.com/thunderdome:providerdelay-1000ms"
environment = []
}
}
}



resource "aws_security_group" "target" {
name = "target"
vpc_id = module.vpc.vpc_id
Expand Down