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

Update gatling #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Update gatling #3

wants to merge 2 commits into from

Conversation

ubergeek42
Copy link
Member

@ubergeek42 ubergeek42 commented Nov 8, 2022

This replaces all the old scala stuff with shiny new java based dsl (it's still a bit weird, but less weird than scala).

See the rungatling script for the required zip you need to download/extract.
See seeding/seed.sh for what you need to do to set up the data to run gatling (basically create a bunch of gatling0001/secret team accounts, and a contest with a hello world problem that they're all a part of)

I'll add some inline comments for things you might want to tune when adjusting the scaling.

The scenarios it runs through are:

  • Spectator - Just refreshes /public every 30s forever (to simulate the autorefresh)
  • Team - This logs in, starts a job that fetches /team every 30s (to simulate the autorefresh), then periodically does a random action (submits some code, views the problems page, views the team scoreboard, or submits a clarification request).

At the bottom you can tune how many users are injected/how it ramps up/down.

String PASSWORD="secret";

// How many "actions" a team will take (actions are things like submitting, requesting clarification, viewing a scoreboard)
int NUM_TEAM_ACTIONS = 5;
Copy link
Member Author

Choose a reason for hiding this comment

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

Adjust this to make a team "user" last longer/do more things.

int NUM_TEAM_ACTIONS = 5;

// Maximum amount of time the scenario can run
int MAX_MINUTES = 5;
Copy link
Member Author

Choose a reason for hiding this comment

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

Sets a cap for how long this will run (which also sets how long a spectator will keep refreshing for.

// While we're polling the teampage, lets pretend to do some actions like a real team might
.repeat(NUM_TEAM_ACTIONS, "i").on(
exec(
randomSwitch().on(
Copy link
Member Author

Choose a reason for hiding this comment

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

These are the random actions that a team will do, and the probabilities of each one.

)
)
// Sleep anywhere between 5s and 1 minute before doing another action
.pause(5,60)
Copy link
Member Author

Choose a reason for hiding this comment

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

How much time between each team "action". This is in seconds, so teams will take an action between 5 and 60s after their last action.

Comment on lines +173 to +187
teamScenario.injectClosed(
incrementConcurrentUsers(10) // Batches of this many users
.times(10) // how many "levels" to test
.eachLevelLasting(60) // hold the number of users for this duration
.separatedByRampsLasting(60) // Take 60s between adding each user
.startingFrom(10) // Start with 10 users
),
// spectatorScenario.injectOpen(atOnceUsers(10))
spectatorScenario.injectClosed(
incrementConcurrentUsers(10) // Batches of this many spectators
.times(10) // how many "levels" to test
.eachLevelLasting(60) // hold the number of users for this duration
.separatedByRampsLasting(60) // Take 60s between adding each user
.startingFrom(10) // Start with 10 users
)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the bit you'll want to adjust to tune how many concurrent users are hammering the system. Probably play with these things until it falls over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant