-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2a413a
Showing
17 changed files
with
1,337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
|
||
.vendor/ | ||
|
||
bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"editor.formatOnSave": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
### [v1.0.0] (2024-11-07) | ||
|
||
- Initialize the project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
FROM golang:1.23 as build | ||
|
||
# See https://stackoverflow.com/a/55757473/12429735 | ||
ENV USER=appuser | ||
ENV UID=10001 | ||
RUN adduser \ | ||
--disabled-password \ | ||
--gecos "" \ | ||
--home "/nonexistent" \ | ||
--shell "/sbin/nologin" \ | ||
--no-create-home \ | ||
--uid "${UID}" \ | ||
"${USER}" | ||
|
||
RUN apt-get update && apt-get install -y ca-certificates | ||
RUN go get github.com/trinhminhtriet/blast | ||
|
||
# Build | ||
WORKDIR /go/src/github.com/trinhminhtriet/blast | ||
RUN go mod download | ||
RUN CGO_ENABLED=0 GOOS=linux go build -o /go/bin/blast blast.go | ||
|
||
############################################################################### | ||
# final stage | ||
FROM scratch | ||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=build /etc/passwd /etc/passwd | ||
COPY --from=build /etc/group /etc/group | ||
USER appuser:appuser | ||
|
||
ARG APPLICATION="blast" | ||
ARG DESCRIPTION="🚀 Blast: A powerful, lightweight HTTP load generator for stress testing and benchmarking web applications with ease." | ||
ARG PACKAGE="trinhminhtriet/blast" | ||
|
||
LABEL org.opencontainers.image.ref.name="${PACKAGE}" \ | ||
org.opencontainers.image.authors="Triet Trinh <contact@trinhminhtriet.com>" \ | ||
org.opencontainers.image.documentation="https://github.com/${PACKAGE}/README.md" \ | ||
org.opencontainers.image.description="${DESCRIPTION}" \ | ||
org.opencontainers.image.licenses="MIT" \ | ||
org.opencontainers.image.source="https://github.com/${PACKAGE}" | ||
|
||
COPY --from=build /go/bin/${APPLICATION} /blast | ||
ENTRYPOINT ["/blast"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 trinhminhtriet.com | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
binary = blast | ||
|
||
release: | ||
GOOS=windows GOARCH=amd64 go build -o ./bin/$(binary)_windows_amd64 | ||
GOOS=linux GOARCH=amd64 go build -o ./bin/$(binary)_linux_amd64 | ||
GOOS=darwin GOARCH=amd64 go build -o ./bin/$(binary)_darwin_amd64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# 🚀 Blast | ||
|
||
```text | ||
_ _ _ | ||
| |__ | | __ _ ___ | |_ | ||
| '_ \ | | / _` |/ __|| __| | ||
| |_) || || (_| |\__ \| |_ | ||
|_.__/ |_| \__,_||___/ \__| | ||
``` | ||
|
||
🚀 Blast: A powerful, lightweight HTTP load generator for stress testing and benchmarking web applications with ease. | ||
|
||
## ✨ Features | ||
|
||
- **High-Performance Load Testing**: Send a specified number of requests at customizable concurrency levels to simulate real-world traffic and measure server response. | ||
- **HTTP/2 Support**: Fully compatible with HTTP/2, allowing for efficient, high-throughput testing on modern web servers. | ||
|
||
- **Flexible Rate Limiting**: Control request rate per worker (QPS) for fine-grained load management. | ||
- **Duration-Based Testing**: Specify a duration to run tests continuously, ideal for long-term stress tests without counting requests. | ||
|
||
- **Multiple HTTP Methods**: Supports a variety of HTTP methods including GET, POST, PUT, DELETE, HEAD, and OPTIONS. | ||
|
||
- **Customizable Headers**: Add multiple custom headers for testing with different request configurations. | ||
|
||
- **Detailed Output Options**: Choose between summary output or CSV format for detailed, structured response metrics. | ||
|
||
- **Timeout Control**: Configure request timeouts to handle slow or unresponsive servers. | ||
|
||
- **Request Body Support**: Send custom request bodies from text or file, supporting various payloads for POST/PUT tests. | ||
|
||
- **Compression and Keep-Alive Control**: Optionally disable compression and keep-alive to test under different connection settings. | ||
|
||
- **HTTP Redirect Handling**: Enable or disable following of HTTP redirects as needed. | ||
|
||
- **Proxy Support**: Route requests through an HTTP proxy for testing in specific network setups. | ||
|
||
- **CPU Core Utilization Control**: Specify the number of CPU cores for optimal load distribution based on your machine’s capabilities. | ||
|
||
## 🚀 Installation | ||
|
||
TBD | ||
|
||
## 💡 Usage | ||
|
||
`blast` runs a specified number of requests at a given concurrency level, providing comprehensive performance stats. Supports HTTP/2. | ||
|
||
```bash | ||
Usage: blast [options...] <url> | ||
|
||
Options: | ||
-n Number of requests to send (default: 200). | ||
-c Concurrent workers (default: 50). | ||
-q Rate limit per worker in QPS. | ||
-z Duration of request sending (overrides -n). Ex: -z 10s, -z 3m. | ||
-o Output format (default: summary; options: csv). | ||
|
||
-m HTTP method (GET, POST, PUT, DELETE, etc.). | ||
-H Custom headers. Repeatable, e.g., -H "Content-Type: application/json". | ||
-t Request timeout in seconds (default: 20). | ||
-A HTTP Accept header. | ||
-d Request body. | ||
-D Request body from file (e.g., ./file.txt). | ||
-T Content-Type header (default: "text/html"). | ||
-a Basic auth in username:password format. | ||
-x Proxy address as host:port. | ||
-h2 Enable HTTP/2. | ||
|
||
-host HTTP Host header. | ||
-disable-compression Disable response compression. | ||
-disable-keepalive Disable TCP keep-alive for requests. | ||
-disable-redirects Prevents following HTTP redirects. | ||
-cpus Number of CPU cores to use (default: machine max). | ||
``` | ||
|
||
## 🤝 How to contribute | ||
|
||
We welcome contributions! | ||
|
||
- Fork this repository; | ||
- Create a branch with your feature: `git checkout -b my-feature`; | ||
- Commit your changes: `git commit -m "feat: my new feature"`; | ||
- Push to your branch: `git push origin my-feature`. | ||
|
||
Once your pull request has been merged, you can delete your branch. | ||
|
||
## 📝 License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
Oops, something went wrong.