<- Test Directory

Increase Performance with FastHTTP

Using FastHttpUser to increase load test capacity

Overview

By default, LoadForge uses the HttpUser class which is based on Python requests. This allows a large amount of flexibility with customizing your test, however, for most use cases it's not required.

There is an alternative and significantly faster method (4-5x more requests/second) by using FastHttpUser instead of HttpUser. Below is an example of a test configured to use FastHttpUser.

Code

from locust import task, FastHttpUser

class MyUser(FastHttpUser):    
    @task(1)
    def index(self):
        response = self.client.get("/")     

Changing Your Tests

As you can see primarily you need to import FastHttpUser and then pass it to your test class. You should be able to easily change any existing test to use it.



This guide is part of the LoadForge Directory, an index of locustfile's for use with LoadForge website and API load tests. We also provide a wizard to generate tests, and onboarding assistance for clients. Contact us should you have any questions.

LoadForge provides load testing and stress tests for websites, APIs and servers. It uses your cloud account to rapidly scale large numbers of simulated users to load test your website, store, API, or application for cheap - just cents per test!

For more help on Tests please see our official documentation. Logged in users can also use our wizard to generate a locustfile, or you can record your browser steps.

Ready to run your test?
Start your first test within minutes.