Skip to content

Instantly share code, notes, and snippets.

@cgbystrom
Created June 21, 2010 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgbystrom/447635 to your computer and use it in GitHub Desktop.
Save cgbystrom/447635 to your computer and use it in GitHub Desktop.
import locust
import gevent
from clients import HTTPClient
from gevent import wsgi
# Defines the behaviour of a locust (aka a website user :)
def website_user(name):
c = HTTPClient('http://localhost:8088')
for i in range(0, 10):
c.get('/fast', name='Fast page') # Request the fast page
gevent.sleep(5) # Think for 5 seconds
c.get('/slow', name='Slow page') # Do another request
locust.prepare_swarm_from_web(website_user, hatch_rate=5, max=20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment