This application continuously sends POST requests to a URL shortener service at http://localhost:8080/shorten with random data. It tracks failed requests and stops when the number of failed requests reaches 10 or the total number of requests sent reaches 10 million. Additionally, it sends override requests to http://localhost:8080/admin/override/:shortcode for 20% of the future-dated successful requests from each batch.
- The target URL for the URL shortener service is
http://localhost:8080/shorten. - The target URL for the override service is
http://localhost:8080/admin/override/:shortcode. - The API key for authentication is
your_user_key. - The admin key for override requests is
your_admin_key.
- The application generates random request data, including a
long_urland arelease_date. - It sends POST requests in batches of 100 per runner to the URL shortener service. It runs 5 concurrent runners by default.
- If a request fails, the request data is stored in a map of failed requests.
- The application prints the details of failed requests and the total number of requests sent after each batch.
- The application waits for 2 seconds before sending the next batch.
- The application selects 20% of the future-dated successful requests from each batch and sends override requests to the override service.
- The loop continues for each runner until the number of failed requests reaches 10 or the total number of requests sent reaches 10 million.
- Ensure that the URL shortener service is running at
http://localhost:8080/shorten. - Ensure that the override service is running at
http://localhost:8080/admin/override/:shortcode. - Update the
userKeyandadminKeyvariables inmain.gowith your actual keys if different fromyour_user_keyandyour_admin_key. - Run the application
go run main.go
- Go 1.16 or later
2025-03-17: Added support for multiple runners.