Skip to content

Commit

Permalink
Sarthak | Updates README
Browse files Browse the repository at this point in the history
  • Loading branch information
SarthakMakhija committed Mar 28, 2024
1 parent c58d62c commit 6c6d3ef
Showing 1 changed file with 16 additions and 39 deletions.
55 changes: 16 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,23 @@ All we needed was a tool that can send load (or specific load) on target TCP ser
## Features

**blast** provides the following features:
1. Support for **sending N requests** to the target server.
1. Support for sending **N requests per second per worker**.
2. Support for **reading N total responses** from the target server.
3. Support for **reading N successful responses** from the target server.
4. Support for **customizing** the **load** **duration**. By default, blast runs for 20 seconds.
5. Support for sending N requests to the target server with the specified **concurrency** **level**.
5. Support for sending requests to the target server with the specified **concurrency level**.
6. Support for **establishing N connections** to the target server.
7. Support for specifying the **connection timeout**.
8. Support for specifying **requests per second** (also called **throttle**).
9. Support for **printing** the **report**.
8. Support for **printing** the **report**.
9. Support for sending dynamic payloads with **PayloadGenerator**.

## Installation

### MacOS

1. **Download the current release**

`wget -o - https://github.com/SarthakMakhija/blast/releases/download/v0.0.3/blast_Darwin_x86_64.tar.gz`
`wget -o - https://github.com/SarthakMakhija/blast/releases/download/v0.0.6/blast_Darwin_x86_64.tar.gz`

3. **Unzip the release in a directory**

Expand All @@ -63,7 +63,7 @@ All we needed was a tool that can send load (or specific load) on target TCP ser

1. **Download the current release**

`wget -o - https://github.com/SarthakMakhija/blast/releases/download/v0.0.3/blast_Linux_x86_64.tar.gz`
`wget -o - https://github.com/SarthakMakhija/blast/releases/download/v0.0.6/blast_Linux_x86_64.tar.gz`

2. **Unzip the release in a directory**

Expand All @@ -73,11 +73,10 @@ All we needed was a tool that can send load (or specific load) on target TCP ser

| **Flag** | **Description** |
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| n | Number of requests to run. **Default is 1000.** |
| c | Number of workers to run concurrently. **Default is 50.** |
| f | File path containing the payload. |
| rps | Rate limit in requests per second per worker. **Default is no rate limit.** |
| z | Duration of the blast to send requests. **Default is 20 seconds.** |
| rps | Rate limit in requests per second per worker. **Default is 50.** |
| z | Duration of the blast to run. **Default is 20 seconds.** |
| t | Timeout for establishing connection with the target server. **Default is 3 seconds.** |
| Rr | Read responses from the target server. **Default is false.** |
| Rrs | Read response size is the size of the responses in bytes returned by the target server. |
Expand All @@ -93,26 +92,16 @@ All we needed was a tool that can send load (or specific load) on target TCP ser

Yes.

The following command sends 200000 requests, over 10 TCP connections using 100 concurrent workers.
The following command sends 100 requests per second per worker, over 10 TCP connections using 100 concurrent workers.
```sh
./blast -n 200000 -c 100 -conn 10 -f ./payload localhost:8989
./blast -rps 100 -c 100 -conn 10 -f ./payload localhost:8989
```

2. **Are the workers implemented using goroutines?**

Yes, workers are implemented as cooperative goroutines. You can refer the code [here](https://github.com/SarthakMakhija/blast/blob/main/workers/worker.go).

3. **I want to send 1001 requests using 100 workers. How many requests will each worker send?**

Let's consider two cases.

**Case1**: Total requests % workers = 0. Let's consider **200 requests** with **10 workers**. **Each** **worker** will send **20 requests**.

**Case2**: Total requests % workers != 0. Let's consider **1001 requests** with **100 workers**. **blast** will end up sending **1100 requests**, and **each worker** will send **11 requests**.

You can refer the code [here](https://github.com/SarthakMakhija/blast/blob/main/workers/worker_group.go#L52).

4. **Can I create more connections than workers?**
3. **Can I create more connections than workers?**

No, you can not create more connections that workers. The relationship between the concurrency and the workers is simple: `concurrency % workers must be equal to zero`.
This means, we can have 100 workers with 10 connections, where a group of 10 workers will share one connection.
Expand Down Expand Up @@ -156,25 +145,13 @@ byte slice) that [ResponseReader](https://github.com/SarthakMakhija/blast/blob/m

8. **What is the significance of Rrd flag in blast?**

`Rrd` is the read response deadline flag that defines the deadline for the read calls on connections. This flag helps in understanding the responsiveness of the target server. Let's consider that we are running **blast** with the following command:

`./blast -n 200000 -c 100 -conn 100 -f ./payload -Rr -Rrs 19 -Rrd 10ms -Rtr 200000 localhost:8989`.

Here, `Rrd` is 10 milliseconds, this means that the `read` calls in [ResponseReader](https://github.com/SarthakMakhija/blast/blob/main/report/response_reader.go) will block for 10ms and then timeout if there is no response on the underlying connection.

## Screenshots

- **Sending load on the target server:** `./blast -n 200000 -c 100 -conn 100 -f ./payload localhost:8989 2> err.log`

<img width="715" alt="Sending load on the target server" src="https://github.com/SarthakMakhija/blast/assets/21108320/0eca825c-22e5-4120-9460-cf5eead92c9b">

- **Reading responses from the target server:** `./blast -n 200000 -c 100 -conn 100 -f ./payload -Rr -Rrs 19 -Rtr 200000 localhost:8989 2> err.log`

<img width="715" alt="Reading responses from the target server" src="https://github.com/SarthakMakhija/blast/assets/21108320/d15a1782-b1e6-4200-b697-1083015c3cb3">
`Rrd` is the read response deadline flag that defines the deadline for the read calls on connections.
This flag helps in understanding the responsiveness of the target server. Let's consider that we are running **blast** with the following command:

- **Error distribution:** `./blast -n 200000 -c 100 -conn 100 -f ./payload localhost:8989 2> err.log`
`./blast -c 100 -conn 100 -f ./payload -Rr -Rrs 19 -Rrd 10ms -Rtr 200000 localhost:8989`.

<img width="715" alt="Error distribution" src="https://github.com/SarthakMakhija/blast/assets/21108320/b4ca41cd-17ea-497e-9290-29eeb8ba2089">
Here, `Rrd` is 10 milliseconds, this means that the `read` calls in [ResponseReader](https://github.com/SarthakMakhija/blast/blob/main/report/response_reader.go) will block for 10ms and
then timeout if there is no response on the underlying connection.

## References
[hey](https://github.com/rakyll/hey)
Expand Down

0 comments on commit 6c6d3ef

Please sign in to comment.