Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patrickhulce/node-siegem
https://github.com/patrickhulce/node-siegem
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/patrickhulce/node-siegem
- Owner: patrickhulce
- Created: 2016-06-22T00:21:32.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2023-08-10T02:47:26.000Z (over 1 year ago)
- Last Synced: 2024-10-19T00:51:16.846Z (25 days ago)
- Language: TypeScript
- Size: 312 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SIEGE iMproved
A _mostly_ API-compatible node implementation of the fantastic siege command-line utility for benchmarking and stress testing servers. Improvements include enhanced granularity for request timing, simplified POST/PUT/DELETE usage (inspired by curl), and easy-to-use programmatic API.
## Installation
```sh
$ npm install -g siegem
```## Usage
```sh
$ siegem --help
```## Examples
### Quick Benchmark
Continuously hit `/ping` with 100 concurrent users 100 times each (will request 10000 times and then stop).
```sh
$ siegem -c 100 -d0 -r 100 http://localhost:3000/ping
```### Long Benchmark
For 15 minutes, hit `/test` with 50 concurrent users that wait up to 5 seconds before requesting again.
```sh
$ siegem -c 50 -d 5000 -t 15m http://localhost:3000/test
```### PUT Some Data
```sh
$ siegem -c 5 -X PUT -H 'Content-Type: application/json' --data '{"foo": "bar"}' http://localhost:3000/something
```### POST A Lot of Data
```sh
$ siegem -c 5 -X POST -H 'Content-Type: application/json' --data @my_file.json http://localhost:3000/something
```### Hammer Lots of Endpoints
```sh
$ siegem -c 100 --chaotic --file my_urls.txt
```#### `my_urls.txt`
```
http://google.com/
http://facebook.com/
-X HEAD http://twitter.com/
-X HEAD http://yahoo.com/
-X POST -H 'if-none-match: etag123' http://mysite.com/foo
-X DELETE http://mysite.com/other-stuff
-X PUT -H 'content-type: application/json' --data @/var/stuff/my_stuff/data.json http://mysite.com/lots-of-data
```### POST Data with Dependencies
```sh
$ siegem --file my_urls.txt
```#### `my_urls.txt`
1. Label a URL's response by prefixing the line with a variable name beginning with $. (`$msg` in the example below)
2. In a later line, reference a previous response using `%%%%`.
1. `@` - Specify a JSON property path.
2. `/` - Specify a regex to extract.```
$msg -X POST --data '{"message": "foo"}' http://localhost:3000/messages
-X GET 'http://localhost:3000/messages/%%msg@id%%'
-X PUT --data '{"message": "%%msg/.*%%"}' 'http://localhost:3000/messages/%%msg@id%%'
```