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

Files for image-rotate benchmark #1003

Merged
merged 2 commits into from
Jul 23, 2024
Merged
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
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
benchmarks/gg/examples/excamera/drop.avi filter=lfs diff=lfs merge=lfs -text
benchmarks/gg/examples/llvm/llvm.tar.gz filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img12.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img15.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img1.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img8.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img11.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img2.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/default.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img13.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img4.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img5.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img6.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img7.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img9.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img10.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img16.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img17.jpg filter=lfs diff=lfs merge=lfs -text
benchmarks/image-rotate/images/img3.jpg filter=lfs diff=lfs merge=lfs -text
9 changes: 5 additions & 4 deletions .github/workflows/e2e-image-rotate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ jobs:

- name: Check if service is ready
run: |
kubectl wait --for=condition=Ready -f ${{ env.YAML_DIR }}/kn-${{ matrix.service }}.yaml --timeout 120s
kubectl wait --for=condition=Ready -f ${{ env.YAML_DIR }}/kn-${{ matrix.service }}.yaml --timeout 180s
kubectl get service
kubectl get -f ${{ env.YAML_DIR }}/kn-${{ matrix.service }}.yaml

Expand All @@ -187,10 +187,11 @@ jobs:
if: ${{ always() }}
run: |
set -x
container_list=$(kubectl get pods -n default -o jsonpath="{.items[*].spec.containers[*].name}")
for container_name in $container_list

pod_list=$(kubectl get pods -n default -o jsonpath="{.items[*].name}")
for pod in $pod_list
do
kubectl logs -n default -c $container_name -l serving.knative.dev/service=${{ matrix.service }}
kubectl logs $pod
done

- name: Print logs from database
Expand Down
58 changes: 58 additions & 0 deletions benchmarks/image-rotate/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# MIT License

# Copyright (c) 2024 EASE lab

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

ROOT = ../../

all-image: image-rotate-python image-rotate-go init-database

image-rotate-python: docker/Dockerfile python/server.py python/requirements.txt images/default.jpg
DOCKER_BUILDKIT=1 docker build \
--tag vhiveease/image-rotate-python:latest \
--target imageRotatePython \
-f docker/Dockerfile \
$(ROOT) --load

image-rotate-go: docker/Dockerfile go/server.go go/go.mod go/go.sum images/default.jpg
DOCKER_BUILDKIT=1 docker build \
--tag vhiveease/image-rotate-go:latest \
--target imageRotateGo \
-f docker/Dockerfile \
$(ROOT) --load

init-database: docker/Dockerfile init/init-database.go images/default.jpg
DOCKER_BUILDKIT=1 docker build \
--tag vhiveease/image-rotate-init-database:latest \
--target databaseInit \
-f docker/Dockerfile \
$(ROOT) --load

## Push images
push:
docker push docker.io/vhiveease/image-rotate-init-database:latest
docker push docker.io/vhiveease/image-rotate-python:latest
docker push docker.io/vhiveease/image-rotate-go:latest

## Pull images from docker hub
pull:
docker pull docker.io/vhiveease/image-rotate-python:latest
docker pull docker.io/vhiveease/image-rotate-go:latest
docker pull docker.io/vhiveease/image-rotate-init-database:latest
87 changes: 87 additions & 0 deletions benchmarks/image-rotate/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# MIT License

# Copyright (c) 2024 EASE lab

# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

#---------- Init-Database -----------#
# First stage (Builder):
FROM vhiveease/golang-builder:latest AS databaseInitBuilder
WORKDIR /app/app/
RUN apt-get install git ca-certificates

COPY ./benchmarks/image-rotate/init/go.mod ./
COPY ./benchmarks/image-rotate/init/go.sum ./
COPY ./benchmarks/image-rotate/init/init-database.go ./

RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -v -o ./init-database init-database.go

# Second stage (Runner):
FROM scratch as databaseInit
WORKDIR /app/
COPY --from=databaseInitBuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=databaseInitBuilder /app/app/init-database .
COPY ./benchmarks/image-rotate/images/ ./images

ENTRYPOINT [ "/app/init-database" ]


#---------- PYTHON -----------#
# First stage (Builder):
# Install gRPC and all other dependencies
FROM vhiveease/python-slim:latest as imageRotatePythonBuilder
WORKDIR /py
COPY ./benchmarks/image-rotate/python/requirements.txt ./requirements.txt
RUN pip3 install --user -r requirements.txt
COPY ./utils/tracing/python/tracing.py ./
COPY ./benchmarks/image-rotate/python/server.py ./
ADD https://raw.githubusercontent.com/vhive-serverless/vSwarm-proto/newfuncs_v0.1.1/proto/image_rotate/image_rotate_pb2_grpc.py ./
ADD https://raw.githubusercontent.com/vhive-serverless/vSwarm-proto/newfuncs_v0.1.1/proto/image_rotate/image_rotate_pb2.py ./proto/image_rotate/

# Second stage (Runner):
FROM vhiveease/python-slim:latest as imageRotatePython
COPY --from=imageRotatePythonBuilder /root/.local /root/.local
COPY --from=imageRotatePythonBuilder /py /app
WORKDIR /app
# ENV PATH=/root/.local/bin:$PATH
ENTRYPOINT [ "python3", "/app/server.py" ]


#---------- GoLang -----------#
# First stage (Builder):
FROM vhiveease/golang-builder:latest AS imageRotateGoBuilder
WORKDIR /app/app/
RUN apt-get install git ca-certificates

COPY ./utils/tracing/go ../../utils/tracing/go
COPY ./benchmarks/image-rotate/go/go.mod ./
COPY ./benchmarks/image-rotate/go/go.sum ./
COPY ./benchmarks/image-rotate/go/server.go ./

RUN go mod tidy
RUN CGO_ENABLED=0 GOOS=linux go build -v -o ./server server.go

# Second stage (Runner):
FROM scratch as imageRotateGo
WORKDIR /app/
COPY --from=imageRotateGoBuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=imageRotateGoBuilder /app/app/server .

ENTRYPOINT [ "/app/server" ]
59 changes: 59 additions & 0 deletions benchmarks/image-rotate/go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

module imagerotate

go 1.21

replace github.com/vhive-serverless/vSwarm/utils/tracing/go => ../../../utils/tracing/go

require (
github.com/disintegration/imaging v1.6.2
github.com/sirupsen/logrus v1.9.3
github.com/vhive-serverless/vSwarm-proto v0.5.1-0.20240307061327-389a954e629c
github.com/vhive-serverless/vSwarm/utils/tracing/go v0.0.0-20231030155054-d3b2e7d0ff16
go.mongodb.org/mongo-driver v1.15.0
google.golang.org/grpc v1.63.2
)

require (
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
github.com/openzipkin/zipkin-go v0.4.3 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.51.0 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.26.0 // indirect
go.opentelemetry.io/otel/metric v1.26.0 // indirect
go.opentelemetry.io/otel/sdk v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 // indirect
google.golang.org/protobuf v1.34.1 // indirect
)
Loading
Loading