Skip to main content

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 simple bash version if you prefer that to a python package.

Installation

pip install wolfsoftware.ttfb

Usage

usage: ttfb [-h] [-d] [-v] [-V] [-m | -f] [-c COUNT] -u URL

Display the time-to-first-byte for any given url.

flags:
  -h, --help            show this help message and exit
  -d, --debug           Very noisy (default: False)
  -v, --verbose         Verbose output - show scan results as they come in (default: False)
  -V, --version         Show program's version number and exit.

exclusive flags:
  -m, --minimal         Show minimal set of timing values. (default: False)
  -f, --full            Show full set of timing values. (default: False)

optional:
  -c COUNT, --count COUNT
                        How many times to test [1-25] (default: 1)

required:
  -u URL, --url URL     The URL to test (default: None)

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
-----------------------------------------------------------------------------------------------------------

Timing Key

Time Description
Lookup time (time_namelookup) The time, in seconds, it took from the start until the name resolving was completed.
Connect time (time_connect) The time, in seconds, it took from the start until the TCP connect to the remote host was completed.
AppCon time (time_appconnect) The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed.
PreXfer time (time_pretransfer) 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 (time_redirect) The time, in seconds, it took for all redirection steps include name lookup, connect, pretransfer and transfer before the final transaction was started. 'time_redirect' shows the complete execution time for multiple redirections.
StartXfer time (time_starttransfer) The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes 'time_pretransfer' 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

Release files for wolfsoftware.ttfb 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wolfsoftware.ttfb 0.1.2
File Size Uploaded
wolfsoftware_ttfb-0.1.2.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wolfsoftware.ttfb 0.1.2
File Interpreter ABI Platform
wolfsoftware.ttfb-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.4 kB

Release files / wolfsoftware_ttfb-0.1.2.tar.gz

Download URL wolfsoftware_ttfb-0.1.2.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6f641c7969a4ae8304e0f6e2ab47598b10a5babdff4137d2cc96a2d4e580e950
BLAKE2b-256 checksum
How to use checksums
c0702d288390a3e2c2e18c7a84a4a54f5a681f89c030822f2702756e8124b382
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / wolfsoftware.ttfb-0.1.2-py3-none-any.whl

Download URL wolfsoftware.ttfb-0.1.2-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b08c2807f0afcb5362400046dff8b0afb1443ce2af48861e076da24d27745e9
BLAKE2b-256 checksum
How to use checksums
a1fc18a18b7b05a847f01a60066156e91d0f6c1060f712f21450396475b3f4b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page