Skip to content

Latest commit

 

History

History
117 lines (75 loc) · 3.13 KB

File metadata and controls

117 lines (75 loc) · 3.13 KB

siege

If you don't have sudo rights, you can install siege locally in your home directory. Here are the steps to do that:

Step-by-Step Guide to Install siege Locally

  1. Download the Source Code: Download the siege source code from the official website or a mirror.
wget http://download.joedog.org/siege/siege-latest.tar.gz
  1. Extract the Archive: Extract the downloaded tarball.
tar -xzf siege-latest.tar.gz
cd siege-*/
  1. Configure the Build: Configure the build to install siege in your home directory.
./configure --prefix=$HOME/.local
  1. Compile the Source Code: Compile the source code.
make
  1. Install siege Locally: Install siege in your home directory.
make install
  1. Update Your PATH: Add the local installation directory to your PATH environment variable.
echo 'export PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

Verify the Installation

After completing the steps above, you can verify the installation by running:

siege --version

Now you have siege installed locally in your home directory and can use it to stress test your web applications.

test max connections

To use siege to test the maximum number of connections, idle timeout, and request/response timeouts, you can perform a stress test by simulating a large number of concurrent users and requests. Here are the steps to do that:

Step-by-Step Guide

  • Prepare a URL List: Create a file with the URLs you want to test. For simplicity, you can test a single URL multiple times.
  • Run Siege: Use siege to run the test with a specified number of concurrent users and repetitions.

Example URL List

Create a file named

urls.txt

with the URL you want to test:

http://localhost:8080/

Running Siege

Use the following command to run siege with a specified number of concurrent users and repetitions:

siege -c 200 -r 10 -f urls.txt

Explanation:

  • -c 200: Simulate 200 concurrent users.
  • -r 10: Repeat the test 10 times.
  • -f urls.txt: Use the URLs listed in

urls.txt

.

Monitoring the Server

While running siege, monitor your server logs to see how it handles the connections. Look for the following:

  • 503 Service Unavailable: Indicates that the server has reached the maximum number of connections.
  • 408 Request Timeout: Indicates that a request has timed out.
  • 500 Internal Server Error: Indicates an internal server error.

Example Output

Here is an example of what you might see in your server logs:

[Server] Maximum connections reached, rejecting new connection
[Server] recv timeout: Resource temporarily unavailable
[Server] Closing idle connection 5

Summary

  • Install Siege: Ensure siege is installed.
  • Prepare URL List: Create a file with the URLs to test.
  • Run Siege: Use siege to simulate concurrent users and test the server's maximum connections, idle timeout, and request/response timeouts.
  • Monitor Server: Check server logs for 503 Service Unavailable, 408 Request Timeout, and 500 Internal Server Error responses.