To load test is to simulate the requests that users will put on your app once your app is in production. The goal is to measure performance and to identify and resolve issues before they happen to a real user.
Use the Node.js SDK to simulate a common single user's workload for your mobile app. For example, you can use the SDK to:
- Open a set number of realms.
- Make a certain number of writes to each partition.
- Simulate backend server calls (for example, by calling App Services functions).
The exact details of the simulation depend on your app's actual workload. For instance, you might open realms that already have initialized sync data on the server side to simulate read use cases. You might open different realms to simulate write workloads. These realms might be a mix of shared or private per-user realms depending on your use case. You can use a shared realm to test the conflict resolution speed and discover any problems. So, consider how you use Realm Database in your actual app to design your simulation.
The Node.js SDK uses the same underlying C++ database and sync client as the mobile (iOS, Android, .NET, etc.) SDKs. Therefore, you can exercise the same code paths as in your production mobile app while benefiting from the headless, server environment of Node.js.
You can then deploy the single-user simulation to hundreds or thousands of concurrent nodes in order to test a real multi-user workload. For example:
- Package the app in a Docker container.
- Deploy the container as part of a Kubernetes job.
- Adjust the parameters of the job to match it to a real production workload.
- Measure the time it takes to complete the Kubernetes job to calculate overall performance.
There are a variety of cloud-based Kubernetes-as-a-service offerings that you can use.