In this post, we’ll look at how to benchmark a web application with Siege on Ubuntu and PowerShell Universal.
Siege is an HTTP and HTTPS stress testing tool for Linux. It can run web requests using a configurable number of threads. In benchmark mode, it runs as fast as possible with no delays.
I’m using Ubuntu 20.04 running in WSL2 on a Windows 11 host. We typically use Siege to performance test PowerShell Universal, so that is the application under test here.
Install Siege
To install Siege on Ubuntu, run the following commands:
sudo apt update -y
sudo apt install siege -y
siege --version
Retrieve the host IP address
For the Ubuntu image to reach the Windows host, retrieve the host IP from /etc/resolv.conf. The following command prints the IP address directly to the terminal:
grep -m 1 nameserver /etc/resolv.conf | awk '{print $2}'
172.18.224.1
Your IP will differ; use the value returned on your machine in the steps below.
Start the web application
I have PowerShell Universal installed as a service, listening on its default port of 5000. For this test, create an API endpoint with New-PSUEndpoint:
New-PSUEndpoint -Url /benchmark -Method GET -Endpoint {
"Hello, world"
}
You can invoke the endpoint locally with PowerShell:
Invoke-RestMethod http://localhost:5000/benchmark
From within WSL2, invoke the same endpoint with wget, using the host machine IP from the previous step:
wget http://172.18.224.1:5000/benchmark
--2022-04-13 07:21:35-- http://172.18.224.1:5000/benchmark
Connecting to 172.18.224.1:5000... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/json]
Saving to: ‘benchmark’
benchmark [ <=> ] 12 --.-KB/s in 0s
2022-04-13 07:21:35 (1.95 MB/s) - ‘benchmark’ saved [12]
Run a Siege benchmark
To run Siege in benchmark mode, use the -b flag and pass the URL you want to benchmark. By default, it runs with 25 concurrent users:
siege -b http://172.18.224.1:5000/benchmark
I let the benchmark run for some time, then pressed Ctrl+C to stop it. This run lasted about 67 seconds at roughly 1,000 requests per second:
** SIEGE 4.0.4
** Preparing 25 concurrent users for battle.
The server is now under siege...^C
Lifting the server siege...
Transactions: 72893 hits
Availability: 100.00 %
Elapsed time: 67.34 secs
Data transferred: 2.64 MB
Response time: 0.02 secs
Transaction rate: 1082.46 trans/sec
Throughput: 0.04 MB/sec
Concurrency: 24.96
Successful transactions: 72893
Failed transactions: 0
Longest transaction: 0.51
Shortest transaction: 0.01
You can increase the number of concurrent HTTP request threads with the -c parameter:
siege -c 125 -b http://172.18.224.1:5000/benchmark
Conclusion
In this post, we looked at how to install Siege on Ubuntu in WSL2, expose a simple PowerShell Universal endpoint, and run Siege benchmarks against it from Linux.
Want to try this yourself? Grab PowerShell Universal from the download center.

Adam Driscoll