Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Siege, a Web performance stress testing tool

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

Web performance stress testing tool Siege how to use, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Siege is an open source stress testing tool designed to assess the resilience of WEB applications under stress. Multi-user concurrent access to a WEB site can be carried out according to the configuration, recording the corresponding time of all request processes for each user, and repeating it under a certain number of concurrent visits.

Siege can request a random URL from the list of presets you choose. So siege can be used to simulate user request load, while ab cannot. However, do not use siege to perform * * performance benchmarking tests. Ab is much more accurate in this respect.

Siege official website: http://www.joedog.org/

I. installation

Compilation and installation

Wget http://www.joedog.org/pub/siege/siege-latest.tar.gz tar-zxvf siege-latest.tar.gz cd siege-2.72/. / configure make make install

Install through package

Debian/Ubuntu

Apt-get install siege

CentOS

Yum install siege

Second, detailed explanation of parameters

Command line argument description:

-C, or-config prints on the screen showing the current configuration, which is included in his configuration file HOME/.siegerc

-f FILE,-file=FILE specify to run siege with a specific urls file. Default is urls.txt, which is located in etc/urls.txt under the siege installation directory.

The-u URL,-url=URL test specifies a URL and "siege" it. This option ignores settings about the urls file.

-b for stress testing without delay.

-A,-user-agent= "text" sets the requested User-Agent

Siegerc profile description:

Verbose: do you want to show the process?

Display-id: when displaying the process, do you want to display the id that simulates the user

Show-logfile: do you want to display log information after running?

Logging: do you want to log to the file?

Logfile: what is the file name if you want to log to the file

Protocol: HTTP communication protocol (either HTTP/1.1 or HTTP/1.0)

Connection: keep-alive means simulated as persistent connection (vice versa when writing close)

Concurrent: simulate how many user come to punch

Time: how long will it stop after running (H=hours, M=minutes, S=seconds)

Reps: each concurrent is flushed several times.

File: the location of the url file in the case of multiple destination url.

Url: specified url in the case of a single url

Delay: in non-benchmakr lines, each analog user randomly delays 0 to this number (in seconds).

Timeout: socket connection timeout (in seconds).

Failures: the number of socket failures (timeouts, connection failures) stops when it reaches this number.

Internet: grab the url randomly from the urls.txt, otherwise sequence from the urls.txt.

Benchmark: if you run benchmark mode, siege will not delay between each connection, which is suitable for load testing.

User-agent: outgoing agent identification

Login: WWW-Authenticate login (login = jdfulmer:topsecret:Admin) (non-form based)

Username,password: also used by login (non-form based)

Login URL: * login url (form based) that each simulated user must pass through.

Proxy-host,proxy-port,proxy-login: fill in this if you use proxy. (proxy-login: jeff:secret:corporate)

Follow-location: redirection support

Zero-data-ok: whether to accept zero-length data or not

Chunked: HTTP/1.1 needs chunked encoding

III. Examples of usage

Siege-c 300-r 100-f url.txt

Note:-c is the concurrency and-r is the number of repeats. Url.txt is a text file in which the url,url.txt to be tested is a url on each line.

The urls.txt file is a list of many lines of URL to be tested broken by newline characters in the format:

[protocol://] host.domain.com [: port] [path/to/file]

Url.txt content:

Http://192.168.80.166/01.jpg

Http://192.168.80.166/02.jpg

Http://192.168.80.166/03.jpg

Http://192.168.80.166/04.jpg

Http://192.168.80.166/05.jpg

Http://192.168.80.166/06.jpg

The results show that:

* * SIEGE 2.72 * * Preparing 10 concurrent users for battle. The server is now under siege.. Done. Transactions: 300 hits # completed Department Availability: 100.00% # completion success rate Elapsed time: 0.08 secs # Total time used Data transferred: 0.94 MB # Total size of data in response Response time: 0.00 secs # shows the speed of the network connection Transaction rate : 3750.00 trans/sec # average number of transactions completed per second Throughput: 11.79 MB/sec # average amount of data transferred per second Concurrency: 8.50 # actual * concurrent links Successful transactions: 3750.00 # number of successful processing Failed transactions: 0 # number of failed processing Longest transaction: 0.01 # longest transaction time Shortest transaction: 0.00 # minimum transaction time

4. Examples of commonly used siege commands

200 concurrent requests to www.google.com 100 times

Siege-c 200-r 100 http://www.google.com

List all URLs in urls.txt

Siege-c 200-r 100-f urls.txt

Randomly select all the URLs listed in the urls.txt

Siege-c 200-r 100-f urls.txt-I

Delay=0, a more accurate stress test than a functional test

Siege-c 200-r 100-f urls.txt-I-b

Specify the http request header document type

Siege-H "Content-Type:application/json"-c 200-r 100-f urls.txt-I-b

5. Some summary of the use of Siege

When sending a post request, the url format is: http://www.xxxx.com/ POST p1=v1&p2=v2

If the url contains spaces and Chinese characters, url should be encoded first, otherwise the request url sent by siege is inaccurate

Siege itself also feels that there is a bottleneck, and the number of concurrency is only 1000. If you improve it, you will report the following error.

[error] socket: unable to connect sock.c:222: Operation already in progress socket: connection timed out

In the end, as a result, the test results could not exceed 2W requests per second, so the siege-c 1000-r 1000-I-b-f url.txt was put into shell to execute concurrently.

#! / bin/bash user_agent= "Siege 1.0" siege_rc= "siege.rc" concurrent=150 repet=200 siege_single_urls= "singleurl.txt" siege_prefix_urls= "prefixurl.txt" for i in {1.. 10} do siege-c $concurrent-r $repet-I-b-f $siege_single_urls-R $siege_rc-A "$user_agent" &; is it helpful for done to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report