vegeta-server
vegeta-server copied to clipboard
A RESTful API server for vegeta, a load testing tool written in Go.
Vegeta Server - A RESTful load-testing service
A RESTful API server for vegeta, a load testing tool written in Go.
Vegeta is a versatile HTTP load testing tool built out of a need to drill HTTP services with a constant request rate. The vegeta library is written in Go, which makes it ideal to implement server in Go.
The REST API model enables users to, asynchronously, submit multiple attacks targeting the same (or varied) endpoints, lookup pending or historical reports and update/cancel/re-submit attacks, using a simple RESTful API.
Getting Started
Installing
make all
NOTE:
make allresolves all the dependencies, formats the code usinggofmt, validates and lints usinggolangci-lintandgolint, builds thevegeta-serverbinary and drops it in the/bindirectory and finally runs tests usinggo test.
Quick Start
Start the server using the vegeta-server binary generated after the previous step.
Usage: main [<flags>]
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
--ip="0.0.0.0" Server IP Address.
--port="80" Server Port.
-v, --version Version Info
--debug Enabled Debug
Example
Serve HTTP traffic at 0.0.0.0:80/api/v1
./bin/vegeta-server --ip=0.0.0.0 --port=80 --debug
Try it out using
make runmake run INFO[0000] creating new dispatcher component=dispatcher INFO[0000] starting dispatcher component=dispatcher INFO[0000] listening component=server ip=0.0.0.0 port=80
Using Docker
Build the docker image using local Dockerfile
docker build .
Run the docker container
docker run -d -p 8000:80 --name vegeta {container id}
You can also build and run a docker container using make
make container_run
NOTE:
make containerandmake container_cleancan be used to build the Dockerfile and delete the container and image.
Running tests
make test
Documentation
Contributing
Link to CONTRIBUTING.md
Project Structure
/: Extraneous setup and configuration files. No go code exists at this level./cmd/server: Comprises ofpackage mainserving as an entry point to the code./models: Includes the model definitions used by the DB and the API endpoints./db.go: Provides the storage interface, which is implemented by the configured database.
/internal: Internal only packages used by the server to run attacks and serve reports./dispatcher: Defines and implements the dispatcher interface, with the primary responsibility to carry out concurrent attacks./reporter: Defines and implements the reporter interface, with the primary responsibility to generate reports from previously completed attacks, in supported formats (JSON/Text/Binary)./endpoints: Responsible for defining and registering the REST API endpoint handlers.
/pkg/vegeta: Vegeta library specific, wrapper methods and definitions. (Keep these isolated from the internals of the server, to support more load-testing tools/libraries in the future.)/scripts: Helper installation scripts.
Roadmap
Link to roadmap
License
Link to LICENSE
Support
Contact Author at [email protected]