Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

feat: run loadgen for a few seconds during installation #609

Merged
merged 3 commits into from
Dec 16, 2020
Merged

Conversation

freelerobot
Copy link
Contributor

@freelerobot freelerobot commented Dec 15, 2020

fix: #601
Run load generator for ~10-15s during installation.
Adds ~5s to previous install time.

Load specs:
user_count=50
spawn_rate=10
At the end of 5 seconds we delete users that have already been created.

Note:
There's a race condition where curl http://loadgen_ip/stop to stop loadgen returns a successful http response (and UI indicates the swarm has terminated..)

BUT this only terminates users that have already been spawned, not the users that were originally scheduled to spawn! Bug filed with Locust here.

For us this might be nice as sandbox users will continue to get traces/metrics from any undeleted remaining users from Locust.

Context:
We wanted to provide initial traffic telemetry for users to view && still provide Locust loadgen UI.
Implemented the workaround suggested by this Locust issue

Testing:
In Span Viewer, use filter /http/user_agent:python-requests

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Dec 15, 2020
@freelerobot freelerobot added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 15, 2020
terraform/install.sh Outdated Show resolved Hide resolved
TRIES=0
while [[ $(curl -sL -w "%{http_code}" "http://$loadgen_ip" -o /dev/null --max-time 1) -ne 200 && \
# while [[ $(curl -sL -w "%{http_code}" "http://$loadgen_ip" -o /dev/null --max-time 1) -ne 200 && \
while [[ $(curl -XPOST -d "user_count=100&spawn_rate=10" http://$loadgen_ip/swarm -o /dev/null -w "%{http_code}" --max-time 1) -ne 200 && \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is /swarm idempotent? Can we keep trying to hit it multiple times and always expect a 200 response?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indempotent

# Ends initial load generation
if [[ $(curl http://$loadgen_ip/stop -o /dev/null -w "%{http_code}") -ne 200 ]]; then
log "Failed to stop initial load generation"
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure we want to shut down the load generation? Maybe we should keep it running so users continuously see things come in

Copy link
Contributor Author

@freelerobot freelerobot Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a fan of this suggestion. This actually solves the Locust bug issue. and doesn't slow down install time

Copy link
Contributor Author

@freelerobot freelerobot Dec 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm another Locust bug. If we start the swarm with a post request, and keep it running, users don't get the STOP button in the UI. Meaning they won't be able to able to create their own swarms (which we want them to do) 😬😬😬

The fundamental issue here is the Locust page is all jquery. I'll reduce the swarm size and increase the swarm run time by a little bit.

terraform/install.sh Outdated Show resolved Hide resolved
@freelerobot freelerobot removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Dec 16, 2020
@freelerobot
Copy link
Contributor Author

Ok this is mergeable

@simonz130 simonz130 added priority: p2 Moderately-important priority. Fix may not be included in next release. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Dec 16, 2020
@simonz130 simonz130 merged commit a467461 into master Dec 16, 2020
@simonz130 simonz130 deleted the fix601 branch December 16, 2020 05:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes This human has signed the Contributor License Agreement. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loadgenerator is not sending traffic automatically
4 participants