
Jira Integration & Graphical Test Builder
We are proud to announce the release of two new features, available immediately. 🚀 Jira Integration: Automate Issue Tracking for...
Guide on load testing gRPC streaming APIs (client, server, bidirectional) with LoadForge using Locust.
You are now browsing the LoadForge locust test directory. You can use these tests as a starting point for your own tests, or use our AI wizard to generate one automatically.
gRPC supports streaming RPCs—client-side, server-side, and bidirectional streams—over HTTP/2. Locust with GrpcUser
can simulate these streaming calls to measure performance under load.
# locust.py
from locust import task, between
from locust_plugins.users import GrpcUser
import streaming_pb2
class StreamingUser(GrpcUser):
host = "grpc.server.com:50051"
wait_time = between(1, 2)
@task
def client_stream(self):
requests = (streaming_pb2.StreamRequest(value=i) for i in range(10))
response = self.call(requests, "/streaming.StreamService/ClientStream")
_ = response.value
@task
def server_stream(self):
request = streaming_pb2.Empty()
responses = self.call(request, "/streaming.StreamService/ServerStream")
for msg in responses:
_ = msg.value
@task
def bidi_stream(self):
requests = (streaming_pb2.StreamRequest(value=i) for i in range(5))
responses = self.call(requests, "/streaming.StreamService/BidiStream")
for msg in responses:
_ = msg.value
Notes:
protoc
with streaming definitions.locust-plugins
, grpcio
, grpcio-tools
if you wish to test locally.