Skip to content

Commit

Permalink
feat(Anna): Load test setup. (#1508)
Browse files Browse the repository at this point in the history
I created a load-testing binary with an in-process network—deployed and
tested with five threads @ one request per second per thread.
  • Loading branch information
rohitkulshreshtha authored Oct 29, 2024
1 parent e89af7f commit cf64859
Show file tree
Hide file tree
Showing 21 changed files with 386 additions and 65 deletions.
105 changes: 89 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions datastores/gossip_kv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ publish = false
[dependencies]
clap = { version = "4.5.4", features = ["derive"] }
config = "0.14.0"
governor = "0.7.0"
hostname = "0.4.0"
hydroflow = { path="../../hydroflow" }
lattices = { path = '../../lattices'}
Expand All @@ -31,10 +32,14 @@ warp = "0.3.7"
name = "gossip_server"
path = "server/main.rs"

[[bin]]
name = "load_test_server"
path = "load_test_server/server.rs"

[[bin]]
name = "gossip_cli"
path = "cli/main.rs"

[lib]
name = "gossip_protocol"
path = "protocol/lib.rs"
name = "gossip_kv"
path = "kv/lib.rs"
28 changes: 12 additions & 16 deletions datastores/gossip_kv/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,23 @@ MINIKUBE_MEMORY:=32768
BASE_IMAGE_VERSION:=latest
SERVER_IMAGE_VERSION:=latest
CLI_IMAGE_VERSION:=latest
LOAD_TEST_IMAGE_VERSION:=latest

# Docker Image Tags
BASE_IMAGE_TAG:=hydroflow-gossip-kv-base-image:$(BASE_IMAGE_VERSION)
SERVER_IMAGE_TAG:=hydroflow-gossip-kv-server:$(SERVER_IMAGE_VERSION)
CLI_IMAGE_TAG:=hydroflow-gossip-kv-cli:$(CLI_IMAGE_VERSION)
LOAD_TEST_IMAGE_TAG:=hydroflow-gossip-kv-load-test:$(LOAD_TEST_IMAGE_VERSION)

AWS_TERRAFORM_PATH=../../datastores/gossip_kv/server/deployment/aws/terraform

# Define color variables
COLOR_RESET = \033[0m
COLOR_GREEN = \033[1;32m
COLOR_BLUE = \033[1;34m
COLOR_RED = \033[1;31m

# Define custom echo functions for different colors
greentext = @echo "$(COLOR_GREEN)$(1)$(COLOR_RESET)"
bluetext = @echo "$(COLOR_BLUE)$(1)$(COLOR_RESET)"
redtext = @echo "$(COLOR_RED)$(1)$(COLOR_RESET)"

# Default target when you run 'make'
AWS_TERRAFORM_PATH=../../datastores/gossip_kv/deployment/aws/terraform

# Target to start Minikube with specific options
start_minikube:
minikube start --disk-size=$(MINIKUBE_DISK_SIZE) --cpus=$(MINIKUBE_CPUS) --memory=$(MINIKUBE_MEMORY)
@echo "Please run 'eval \$$(minikube docker-env)' to use the Minikube Docker daemon"

# Target to build the Docker images
build_docker_images: build_base_image build_server_image build_cli_image
build_docker_images: build_base_image build_server_image build_cli_image build_load_test_image

build_base_image:
docker build -t "$(BASE_IMAGE_TAG)" -f ../../datastores/gossip_kv/server/baseimage.Dockerfile ../..
Expand All @@ -46,6 +35,9 @@ build_server_image:
build_cli_image:
docker build -t "$(CLI_IMAGE_TAG)" -f ../../datastores/gossip_kv/cli/Dockerfile ../..

build_load_test_image:
docker build -t "$(LOAD_TEST_IMAGE_TAG)" -f ../../datastores/gossip_kv/load_test_server/Dockerfile ../..

# Target to clean up the Minikube cluster
clean_local:
minikube delete
Expand All @@ -70,13 +62,17 @@ aws_setup_kubectl:
aws_upload_docker_images: build_docker_images
$(eval SERVER_REPO_URL := $(shell terraform -chdir=$(AWS_TERRAFORM_PATH) output -json repository_urls | jq -r '.["gossip_kv_server"]'))
$(eval CLI_REPO_URL := $(shell terraform -chdir=$(AWS_TERRAFORM_PATH) output -json repository_urls | jq -r '.["gossip_kv_cli"]'))
$(eval LOAD_TEST_REPO_URL := $(shell terraform -chdir=$(AWS_TERRAFORM_PATH) output -json repository_urls | jq -r '.["gossip_kv_load_test"]'))
$(eval REGION := $(shell terraform -chdir=$(AWS_TERRAFORM_PATH) output -raw region))
docker tag $(SERVER_IMAGE_TAG) $(SERVER_REPO_URL):$(SERVER_IMAGE_VERSION)
docker tag $(CLI_IMAGE_TAG) $(CLI_REPO_URL):$(CLI_IMAGE_VERSION)
docker tag $(LOAD_TEST_IMAGE_TAG) $(LOAD_TEST_REPO_URL):$(LOAD_TEST_IMAGE_VERSION)
aws ecr get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(SERVER_REPO_URL)
docker push $(SERVER_REPO_URL):$(SERVER_IMAGE_VERSION)
aws ecr get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(SERVER_REPO_URL)
aws ecr get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(CLI_REPO_URL)
docker push $(CLI_REPO_URL):$(CLI_IMAGE_VERSION)
aws ecr get-login-password --region $(REGION) | docker login --username AWS --password-stdin $(LOAD_TEST_REPO_URL)
docker push $(LOAD_TEST_REPO_URL):$(LOAD_TEST_IMAGE_VERSION)

aws_tunnel_grafana:
$(eval GRAFANA_PORT := $(shell terraform -chdir=$(AWS_TERRAFORM_PATH) output -raw grafana_port))
Expand Down
2 changes: 1 addition & 1 deletion datastores/gossip_kv/cli/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::net::SocketAddr;

use clap::{CommandFactory, Parser, Subcommand};
use gossip_protocol::{ClientRequest, ClientResponse, Key};
use gossip_kv::{ClientRequest, ClientResponse, Key};
use hydroflow::util::{bind_udp_bytes, ipv4_resolve};
use hydroflow::{hydroflow_syntax, tokio, DemuxEnum};
use tracing::error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module "irsa-ebs-csi" {
variable "ecr_repositories" {
description = "List of ECR repository names"
type = list(string)
default = ["gossip_kv_server", "gossip_kv_cli"]
default = ["gossip_kv_server", "gossip_kv_cli", "gossip_kv_load_test"]
}

module "ecr" {
Expand Down Expand Up @@ -158,7 +158,7 @@ resource "kubernetes_stateful_set" "gossip_kv_seed_nodes" {

spec {
service_name = "gossip-kv-seed-nodes"
replicas = 3
replicas = 1

selector {
match_labels = {
Expand All @@ -182,7 +182,7 @@ resource "kubernetes_stateful_set" "gossip_kv_seed_nodes" {

container {
name = "gossip-kv-server"
image = "${module.ecr.gossip_kv_server.repository_url}:latest"
image = "${module.ecr.gossip_kv_load_test.repository_url}:latest"
image_pull_policy = "Always"

env {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
pub mod membership;
pub mod model;

pub mod server;

pub mod lattices;

pub mod util;

use std::collections::HashSet;
use std::fmt::Display;
use std::str::FromStr;
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit cf64859

Please sign in to comment.