Sign inSign up

zhangsean/web-delay

By zhangsean

Updated over 5 years ago

Web delay simulation powered by go.

Image
1

1.6K

zhangsean/web-delay repository overview

web-delay

Web delay simulation powered by go.

DockerHub Badge

Usage

docker run -itd --name web-delay -p 8080:80 zhangsean/web-delay
docker logs -f web-delay
Urls

Simulate web request cost

  • Visit http://localhost:8080/ to simulate a delay of random time from 0 to 1000 ms in every request.
  • Visit http://localhost:8080/?max=100 to simulate a delay of random time from 0 to 100 ms in every request.
  • Visit http://localhost:8080/?ms=10 to simulate a delay of 10 ms in every request.
  • Visit http://localhost:8080/?ms=10&text=word to simulate a delay of 10 ms and respond with the specific text word in every request.

View request list

  • Visit http://localhost:8080/requests to view all request list in processing.
  • Visit http://localhost:8080/requests?status=1 to view all done request list.
  • Visit http://localhost:8080/requests?status=2 to view all request list.

Go build

cd ~/go/src
git clone https://github.com/zhangsean/web-delay.git
cd web-delay
go build
# Please make sure local port 80 is free.
./web-delay
# Show help
./web-delay -help
# Usage
Usage of ./web-delay:
  -d    Show debug log.
  -p int
        Local port to listen (default 80)
  -v    Show version.

Visit http://localhost/?ms=100 to simulate a delay of 100 ms in every request.

Docker build

docker build -t image:tag .
docker run -itd --name web-delay -p 888:80 image:tag

Visit http://localhost:888/?ms=1000 to simulate a delay of 1000 ms in every request.

Tag summary

Content type

Image

Digest

Size

1.9 MB

Last updated

over 5 years ago

docker pull zhangsean/web-delay