Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HermioneKT committed Feb 5, 2024
1 parent bdf780e commit 3619433
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 18 deletions.
6 changes: 3 additions & 3 deletions benchmarks/sleeping/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ all: $(ALL_IMAGES)

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

## Push images

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

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

## Pull images from docker hub

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

pull: $(addprefix pull-, $(FUNCTIONS))
8 changes: 8 additions & 0 deletions benchmarks/sleeping/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Sleeping benchmark

The sleeping benchmark simulates a simple I/O bounded task by sleeping for 50 ms.

This benchmark can be used to verify that increasing in cpu frequency would not significantly affect the latency of I/O bounded workload.

The functionality is implemented in golang.

## Running this benchmark (using knative)

1. Build or pull the function images using `make all` or `make pull`.
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/sleeping/go/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
var (
zipkin = flag.String("zipkin", "http://localhost:9411/api/v2/spans", "zipkin url")
address = flag.String("addr", "0.0.0.0:50051", "Address:Port the grpc server is listening to")
delay = flag.Int("sleep-delay", 50, "Delay the function sleeps before sending the response (in milliseconds)")
)

// server is used to implement aes.AesServer.
Expand All @@ -50,10 +51,9 @@ type server struct {
// ShowEncryption implements aes.AesServer
func (s *server) ShowEncryption(ctx context.Context, in *pb.PlainTextMessage) (*pb.ReturnEncryptionInfo, error) {
startTime := time.Now()
for i := 0; i < 1; i++ {
time.Sleep(50 * time.Millisecond) // Simulate an I/O-bound task by sleeping
}
time.Sleep(time.Duration(*delay)* time.Millisecond) // Simulate an I/O-bound task by sleeping
elapsedTime := time.Since(startTime)

return &pb.ReturnEncryptionInfo{EncryptionInfo: elapsedTime.String()}, nil
}

Expand All @@ -65,6 +65,7 @@ func main() {
if err != nil {
log.Warn(err)
}

defer shutdown()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
version: "3.9"
services:
sleeping-go:
image: kt05docker/sleeping-go:latest
image: vhiveease/sleeping-go:latest
container_name: sleeping-go
entrypoint:
- /app/server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
version: "3.9"
services:
sleeping-go:
image: kt05docker/sleeping-go:latest
image: vhiveease/sleeping-go:latest
container_name: sleeping-go
entrypoint:
- /app/server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
- --function-endpoint-url=0.0.0.0
- --function-endpoint-port=50051
- --function-name=aes-go
- image: docker.io/kt05docker/sleeping-go:latest
- image: docker.io/vhiveease/sleeping-go:latest
env:
- name: ENABLE_TRACING
value: "true"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/sleeping/yamls/knative/kn-sleeping-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ spec:
- --function-endpoint-url=0.0.0.0
- --function-endpoint-port=50051
- --function-name=aes-go
- image: docker.io/kt05docker/sleeping-go:latest
- image: docker.io/vhiveease/sleeping-go:latest
args:
- --addr=0.0.0.0:50051
6 changes: 3 additions & 3 deletions benchmarks/spinning/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ all: $(ALL_IMAGES)

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

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

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

## Pull images from docker hub
pull-%:
docker pull docker.io/kt05docker/$(subst pull-,,$@):latest
docker pull docker.io/vhiveease/$(subst pull-,,$@):latest

pull: $(addprefix pull-, $(FUNCTIONS))
10 changes: 9 additions & 1 deletion benchmarks/spinning/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Spinning benchmark

The spinning benchmark simulates a simple cpu bounded bounded task by allowing multiplication for 30000000 iterations.

This benchmark can be used to verify that increasing in cpu frequency significantly decrease the latency of CPU-bounded workload.

The functionality is implemented in golang.

## Running this benchmark (using knative)

1. Build or pull the function images using `make all` or `make pull`.
Expand All @@ -9,7 +17,7 @@
### Invoke once
4. In a new terminal, invoke the interface function with test-client.
```bash
./test-client --addr spinning-go.default.192.168.1.240.sslip.io:80 --name "Example text for Sleeping"
./test-client --addr spinning-go.default.192.168.1.240.sslip.io:80 --name "Example text for Spinning"
```
### Invoke multiple times
4. Run the invoker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
version: "3.9"
services:
spinning-go:
image: kt05docker/spinning-go:latest
image: vhiveease/spinning-go:latest
container_name: spinning-go
entrypoint:
- /app/server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
version: "3.9"
services:
spinning-go:
image: kt05docker/spinning-go:latest
image: vhiveease/spinning-go:latest
container_name: spinning-go
entrypoint:
- /app/server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
- --function-endpoint-url=0.0.0.0
- --function-endpoint-port=50051
- --function-name=aes-go
- image: docker.io/kt05docker/spinning-go:latest
- image: docker.io/vhiveease/spinning-go:latest
env:
- name: ENABLE_TRACING
value: "true"
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/spinning/yamls/knative/kn-spinning-go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
- --function-endpoint-url=0.0.0.0
- --function-endpoint-port=50051
- --function-name=aes-go
- image: docker.io/kt05docker/spinning-go:latest
- image: docker.io/vhiveease/spinning-go:latest
args:
- --addr=0.0.0.0:50051
nodeSelector:
Expand Down

0 comments on commit 3619433

Please sign in to comment.