A Docker image to get the response time of a website.
206
A Docker image to help you get a nicely formatted result for the response time of a website or API.
I write a lot of technical blog posts, and I often want to compare the response time of various hosting providers from different locations around the world. I used to use Pingdom for these tests, but it doesn't support request bodies, headers, or different methods (POST, PUT, etc.).
I found this answer on Stack Overflow, but I wanted to simplify it and put it in a ready-to-deploy Docker image so I could quickly run it on any host that will run a Docker container.
Pull the latest version from Docker Hub:
docker pull xxx/rt
A simple GET request:
docker run --rm rt jsonplaceholder.typicode.com/posts
# Response
final_url: http://jsonplaceholder.typicode.com/posts
response_code: 200s
time_namelookup: 0.025098s
time_connect: 0.042070s
time_appconnect: 0.000000s
time_pretransfer: 0.042265s
time_redirect: 0.000000s
time_starttransfer: 0.091801s
----------
time_total: 0.098020s
A more complex POST request (you can use any of the args that curl supports):
docker run --rm rt jsonplaceholder.typicode.com/posts -H 'Content-Type: application/json' -d '{"title": "Another great post"}' -X POST
# Response
final_url: http://jsonplaceholder.typicode.com/posts
response_code: 201s
time_namelookup: 0.014518s
time_connect: 0.029930s
time_appconnect: 0.000000s
time_pretransfer: 0.029982s
time_redirect: 0.000000s
time_starttransfer: 0.143273s
----------
time_total: 0.143517s
Improvements are welcome, but please use the Issues to discuss them first. This is a simple script, so I don't envision bundling much more functionality into it.
Copyright 2020, Draft.dev
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.
Content type
Image
Digest
Size
5.1 MB
Last updated
about 6 years ago
docker pull karllhughes/response-timer