From ccb4043ffdfc6c206e778fa6fa47a52691699d0f Mon Sep 17 00:00:00 2001 From: Roger Ng Date: Thu, 29 Aug 2024 16:01:17 +0000 Subject: [PATCH] Add Docker compose files and benchmark to POSIX storage --- .github/workflows/benchmark.yml | 35 +++++++++++++++++++++ .github/workflows/benchmark_mysql.yml | 21 ------------- cmd/example-posix/docker/Dockerfile | 16 ++++++++++ cmd/example-posix/docker/compose.yaml | 44 +++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 21 deletions(-) create mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/benchmark_mysql.yml create mode 100644 cmd/example-posix/docker/Dockerfile create mode 100644 cmd/example-posix/docker/compose.yaml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 00000000..b07d0113 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,35 @@ +name: Benchmark + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + benchmark-mysql: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Start Tessera + run: docker compose -f ./cmd/example-mysql/docker/compose.yaml up --build --detach + - name: Run benchmark + run: go run ./hammer --log_public_key=Test-Betty+df84580a+AQQASqPUZoIHcJAF5mBOryctwFdTV1E0GRY4kEAtTzwB --log_url=http://localhost:2024 --max_read_ops=0 --num_writers=512 --max_write_ops=512 --max_runtime=1m --leaf_write_goal=2500 --show_ui=false + - name: Stop Tessera + if: ${{ always() }} + run: docker compose -f ./cmd/example-mysql/docker/compose.yaml down + + benchmark-posix: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Start Tessera + run: docker compose -f ./cmd/example-posix/docker/compose.yaml up --build --detach + - name: Run benchmark + run: go run ./hammer --log_public_key=example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx --log_url=http://localhost:2024 --write_log_url=http://localhost:2025 --max_read_ops=0 --num_writers=512 --max_write_ops=512 --max_runtime=1m --leaf_write_goal=2500 --show_ui=false + - name: Stop Tessera + if: ${{ always() }} + run: docker compose -f ./cmd/example-posix/docker/compose.yaml down diff --git a/.github/workflows/benchmark_mysql.yml b/.github/workflows/benchmark_mysql.yml deleted file mode 100644 index c7b6d50d..00000000 --- a/.github/workflows/benchmark_mysql.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Benchmark MySQL - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - benchmark-mysql: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - name: Start Tessera - run: docker compose -f ./cmd/example-mysql/docker/compose.yaml up --build --detach - - name: Run benchmark - run: go run ./hammer --log_public_key=Test-Betty+df84580a+AQQASqPUZoIHcJAF5mBOryctwFdTV1E0GRY4kEAtTzwB --log_url=http://localhost:2024 --max_read_ops=0 --num_writers=512 --max_write_ops=512 --max_runtime=1m --leaf_write_goal=2500 --show_ui=false - - name: Stop Tessera - if: ${{ always() }} - run: docker compose -f ./cmd/example-mysql/docker/compose.yaml down diff --git a/cmd/example-posix/docker/Dockerfile b/cmd/example-posix/docker/Dockerfile new file mode 100644 index 00000000..43e9f382 --- /dev/null +++ b/cmd/example-posix/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM golang:1.23.0-alpine3.19@sha256:fe8f9c7d418d3ac91787f11c31071c4814b6da5f9aae55bc581a7aacc264c395 AS build + +WORKDIR /build + +# pre-copy/cache go.mod for pre-downloading dependencies and only redownloading them in subsequent builds if they change +COPY go.mod go.sum ./ +RUN go mod download && go mod verify + +COPY . . +RUN CGO_ENABLED=0 go build -v ./cmd/example-posix + +FROM alpine:3.20@sha256:0a4eaa0eecf5f8c050e5bba433f58c052be7587ee8af3e8b3910ef9ab5fbe9f5 + +COPY --from=build /build/example-posix / + +ENTRYPOINT ["/example-posix"] diff --git a/cmd/example-posix/docker/compose.yaml b/cmd/example-posix/docker/compose.yaml new file mode 100644 index 00000000..2cba03f8 --- /dev/null +++ b/cmd/example-posix/docker/compose.yaml @@ -0,0 +1,44 @@ +services: + + tessera-example-posix-read-proxy: + container_name: tessera-example-posix-read-proxy + image: "busybox:stable" + ports: + - "2024:2024" + command: [ + "/bin/busybox", + "httpd", + "-f", + "-p", + "2024", + "-h", + "/tmp/tessera-posix-log" + ] + volumes: + - tiles:/tmp/tessera-posix-log + restart: always + + tessera-example-posix: + container_name: tessera-example-posix + build: + context: ../../../ + dockerfile: ./cmd/example-posix/docker/Dockerfile + ports: + - "2025:2025" + environment: + LOG_PRIVATE_KEY: "PRIVATE+KEY+example.com/log/testdata+33d7b496+AeymY/SZAX0jZcJ8enZ5FY1Dz+wTML2yWSkK+9DSF3eg" + LOG_PUBLIC_KEY: "example.com/log/testdata+33d7b496+AeHTu4Q3hEIMHNqc6fASMsq3rKNx280NI+oO5xCFkkSx" + command: [ + "--storage_dir=/tmp/tessera-posix-log", + "--initialise", + "--listen=:2025", + "--alsologtostderr", + "--v=2", + ] + volumes: + - tiles:/tmp/tessera-posix-log + restart: always + +volumes: + tiles: + name: "tiles"