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

Adding Locust tests - initial changes for #412 #611

Merged
merged 1 commit into from Mar 8, 2019

Conversation

@pm7h
Copy link
Contributor

commented Feb 21, 2019

Adding Locust tests. We are also working on adding load tests using the e2e framework (#573) but these tests provide a convenient way to run a quick test with very high load.

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 21, 2019

Build Succeeded 👏

Build Id: b83762d3-1ae2-479b-a580-fad363844987

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-7b0f32f
@markmandel

This comment has been minimized.

Copy link
Collaborator

commented Feb 21, 2019

Sorry - the reopening of a previously closed PR made funny things happen - so you've got a few messages.

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 21, 2019

Build Failed 😱

Build Id: 8207771e-9203-4f7d-8e2e-91362bb98d29

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 21, 2019

Build Failed 😱

Build Id: 49546ec7-2057-4434-b6f1-cfb1837abe50

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 21, 2019

Build Succeeded 👏

Build Id: a9ae3734-2e40-40c9-98df-5f5954eb68f6

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-2c0a887
@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 21, 2019

Build Succeeded 👏

Build Id: a97f968f-d5c4-4584-8e2d-10d474abb45d

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-cde3053
To run load tests using Locust on your local machine:

```
docker build -t locust-files .

This comment has been minimized.

Copy link
@cyriltovena

cyriltovena Feb 22, 2019

Collaborator

I would add the kubectl proxy & command

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 23, 2019

Author Contributor

Done.


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

This comment has been minimized.

Copy link
@cyriltovena

cyriltovena Feb 22, 2019

Collaborator

Out of curiosity are you running on linux ? Last time I checked network host on MacOS wasn't working.

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 23, 2019

Author Contributor

Good catch. Yes, I was running on Linux.

I'm thinking to add to the documentation that for macOS and Windows we can use the special DNS name host.docker.internal. Does that sound good?

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 26, 2019

Author Contributor

I added this to the README. Please let me know if it is sufficient.

@cyriltovena
Copy link
Collaborator

left a comment

Looks good, I think it would be better with a single image.

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

This comment has been minimized.

Copy link
@cyriltovena

cyriltovena Feb 22, 2019

Collaborator

I think we could use a single image and with the entrypoint script your could switch from one plan to another(either via a flag or env).

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 23, 2019

Author Contributor

Do you mean a single Dockerfile for both tests?

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 26, 2019

Author Contributor

I changed the Dockerfile and the structure so that we have a single image. It's more flat and more readable now. Thanks for the suggestion.

@pm7h pm7h force-pushed the pm7h:locust branch from cde3053 to 39ca930 Feb 23, 2019

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 23, 2019

Build Succeeded 👏

Build Id: 212a9e0a-d879-40ae-af40-3cf3e60071c8

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-39ca930

@pm7h pm7h force-pushed the pm7h:locust branch from 39ca930 to 27ba6ce Feb 26, 2019

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 26, 2019

Build Failed 😱

Build Id: a3cc9957-4b29-47dd-b610-7b4ac6b4cf29

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

```

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.

This comment has been minimized.

Copy link
@jkowalski

jkowalski Feb 27, 2019

Collaborator

curious: is this not going to limit the perceived performance in some way (I would imagine proxy is probably not optimized for speed)?

This comment has been minimized.

Copy link
@pm7h

pm7h Mar 1, 2019

Author Contributor

I'm not sure, it might. I will improve that in future iterations.

RUN pip install locustio
EXPOSE 8089 5557 5558

RUN mkdir /etc/service/locust

This comment has been minimized.

Copy link
@jkowalski

jkowalski Feb 27, 2019

Collaborator

nit: /etc is typically for configuration files, not for executables

how about /opt/locust/ ?

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 28, 2019

Author Contributor

That won't work. The image that I am using in this Dockerfile (https://hub.docker.com/r/hopsoft/graphite-statsd) is built from phusion which requires specific configuration when a new daemon is added. This includes an executable that runs the daemon to the /etc/service/ directory: https://github.com/phusion/baseimage-docker#adding-additional-daemons

def scaleUpFleet(self):
# Create a fleet.
initial_size = 1
start_time = time.time()

This comment has been minimized.

Copy link
@jkowalski

jkowalski Feb 27, 2019

Collaborator

nit: format 'payload' as multiline? or perhaps put those things in JSON files?

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 28, 2019

Author Contributor

Formatted as multiline for now. I will later move these to JSON files but not in this PR since it needs some parsing to build the payload.

RUN pip install locustio
EXPOSE 8089 5557 5558

RUN mkdir /etc/service/locust

This comment has been minimized.

Copy link
@jkowalski

jkowalski Feb 27, 2019

Collaborator

same here about /etc

This comment has been minimized.

Copy link
@pm7h

pm7h Feb 28, 2019

Author Contributor

Ditto.

@pm7h pm7h force-pushed the pm7h:locust branch from 27ba6ce to 7a34cd9 Feb 28, 2019

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 28, 2019

Build Succeeded 👏

Build Id: e65724a4-9f73-444d-9f76-d47ebccbfe2b

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-7a34cd9
@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Feb 28, 2019

Build Succeeded 👏

Build Id: 734702be-07a4-4e94-bc16-1033b4212456

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-09b2443
@aLekSer
Copy link
Contributor

left a comment

Hello, there are some crucial and not so crucial pep8 violations. Please run pep8 util.

response = self.client.put(selfLink, data=json.dumps(payload), headers=headers)
self.waitForScaling(selfLink, 0)
total_time = int((time.time() - start_time) * 1000)
events.request_success.fire(request_type="fleet_scaling_down", name="fleet_scaling_down", response_time=total_time, response_length=0)

This comment has been minimized.

Copy link
@aLekSer

aLekSer Feb 28, 2019

Contributor

@pm7h Can you please run pep8 util on your python code. For instance this lines too long:
E501 line too long (132 > 79 characters)

This comment has been minimized.

Copy link
@pm7h

pm7h Mar 1, 2019

Author Contributor

Done.

This comment has been minimized.

Copy link
@aLekSer

aLekSer Mar 1, 2019

Contributor

Thanks @pm7h

break
if (total_time > DEADLINE):
print "Fleet did not scale up in time"
events.request_success.fire(request_type="fleet_scaling_timeout", name="fleet_scaling_timeout", response_time=total_time * 1000, response_length=0)

This comment has been minimized.

Copy link
@aLekSer

aLekSer Feb 28, 2019

Contributor

Same as above:
E501 line too long (152 > 79 characters)

This comment has been minimized.

Copy link
@pm7h

pm7h Mar 1, 2019

Author Contributor

Done.

}
headers = {'content-type': 'application/json'}
response = self.client.post("/apis/stable.agones.dev/v1alpha1/namespaces/default/fleets", data=json.dumps(payload), headers=headers)
response_json = response.json()

This comment has been minimized.

Copy link
@aLekSer

aLekSer Feb 28, 2019

Contributor

Please run pep8. Install it using pip install pep8.
E111 indentation is not a multiple of four

This comment has been minimized.

Copy link
@pm7h

pm7h Mar 1, 2019

Author Contributor

Done. Thanks.

response = self.client.get(selfLink)
response_json = response.json()
status = response_json.get('status')
if status != None:

This comment has been minimized.

Copy link
@aLekSer

aLekSer Feb 28, 2019

Contributor

E711 comparison to None should be 'if cond is not None:'

Suggested change
if status != None:
if status is not None:

This comment has been minimized.

Copy link
@pm7h

pm7h Mar 1, 2019

Author Contributor

Done.

break
elif (game_server_state == "UnAllocated"):
total_time = int((time.time() - start_time) * 1000)
events.request_success.fire(request_type="GameServerUnAllocated", name="GameServerUnAllocated", response_time=total_time, response_length=0)

This comment has been minimized.

Copy link
@aLekSer

aLekSer Feb 28, 2019

Contributor

Same as in the other file. This file violates pep8 stadard. Line is too long, should be split into multiple.

This comment has been minimized.

Copy link
@pm7h

pm7h Mar 1, 2019

Author Contributor

Done. Thanks.

@pm7h pm7h force-pushed the pm7h:locust branch from 09b2443 to 5cabfcb Mar 1, 2019

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Mar 1, 2019

Build Succeeded 👏

Build Id: d0d50340-f204-4eed-8601-5f889e5b4320

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-5cabfcb
@aLekSer
aLekSer approved these changes Mar 1, 2019
Copy link
Contributor

left a comment

Thanks @pm7h ,
Tested these two files with pycodestyle also (pep8 util seems to be deprecated), now them are fine.

@markmandel

This comment has been minimized.

Copy link
Collaborator

commented Mar 7, 2019

Noticed this sitting here for a while - tbh, I was waiting on either @Kuqd or @jkowalski to approve this - since they are working on performance way more than me 😄

Happy to download and take it for a spin if nobody is going to jump on this?

@pm7h pm7h force-pushed the pm7h:locust branch from 5cabfcb to 7aef695 Mar 8, 2019

Locust tests.
Adding Locust tests.

Adding command to start k8s proxy to the READMe file.

Changing the Dockerfile and the directories so that we have a single
image and a more flat sctucture.

Small improvements to Python files for better readability.

Fixed indentation.

Fixed pep8 errors.

@pm7h pm7h force-pushed the pm7h:locust branch from 7aef695 to ec6a49e Mar 8, 2019

@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Mar 8, 2019

Build Succeeded 👏

Build Id: 6d376c50-d087-43ff-9e1a-5374c260e027

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-7aef695
@agones-bot

This comment has been minimized.

Copy link
Collaborator

commented Mar 8, 2019

Build Succeeded 👏

Build Id: 7fcbf20c-00e4-4308-ad14-54b56339b457

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/611/head:pr_611 && git checkout pr_611
  • helm install install/helm/agones --namespace agones-system --name agones --set agones.image.tag=0.9.0-ec6a49e

@jkowalski jkowalski merged commit 8002ed8 into googleforgames:master Mar 8, 2019

2 checks passed

agones-bot Build 7fcbf20c-00e4-4308-ad14-54b56339b457 succeeded
Details
cla/google All necessary CLAs are signed

@markmandel markmandel added this to the 0.9.0 milestone Mar 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.