Overview
Conducting a load test for your application is a common step in ensuring your app can handle the expected traffic and user activity. However, it's important to approach load testing in a manner that accurately reflects real-world usage patterns and adheres to Stream's guidelines and infrastructure best practices.
This article provides guidance on how to conduct a load test for Stream while keeping within operational boundaries and avoiding unnecessary disruptions to both your app and Stream's services.
Guidelines for Conducting a Load Test
1. Design Your Load Test to Mimic Realistic User Behavior
It is best practice that your load test simulates actual user behavior, rather than overwhelming the system in a manner that resembles a Distributed Denial of Service (DDoS) attack. Focus on replicating how users would realistically interact with your application over time:
- Simulate activities such as sending messages, connecting and disconnecting from chat, and retrieving message history.
- Account for periods of peak traffic based on expected app usage patterns (e.g., morning commutes, lunch breaks, etc.).
2. Respect API Rate Limits
Stream’s API rate limits are enforced, meaning that if you exceed these limits, your load test will fail to accurately represent real-world conditions and could result in throttling. Be mindful of:
- Rate limits: Respect the documented API call limits for your subscription tier. Exceeding them will lead to rate limiting and inaccurate test results.
- Error handling: Ensure that your application is set up to handle rate limit errors gracefully.
3. Billing Implications of Load Testing
Please note that any metrics increased during your load test, including:
- Monthly Active Users (MAU)
- Concurrent connections
- API calls
- Activities
...will count toward your monthly billing. Be mindful that load testing could lead to an increase in these metrics, so it is important to factor this into your decision to conduct the test.
4. Use a Separate App for Load Testing
Stream does not offer a separate "sandbox" environment for load testing, which means that any tests conducted will affect your production environment's metrics. We strongly recommend creating and using a separate app from your production app for the purpose of load testing. This helps to isolate the effects of the test and ensures that your production data remains untouched.
5. Notify Stream in Advance
Before conducting a load test, please give Stream a heads-up. Often, we can:
- Scale up infrastructure: If we know in advance, we can allocate additional resources to your application during the load test.
- Provide advice: We can offer recommendations to help you structure your test effectively while minimizing unnecessary strain on both your app and Stream’s infrastructure.
Important Considerations
1. We Do Not Encourage Load Testing
Stream’s infrastructure is robust and mature. We currently host chat for some of the world’s largest applications, including Nextdoor, Strava, and Alfagift, which often handle hundreds of thousands of concurrently connected users. Given this, we have confidence in our infrastructure's ability to scale automatically based on demand.
If your goal is to assess our ability to handle high traffic, rest assured that our system is designed for these scenarios.
2. Customer-Run Load Tests May Not Represent Real-World Usage
Through experience, we’ve observed that customer-conducted load tests often fail to accurately reflect real user behavior. These tests can sometimes overestimate traffic volume or simulate interactions that are not typical of actual users, leading to skewed results. Instead of relying heavily on load tests, we suggest focusing on real-world data as your user base grows or coordinating a load test with the Stream Support team.
Final Thoughts
While load testing can be useful, it is important to approach it with care, keeping in mind the real-world conditions under which your application will operate. Respecting rate limits, managing billing impacts, and notifying Stream in advance can ensure that your load test is both effective and non-disruptive.
If you need assistance with your load test or have any questions about its impact on your application or billing, please reach out to Stream support, and we’ll be happy to assist you.
Comments
0 comments
Please sign in to leave a comment.