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

Chained functions serving microbenchmark #250

Merged
merged 3 commits into from
Jun 11, 2021
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
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ updates:
directory: "/"
schedule:
interval: "weekly"

updates:
- package-ecosystem: “gomod”
directory: “/function-images/tests/chained-function-serving”
schedule:
interval: “weekly”
2 changes: 1 addition & 1 deletion .github/workflows/build_docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
git lfs pull
- name: docker build images
run: |
DOCKER_BUILDKIT=1 docker build --file ./scripts/github_runner/Dockerfile.${{ matrix.image }} .
DOCKER_BUILDKIT=1 docker build --file ./scripts/github_runner/Dockerfile.${{ matrix.image }} .
95 changes: 95 additions & 0 deletions .github/workflows/function-composition.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Function composition tests

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

env:
GOOS: linux
GO111MODULE: on

jobs:
docker-compose:
name: Serving uBench (docker-compose)
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v2

- name: Setup grpcurl
run: |
wget -qO- https://github.com/fullstorydev/grpcurl/releases/download/v1.8.1/grpcurl_1.8.1_linux_x86_64.tar.gz | sudo tar -C /usr/bin/ -xz grpcurl

- name: start multi-container program with docker-compose
run: |
cd ./function-images/tests/chained-function-serving/
docker-compose up &> log_file &
sleep 15s
- name: invoke the chain
run: |
grpcurl -plaintext localhost:3031 helloworld.Greeter.SayHello
- name: show docker-compose log
run: cat ./function-images/tests/chained-function-serving/log_file

knative:
name: Serving uBench (knative)
env:
GITHUB_RUN_ID: ${{ github.run_id }}
LOGPATH: /tmp/uBench-logs/${{ github.run_id }}
GOCACHE: /root/tmp/gocache
GOPATH: /root/tmp/gopath
runs-on: [self-hosted, cri]
strategy:
fail-fast: false
steps:

- name: Set up Golang
uses: actions/setup-go@v2
with:
go-version: 1.15

- name: Setup LOGPATH
run: |
mkdir -p /tmp/uBench-logs/${{ github.run_id }}

- name: Host Info
run: |
echo $HOSTNAME
echo $GITHUB_RUN_ID
echo $LOGPATH

- uses: actions/checkout@v2

- name: Start containerd
run: sudo containerd 1>$LOGPATH/uBench.out 2>$LOGPATH/uBench.err &

- name: Start one-node cluster
run : |
./scripts/cluster/create_one_node_cluster.sh stock-only && sleep 2m

- name: Start consumer
run: KUBECONFIG=/etc/kubernetes/admin.conf kn service apply -f ./function-images/tests/chained-function-serving/service-consumer.yaml && sleep 30s

- name: Start producer
run: KUBECONFIG=/etc/kubernetes/admin.conf kn service apply -f ./function-images/tests/chained-function-serving/service-producer.yaml && sleep 30s

- name: Run invoker client
run: |
echo "producer.default.192.168.1.240.sslip.io" > urls.txt
cd ./examples/invoker
go build client.go
cd ../..
./examples/invoker/client
- name: Archive log artifacts
uses: actions/upload-artifact@v2
with:
name: logs
path: /tmp/uBench-logs/${{ github.run_id }}

- name: Cleaning
if: ${{ always() }}
run: ./scripts/github_runner/clean_cri_runner.sh stock-only
24 changes: 24 additions & 0 deletions .github/workflows/image_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,27 @@ jobs:
${{ secrets.DOCKER_HUB_USERNAME }}/${{ env.VHIVE_GOLANG_VERSION }}


chained_serving:
name: Deploy chained serving images
runs-on: ubuntu-18.04
strategy:
fail-fast: false
steps:

- uses: actions/checkout@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Build and push
run: |
cd ./function-images/tests/chained-function-serving
make all-image
make all-image-push
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Added [script](./scripts/cloudlab/start_onenode_vhive_cluster.sh) to (re)start vHive single node cluster in a push-button.
- CRI test logs are now stored as GitHub artifacts.
- Added Knative Eventing Tutorial: [documentation](./docs/knative/eventing.md) and [example](./examples/knative-eventing-tutorial).
- Added a chained functions microbenchmark that uses Knative Serving.

### Changed

Expand Down
1 change: 1 addition & 0 deletions configs/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ Micheli
Microarchitecting
microarchitectural
Microarchitecture
microbenchmark
microVMs
minio
MinIO
Expand Down
42 changes: 42 additions & 0 deletions function-images/tests/chained-function-serving/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# MIT License
#
# Copyright (c) 2021 Michal Baczun and 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.

FROM vhiveease/golang:latest as builder

WORKDIR /app
RUN apk add --no-cache make
# We use ARG and ENV to have a single Dockerfile for the all three programs.
# https://vsupalov.com/docker-build-pass-environment-variables/
ARG target_arg
ENV target=$target_arg
COPY . ./
RUN mkdir /log
RUN go mod download && \
CGO_ENABLED=0 GOOS=linux go build -v -o ./${target}-bin ./${target}/

FROM scratch
WORKDIR /app
ARG target_arg
ENV target=$target_arg
COPY --from=builder /log/ /app/log/
COPY --from=builder /app/${target}-bin /app/exe
ENTRYPOINT [ "/app/exe" ]
53 changes: 53 additions & 0 deletions function-images/tests/chained-function-serving/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# MIT License
#
# Copyright (c) 2021 Michal Baczun and 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.

all: all-image

all-image: producer-image consumer-image

all-image-push: producer-image-push consumer-image-push

clean:
rm -f ./producer-bin ./consumer-bin


producer-image: Dockerfile producer/producer.go proto/prodcon.pb.go proto/prodcon_grpc.pb.go
docker build --tag vhiveease/chained-functions-serving-producer:latest --build-arg target_arg=producer .

producer-image-push: producer-image
docker push vhiveease/chained-functions-serving-producer:latest


consumer-image: Dockerfile consumer/consumer.go proto/prodcon.pb.go proto/prodcon_grpc.pb.go
docker build --tag vhiveease/chained-functions-serving-consumer:latest --build-arg target_arg=consumer .

consumer-image-push: consumer-image
docker push vhiveease/chained-functions-serving-consumer:latest


cmd/server/tempReader_grpc.pb.go cmd/server/tempReader.pb.go: cmd/server/tempReader.proto
protoc \
--go_out=. \
--go_opt="paths=source_relative" \
--go-grpc_out=. \
--go-grpc_opt="paths=source_relative" \
cmd/server/tempReader.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// MIT License
//
// Copyright (c) 2021 Michal Baczun and 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.

package main

import (
"context"
"flag"
"fmt"
"io"
"log"
"net"
"os"

"google.golang.org/grpc"

pb "tests/chained-functions-serving/proto"
)

type consumerServer struct {
pb.UnimplementedProducerConsumerServer
}

func (s *consumerServer) ConsumeString(ctx context.Context, str *pb.ConsumeStringRequest) (*pb.ConsumeStringReply, error) {
log.Printf("[consumer] Consumed %v\n", str.Value)
return &pb.ConsumeStringReply{Value: true}, nil
}

func (s *consumerServer) ConsumeStream(stream pb.ProducerConsumer_ConsumeStreamServer) error {
for {
str, err := stream.Recv()
if err == io.EOF {
return stream.SendAndClose(&pb.ConsumeStringReply{Value: true})
}
if err != nil {
return err
}
log.Printf("[consumer] Consumed %v\n", str.Value)
}
}

func main() {
port := flag.Int("ps", 80, "Port")
flag.Parse()

log.SetOutput(os.Stdout)

//set up server
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
if err != nil {
log.Fatalf("[consumer] failed to listen: %v", err)
}

grpcServer := grpc.NewServer()
s := consumerServer{}
pb.RegisterProducerConsumerServer(grpcServer, &s)

log.Printf("[consumer] Server Started on port %v\n", *port)

if err := grpcServer.Serve(lis); err != nil {
log.Fatalf("[consumer] failed to serve: %s", err)
}

}
47 changes: 47 additions & 0 deletions function-images/tests/chained-function-serving/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# MIT License
#
# Copyright (c) 2021 Michal Baczun and 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.

version: "3.7"

services:
consumer:
image: vhiveease/chained-functions-serving-consumer
volumes:
- log-volume:/log
command:
- -ps=3030

producer:
image: vhiveease/chained-functions-serving-producer
ports:
- "3031:3031"
volumes:
- log-volume:/log
command:
- -addr=consumer
- -ps=3031
- -pc=3030
depends_on:
- consumer

volumes:
log-volume:
Loading