Introduction
By default, LoadForge harnesses the capabilities of theHttpUser
class, an interface built atop Python’s renowned requests
library. While this provides vast opportunities to tailor your test, it may sometimes offer more than you need.
For those eyeing improved throughput, LoadForge introduces FastHttpUser
—a class that promises to amplify your test capacity by 4-5x, facilitating a greater number of requests per second compared to the default HttpUser
.
Please tread cautiously:
FastHttpUser
is an advanced feature. While it assures speed, it sacrifices some of the functionalities inherent to the HttpUser
class. It may not suit every user or every use case.Sample Test with FastHttpUser
Here’s a succinct test showcasing the usage ofFastHttpUser
. This test is devoid of any wait_time
and is primed to deliver the zenith number of requests for each virtual user.
Advanced Test with FastHttpUser
Suppose you have an e-commerce site and want to test the performance of various pages: the homepage, product listings, and individual product pages. The following test simulates these scenarios usingFastHttpUser
:
Code
Weights & Endpoints
In this advanced example, you’ll notice the@task
decorators are given different weights. These weights dictate the likelihood of a particular endpoint being hit. A higher weight means the task will be executed more frequently. This simulates real-world scenarios where users are more likely to visit some pages (like the homepage) than others.
Remember, while
FastHttpUser
accelerates the request throughput, you might miss out on some of the functionalities offered by the standard HttpUser
. Always make sure to weigh the pros and cons based on the specific requirements of your testing scenario.
LoadForge is built on the sturdy foundation of
locust.io
, an open-source load testing framework. If you’re already a user of locust.io
, this script will look familiar. Interested in escalating your testing game? Import your locust.io
script into LoadForge and tap into a world of enhanced testing!