Generating load on the webserver as opposed to the web application
Sometimes you want to test the maximum requests per second your webservers can deliver, as opposed to the dynamic content your application can - e.g. php, Laravel, etc.
To do that you can request only static content from the webserver, or even a very small static text file.
Here is an example with an image and robots.txt:
from locust import HttpUser, task, between
class QuickstartUser(HttpUser):
wait_time = between(4, 7)
@task(1)
def robots_fetch(self):
self.client.get("/robots.txt")
@task(1)
def image_selection(self):
self.client.get("/images/logo.jpg")