Coder Social home page Coder Social logo

pavel-rossinsky / time-to-first-byte Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 1.0 31 KB

Measures Time to First Byte (TTFB) in milliseconds, Server Time, and more for a list of URLs stored in a file. It takes into account Network Latency and Excludes failed requests.

Shell 100.00%
time-to-first-byte ttfb measture-ttfb curl performance

time-to-first-byte's Introduction

The repository contains a bash script that measures Time to First Byte (TTFB), Server Time, and Network Latency for a list of URLs stored in a text file using curl. Excludes failed requests and redirects.

The ttfb.sh script uses curl for measuring the time. An article to read explaining the concept is https://blog.cloudflare.com/a-question-of-timing/

Try it by running command in terminal

curl -w "time_namelookup: %{time_namelookup}\ntime_connect: %{time_connect}\ntime_appconnect: %{time_appconnect}\ntime_redirect: %{time_redirect}\ntime_pretransfer: %{time_pretransfer}\ntime_starttransfer: %{time_starttransfer}\n" -o /dev/null -s "https://www.google.com"

Sample output

time-to-first-byte % ./ttfb.sh -f sample_urls.txt -r

"Counter" "HTTP Code" "URL" "TTFB (ms)" "Server Time minus Latency (ms)" "Latency (ms)"

1 200 https://www.amazon.de/ 158.67 76.72 22.54
2 200 https://en.zalando.de/ 170.91 62.04 21.84
3 301 https://facebook.com/ -
4 200 https://stackoverflow.com/ 215.93 109.69 22.78
5 301 https://google.de/ -
6 200 https://github.com/ 110.85 8.19 27.48
7 200 https://stackoverflow.com/ 211.28 107.90 21.40

Pages visited / evaluated / skipped:   7 / 5 / 2

Total time elapsed:                  0.87 s
Avg TTFB:                            173.53 ms
Avg server time with latency:        96.12 ms
Avg network latency:                 23.21 ms
Avg server time minus latency:       72.91 ms
Avg server time minus latency*2:     49.70 ms

Technical prerequisites

  • curl
  • Git
  • Docker (optionally)

Getting started

Run the commands one by one to run the script:

git clone [email protected]:pavel-rossinsky/time-to-first-byte.git
cd time-to-first-byte
./ttfb.sh -f sample_urls.txt

To see the help text:

./ttfb.sh -h

time-to-first-byte's People

Contributors

pavel-rossinsky avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

maxwellholmann

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.