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

New benchmark #730

Closed
wants to merge 8 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
83 changes: 83 additions & 0 deletions benchmarks/sleeping/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# MIT License

# Copyright (c) 2022 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.


clean: clean-proto


ROOT = ../../

FUNCTIONS = aes-go
ALL_IMAGES = $(addsuffix -image, $(FUNCTIONS))
ALL_LAMBDA_IMAGES = $(addsuffix -lambda-image, $(FUNCTIONS))

export AWS_REGION := ${AWS_REGION}
export AWS_ACCESS_KEY := ${AWS_ACCESS_KEY}
export AWS_SECRET_KEY := ${AWS_SECRET_KEY}
export AWS_ACCOUNT_ID := ${AWS_ACCOUNT_ID}

all: all-image all-lambda-image

all-image: $(ALL_IMAGES)

all-lambda-image: $(ALL_LAMBDA_IMAGES)


aes-go-image: docker/Dockerfile go/server.go
DOCKER_BUILDKIT=1 docker buildx build \
--tag vhiveease/aes-go:latest \
--target aesGo \
-f docker/Dockerfile \
$(ROOT) --load



aes-go-lambda-image: docker/Dockerfile.Lambda go/server.go
DOCKER_BUILDKIT=1 docker buildx build \
--tag $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/aes-go-lambda:latest \
--target aesGoLambda \
-f docker/Dockerfile.Lambda \
$(ROOT) --load

## Push images

push-%: %-image
docker push docker.io/kt05docker/$(subst push-,,$@):latest

push-%-lambda: %-lambda-image
aws ecr get-login-password --region $(AWS_REGION) | \
docker login --username AWS --password-stdin \
$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com
python $(ROOT)/runner/aws_lambda_scripts/aws_actions.py create_ecr_repo -n $(subst push-,,$@)
docker push $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/$(subst push-,,$@):latest

push: $(addprefix push-, $(FUNCTIONS)) $(addprefix push-, $(addsuffix -lambda, $(FUNCTIONS)))

## Pull images from docker hub

pull-%:
docker pull docker.io/kt05docker/$(subst pull-,,$@):latest

pull-%-lambda:
docker pull $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/$(subst pull-,,$@):latest

pull: $(addprefix pull-, $(FUNCTIONS)) $(addprefix pull-, $(addsuffix -lambda, $(FUNCTIONS)))
16 changes: 16 additions & 0 deletions benchmarks/sleeping/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

## Running this benchmark (using knative)

The detailed and general description on how to run benchmarks on knative clusters you can find [here](../../docs/running_benchmarks.md). The following steps show it on the aes-go function.
1. Build or pull the function images using `make all-image` or `make pull`.
2. Start the function with knative
```bash
kn service apply -f ./yamls/knative/kn-aes-go.yaml
```
3. **Note the URL provided in the output. The part without the `http://` we'll call `$URL`. Replace any instance of `$URL` in the code below with it.**
### Invoke once
4. In a new terminal, invoke the interface function with test-client.
```bash
./test-client --addr $URL:80 --name "Example text for AES"

```
47 changes: 47 additions & 0 deletions benchmarks/sleeping/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# MIT License

# Copyright (c) 2022 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.


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

COPY ./utils/tracing/go ../../utils/tracing/go
COPY ./benchmarks/sleeping/go/go.mod ./
COPY ./benchmarks/sleeping/go/go.sum ./
COPY ./benchmarks/sleeping/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 aesGo
WORKDIR /app/
COPY --from=aesGoBuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=aesGoBuilder /app/app/server .

ENTRYPOINT [ "/app/server" ]


EXPOSE 50051
43 changes: 43 additions & 0 deletions benchmarks/sleeping/docker/Dockerfile.Lambda
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# MIT License

# Copyright (c) 2022 Alan Nair and The vHive Ecosystem

# 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.

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

COPY ./utils/tracing/go ../../utils/tracing/go
COPY ./benchmarks/sleeping/go/go.mod ./
COPY ./benchmarks/sleeping/go/go.sum ./
COPY ./benchmarks/sleeping/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 aesGoLambda
WORKDIR /app/
COPY --from=aesGoLambdaBuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=aesGoLambdaBuilder /app/app/server .

ENTRYPOINT [ "/app/server" ]
53 changes: 53 additions & 0 deletions benchmarks/sleeping/go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// MIT License

// Copyright (c) 2022 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.

module aes

go 1.18

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

require (
github.com/aws/aws-lambda-go v1.41.0
github.com/sirupsen/logrus v1.9.0
github.com/vhive-serverless/vSwarm-proto v0.3.0
github.com/vhive-serverless/vSwarm/utils/tracing/go v0.0.0-00010101000000-000000000000
google.golang.org/grpc v1.49.0
)

require (
github.com/containerd/containerd v1.6.18 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/openzipkin/zipkin-go v0.4.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.33.0 // indirect
go.opentelemetry.io/otel v1.11.1 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.8.0 // indirect
go.opentelemetry.io/otel/sdk v1.8.0 // indirect
go.opentelemetry.io/otel/trace v1.11.1 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252 // indirect
google.golang.org/protobuf v1.28.0 // indirect
)
Loading