SPARROW – Speed and Performance Analysis for Responsive Requests Over the Web
SPARROW is a script designed to perform web performance testing by making repeated curl
requests to specified resources (CSS, PNG files) and measuring the Time To First Byte (TTFB) and Total Time for each request. The results are outputted to a CSV file for easy analysis. The script ensures that the responses are not cached and includes additional metadata in the output.
Table of Contents
Features
- Perform repeated
curl
requests to measure performance metrics. - Capture both TTFB and Total Time for each request.
- Bypass server-side cache with a
Cache-Control
header. - Configurable number of test repetitions and random sleep between requests.
- Metadata for
client
,user
, andnetwork
included in the CSV report. - Cross-platform support for Bash (Linux/macOS) and PowerShell (Windows).
Requirements
-
Bash Version (Linux/macOS):
-
curl
must be installed.
-
-
PowerShell Version (Windows):
- Windows 10 or higher (comes with built-in
curl.exe
).
- Windows 10 or higher (comes with built-in
Installation
Bash (Linux/macOS)
-
Download the script:
wget https://your-repo-url/sparrow.sh -O sparrow.sh
-
Make it executable:
chmod +x sparrow.sh
PowerShell (Windows)
-
Download the script:
Invoke-WebRequest -Uri https://your-repo-url/sparrow.ps1 -OutFile sparrow.ps1
-
Set script execution policy (if needed):
Set-ExecutionPolicy RemoteSigned
Usage
Bash-Script (Linux/macOS)
Run the script with the desired options:
./sparrow.sh -r 10 -m 2 -x 5 -u https://mywebsite.com -c client_xyz -U user_jane -n WiFi
PowerShell-Script (Windows)
.\sparrow.ps1 -r 10 -m 2 -x 5 -u https://mywebsite.com -c client_xyz -U user_jane -n Ethernet
Options
Option | Description | Example |
---|---|---|
-r |
Number of repetitions (default: 1) | -r 10 |
-m |
Minimum random sleep time between tests in seconds (default: 1) | -m 2 |
-x |
Maximum random sleep time between tests in seconds (default: 5) | -x 5 |
-u |
Base URL (CSS and PNG files will be appended) | -u https://mywebsite.com |
-c |
Client name to be added to CSV output | -c client_xyz |
-U |
User name to be added to CSV output | -U user_jane |
-n |
Network name to be added to CSV output | -n WiFi |
CSV Output
The script generates a CSV file (curl_report.csv
) with the following columns:
timestamp;url;ttfb;download;total;client;user;network
Example csv output:
timestamp;url;ttfb;total;client;user;network
2024-10-09 15:30:45;https://mywebsite.com/style.css;0.056;0.234:0.230;client_xyz;user_jane;WiFi
2024-10-09 15:30:48;https://mywebsite.com/image.png;0.078;0.234;0.315;client_xyz;user_jane;WiFi
2024-10-09 15:31:45;https://mywebsite.com/style.css;0.058;0.123;0.225;client_xyz;user_jane;WiFi
...
License
This project is licensed under the MIT License. See LICENSE.md for more details.