time-to-first-byte

A script to display the time-to-first-byte for any given url.

https://github.com/platformengineerstoolbox/time-to-first-byte

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary

Keywords

latency-test time-to-first-byte wolfsoftware
Last synced: 6 months ago · JSON representation ·

Repository

A script to display the time-to-first-byte for any given url.

Basic Info
  • Host: GitHub
  • Owner: PlatformEngineersToolbox
  • License: mit
  • Language: Shell
  • Default Branch: master
  • Homepage:
  • Size: 188 KB
Statistics
  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • Open Issues: 3
  • Releases: 2
Topics
latency-test time-to-first-byte wolfsoftware
Created about 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing Funding License Code of conduct Citation Codeowners Security

README.md

PlatformEngineersToolbox logo
Github Build Status License Created
Release Released Commits since release

Overview

This tool is designed to allow you to measure and display the 'Time To First Byte' (ttfb) for a given url. It can also help identify bottlenecks or latency issues that might be causing slow responses.

We also provide a python package if you prefer that to a bash script.

Usage

``` Usage: ./ttfb.sh [ -hfmv ] [ -c count ] [ -u url ]

-h    : Print this screen
-v    : show the current version of the script
-f    : Show full set of timing values
-m    : Show minimal setof timing values
-c    : How many times to test
-u    : The url to test

``` NOTE -u is not required if you put the url as the last parameter.

Results Output

Single Connection Test

Standard Output (Default)

─────────────────────────────────────────────────────────────────────────────────────────────────────────── Time to First Byte Test ─────────────────────────────────────────────────────────────────────────────────────────────────────────── Lookup Time: 0.005087 Connect Time: 0.025123 StartXfer Time (TTFB): 0.111106 Total Time: 0.111173 ───────────────────────────────────────────────────────────────────────────────────────────────────────────

Minimal Output (-m)

────────────────────────────────────────────────────────── Time to First Byte Test ────────────────────────────────────────────────────────── StartXfer Time (TTFB): 0.106124 Total Time: 0.106208 ──────────────────────────────────────────────────────────

Full Output (-f)

────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Time to First Byte Test ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── Lookup Time: 0.004987 Connect Time: 0.022486 AppCon Time: 0.089366 PreXfer Time: 0.089427 Redirect Time: 0.000000 StartXfer Time (TTFB): 0.108404 Total Time: 0.108475 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Repeated Connection Test

It is also possible to specify how many connections to make when testing by adding the -c flag. This can be combined with the existing output flags (-m and -f)

─────────────────────────────────────────────────────────────────────────────────────────────────────────── Time to First Byte Test ─────────────────────────────────────────────────────────────────────────────────────────────────────────── Lookup Time: 0.005112 Connect Time: 0.034810 StartXfer Time (TTFB): 0.119705 Total Time: 0.119777 Lookup Time: 0.005087 Connect Time: 0.023240 StartXfer Time (TTFB): 0.108551 Total Time: 0.108623 Lookup Time: 0.004158 Connect Time: 0.021478 StartXfer Time (TTFB): 0.110971 Total Time: 0.111036 Lookup Time: 0.005108 Connect Time: 0.022807 StartXfer Time (TTFB): 0.111455 Total Time: 0.111526 Lookup Time: 0.004764 Connect Time: 0.022720 StartXfer Time (TTFB): 0.111475 Total Time: 0.111547 ───────────────────────────────────────────────────────────────────────────────────────────────────────────

Exceptional lag test

─────────────────────────────────────────────────────────────────────────────────────────────────────────── Time to First Byte Test ─────────────────────────────────────────────────────────────────────────────────────────────────────────── Lookup Time: 0.005257 Connect Time: 0.023145 StartXfer Time (TTFB): 0.123785 Total Time: 1.399076 Lookup Time: 0.004230 Connect Time: 0.021909 StartXfer Time (TTFB): 0.109505 Total Time: 1.218776 Lookup Time: 0.004481 Connect Time: 0.022189 StartXfer Time (TTFB): 0.111843 Total Time: 1.293919 Lookup Time: 0.005262 Connect Time: 0.023195 StartXfer Time (TTFB): 0.113860 Total Time: 1.258916 Lookup Time: 0.005240 Connect Time: 0.023303 StartXfer Time (TTFB): 0.113752 Total Time: 1.227184 ───────────────────────────────────────────────────────────────────────────────────────────────────────────

NOTE: We used https://flash.siwalik.in/ which is a website which allows you to intentionally add lag/latency to a connection. We forced the addition of 1000ms just to demonstrate the script functions as expected.

In the above example prefixed the normal url with https://flash.siwalik.in/delay/1000/url/ to create this intentional lag.

Timing Key

| Time | Description | | --- | --- | | Lookup time (timenamelookup) | The time, in seconds, it took from the start until the name resolving was completed. | | Connect time (timeconnect) | The time, in seconds, it took from the start until the TCP connect to the remote host was completed. | | AppCon time (timeappconnect) | The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed. | | PreXfer time (timepretransfer) | The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all 'pre-transfer' commands and negotiations that are specific to the particular protocol(s) involved. | | Redirect time (timeredirect) | The time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before the final transaction was started. 'timeredirect' shows the complete execution time for multiple redirections. | | StartXfer time (timestarttransfer) | The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes 'timepretransfer' and also the time the server needed to calculate the result. | | Total time | The sum of all the other times |

Response Times: The 3 Important Limits

Short note for your information.

  • 0.1 second – is about the limit for having the user feel that the system is reacting instantaneously, meaning that no special feedback is necessary except to display the result;
  • 1.0 second – is about the limit for the user’s flow of thought to stay uninterrupted, even though the user will notice the delay. Normally, no special feedback is necessary during delays of more than 0.1 but less than 1.0 second, but the user does lose the feeling of operating directly on the data;
  • 10 seconds – is about the limit for keeping the user’s attention focused on the dialogue. For longer delays, users will want to perform other tasks while waiting for the computer to finish, so they should be given feedback indicating when the computer expects to be done. Feedback during the delay is especially important if the response time is


Owner

  • Name: Platform Engineers Toolbox
  • Login: PlatformEngineersToolbox
  • Kind: organization
  • Email: github@wolfsoftware.com
  • Location: United Kingdom

A selection of tools to help platform engineers. Created by Wolf Software.

Citation (CITATION.cff)

cff-version: 1.2.0
message: If you use this software, please cite it using these metadata.
title: Time to First Byte
abstract: Display the time-to-first-byte for any given url.
type: software
version: 0.1.0
date-released: 2024-05-22
repository-code: https://github.com/PlatformEngineersToolbox/time-to-first-byte
keywords:
  - "Wolf Software"
  - "Software"
license: MIT
authors:
  - family-names: "Wolf"
    orcid: "https://orcid.org/0009-0007-0983-2072"

GitHub Events

Total
  • Watch event: 1
  • Delete event: 61
  • Issue comment event: 131
  • Push event: 122
  • Pull request review event: 109
  • Pull request event: 126
  • Create event: 65
Last Year
  • Watch event: 1
  • Delete event: 61
  • Issue comment event: 131
  • Push event: 122
  • Pull request review event: 109
  • Pull request event: 126
  • Create event: 65

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 42
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.93
  • Merged pull requests: 35
  • Bot issues: 0
  • Bot pull requests: 42
Past Year
  • Issues: 0
  • Pull requests: 42
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.93
  • Merged pull requests: 35
  • Bot issues: 0
  • Bot pull requests: 42
Top Authors
Issue Authors
  • dependabot[bot] (2)
Pull Request Authors
  • dependabot[bot] (88)
Top Labels
Issue Labels
dependabot: dependencies (2) dependabot: ecosystem : github actions (2) dependabot: auto approve (2) dependabot: auto merge (2)
Pull Request Labels
dependabot: dependencies (88) dependabot: ecosystem : github actions (88) dependabot: auto approve (80) dependabot: auto merge (80) dependabot: manual merge (3)