Skip to content

Commit

Permalink
Changing the Dockerfile and the directories so that we have a single
Browse files Browse the repository at this point in the history
image and a more flat sctucture.
  • Loading branch information
pm7h committed Feb 26, 2019
1 parent d01347d commit 27ba6ce
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ EXPOSE 8089 5557 5558

RUN mkdir /etc/service/locust
COPY /locust-files ./
COPY /locust-files/run.sh /etc/service/locust/run
COPY /run.sh /etc/service/locust/run
RUN chmod +x /etc/service/locust/run
39 changes: 28 additions & 11 deletions test/load/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
# Load Testing
# Load and performance tests

Load tests aim to test the performance of the system under heavy load. Game server allocation is an example where multiple parallel operations should be tested.
Load tests aim to test the performance of the system under heavy load. For Agones, game server allocation is an example where heavy load and multiple parallel operations can be envisioned. Locust provides a good framework for testing a system under heavy load. It provides a light-weight mechanism to launch thousands of workers that run a given test.

## Build and run test
The goal of performance tests is to provide metrics on various operations. For
Agones, fleet scaling is a good example where performance metrics are useful.
Similar to laod tests, Locust can be used for performance tests with the main
difference being the number of workers that are launched.

## Build and run tests

Prerequisites:
- Docker.
- A running k8s cluster.
- Have kubeconfig file ready.

Load tests are written using Locust. These tests are also integrated with Graphite and Grafana
for storage and visualization of the results.

### Running Load tests using Locust on your local machine
### Running load tests using Locust on your local machine

Start a proxy to the Kubernetes API server:
This test uses the HTTP proxy on the local machine to access the k8s API. The default port for the proxy is 8001. To start a proxy to the Kubernetes API
server:

```
kubectl proxy [--port=PORT] &
```

The default port for the proxy is 8001.
Next, we need to build the Docker images and run the container:

```
docker build -t locust-files .
docker run --rm --network="host" -e "TARGET_HOST=http://127.0.0.1:8001" locust-files:latest
```

The above will build a Docker container to install Locust, Grafana, and Graphite and will configure
them. The test uses the HTTP proxy on the local machine to access the k8s API.
them. To run Locust tests for game server allocation:

```
docker run --rm --network="host" -e "LOCUST_FILE=gameserver_allocation.py -e "TARGET_HOST=http://127.0.0.1:8001" locust-files:latest
```

To run Locust tests for fleet autoscaling:

```
docker run --rm --network="host" -e "LOCUST_FILE=fleet_autoscaling.py -e "TARGET_HOST=http://127.0.0.1:8001" locust-files:latest
```

NOTE: The Docker network host only works for Linux. For macOS and Windows you can use the special DNS name host.docker.internal.

After running the Docker container you can access Locust on port 8089 of your local machine. When running Locust tests, it is recommended to use the same value for number of users and hatch rate. For game server allocation, these numbers can be large, but for fleet autoscaling a single user is sufficient.

After running the Docker container you can access Locust on port 8089 of your local machine.
Grafana will be available on port 80, and Graphite on port 81.
Grafana will be available on port 80, and Graphite on port 81.
24 changes: 0 additions & 24 deletions test/load/gameserver-allocation/Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions test/load/gameserver-allocation/locust-files/run.sh

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# TAKEN FROM: https://github.com/GoogleCloudPlatform/distributed-load-testing-using-kubernetes/blob/master/docker-image/locust-tasks/run.s

LOCUST="/usr/local/bin/locust"
LOCUS_OPTS="-f locustfile.py --host=$TARGET_HOST"
LOCUS_OPTS="-f $LOCUST_FILE --host=$TARGET_HOST"
LOCUST_MODE=${LOCUST_MODE:-standalone}

if [[ "$LOCUST_MODE" = "master" ]]; then
Expand Down

0 comments on commit 27ba6ce

Please sign in to comment.