This section is dedicated to robust HTTP route testing and benchmarking. It offers customizable configurations and employs the Wrk2 benchmarking tool, streamlining performance evaluation. Wrk2 data is extracted and visualized with Plotly, enabling quick assessment of response times and ensuring the application meets service level expectations.
Strapi focuses on simplifying the creation and visualization of real-time performance metrics. By seamlessly integrating Grafana with Prometheus data, we harness Grafana's extensive library of templates designed for stress testing metrics and data exporters. Prometheus collects essential metrics, enabling the creation of a performance observability dashboard within Grafana.
- For Docker usage, please see Docker Repo to pull and run Docker image.
- If you do not have it, install Wrk2. This can be installed via Homebrew on MacOS.
- NOTE: Mac devices using the M1 chip may require additional configuration setting up Wrk2.
- Linux users can install Wrk2 via the following commands:
sudo apt-get install -y build-essential libssl-dev git zlib1g-dev git clone https://github.com/giltene/wrk2.git cd wrk2 make
- A file named wrk will be generated in that directory, rename wrk to wrk2, and then run
sudo cp wrk2 /usr/local/bin
- Make sure your server is up and running. If you are in development mode, the server URL should be something like
http://localhost:1234
, with the 1-2-3-4 being your server's port number. - If your application is running in a Docker container, make sure to have your local port exposed or access to the container's ip address, and ensure you are referencing the right port number.
- If you are testing a database, make sure to have it configured to a test environment.
- Fork and clone this repository to your local machine.
- Ensure your server's API endpoints are exposed and your server is running.
- Within the StrAPI directory, run
npm install npm run dev
- In your browser, go to http://localhost:3100
- Click the "Dashboard" link located on the header at the top-right of the page.
- Input all required testing parameters as shown on the Dashboard page.
- If you are testing POST requests, format the body of the request in JSON format with key-value pairs.
- After all required parameters are input, hit "Add Method" to include method on the test.
- After all desired methods added, hit "Start Test" to begin testing.
- After the test is complete, a trace will be generated and displayed below on the latency graph.
- Subsequent tests will be added to the graph, allowing you to compare the performance of different endpoints and tests.
- Traces can be removed individually or all at once by clicking the Remove Traces button.
- If the trace is not automatically displayed on the graph after the test is complete, click the "Request Plot Data Manually" button to display the trace.
- StrAPI supports Grafana integration. To view Grafana panels click on Grafana Metrics in the left panel.
- In the input field, enter the grafana iframe url and click "Add Panel".
- To remove a panel, click on the "Remove Panel" button above the panel.
- Customize Grafana and Prometheus containers to work with StrAPI by configuring docker compose.
- Add support for more HTTP methods, such as PUT, PATCH, DELETE, etc.
- Containerize StrAPI alongside Wrk2 to allow for easy deployment.
- Utilize (NoSQL/SQL) database with authentication to store test results and user data.
- Host StrAPI on AWS or other providers.
- Expand testing suite to include more tests
- Add support for Kubernetes & cluster monitoring
- Add support for web servers like Nginx and Apache.
- Add support for message brokers and event streamers like RabbitMQ and Kafka.