<!-- markdownlint-disable -->
<p align="center">
<a href="https://github.com/PlatformEngineersToolbox/">
<img src="https://cdn.wolfsoftware.com/assets/images/github/organisations/platformengineerstoolbox/black-and-white-circle-256.png" alt="PlatformEngineersToolbox logo" />
</a>
<br />
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/actions/workflows/cicd.yml">
<img src="https://img.shields.io/github/actions/workflow/status/PlatformEngineersToolbox/time-to-first-byte-package/cicd.yml?branch=master&label=build%20status&style=for-the-badge" alt="Github Build Status" />
</a>
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/LICENSE.md">
<img src="https://img.shields.io/github/license/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=License&style=for-the-badge" alt="License">
</a>
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package">
<img src="https://img.shields.io/github/created-at/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=Created&style=for-the-badge" alt="Created">
</a>
<br />
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/releases/latest">
<img src="https://img.shields.io/github/v/release/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=Latest%20Release&style=for-the-badge" alt="Release">
</a>
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/releases/latest">
<img src="https://img.shields.io/github/release-date/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=Released&style=for-the-badge" alt="Released">
</a>
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/releases/latest">
<img src="https://img.shields.io/github/commits-since/PlatformEngineersToolbox/time-to-first-byte-package/latest.svg?color=blue&style=for-the-badge" alt="Commits since release">
</a>
<br />
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/.github/CODE_OF_CONDUCT.md">
<img src="https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge" />
</a>
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/.github/CONTRIBUTING.md">
<img src="https://img.shields.io/badge/Contributing-blue?style=for-the-badge" />
</a>
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/.github/SECURITY.md">
<img src="https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge" />
</a>
<a href="https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/issues">
<img src="https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge" />
</a>
</p>
## 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](https://github.com/PlatformEngineersToolbox/time-to-first-byte) if you prefer that to a python package.
## Installation
```shell
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
<br />
<p align="right"><a href="https://wolfsoftware.com/"><img src="https://img.shields.io/badge/Created%20by%20Wolf%20on%20behalf%20of%20Wolf%20Software-blue?style=for-the-badge" /></a></p>
Raw data
{
"_id": null,
"home_page": "https://github.com/PlatformEngineersToolbox/time-to-first-byte-package",
"name": "wolfsoftware.ttfb",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "python, time-to-first-byte",
"author": "Wolf Software",
"author_email": "pypi@wolfsoftware.com",
"download_url": "https://files.pythonhosted.org/packages/32/c5/64438efc87048cb42a63643983a60f034fd8244b2b358c3c49e0725e6bf3/wolfsoftware_ttfb-0.1.1.tar.gz",
"platform": null,
"description": "<!-- markdownlint-disable -->\n<p align=\"center\">\n <a href=\"https://github.com/PlatformEngineersToolbox/\">\n <img src=\"https://cdn.wolfsoftware.com/assets/images/github/organisations/platformengineerstoolbox/black-and-white-circle-256.png\" alt=\"PlatformEngineersToolbox logo\" />\n </a>\n <br />\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/actions/workflows/cicd.yml\">\n <img src=\"https://img.shields.io/github/actions/workflow/status/PlatformEngineersToolbox/time-to-first-byte-package/cicd.yml?branch=master&label=build%20status&style=for-the-badge\" alt=\"Github Build Status\" />\n </a>\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/LICENSE.md\">\n <img src=\"https://img.shields.io/github/license/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=License&style=for-the-badge\" alt=\"License\">\n </a>\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package\">\n <img src=\"https://img.shields.io/github/created-at/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=Created&style=for-the-badge\" alt=\"Created\">\n </a>\n <br />\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/releases/latest\">\n <img src=\"https://img.shields.io/github/v/release/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=Latest%20Release&style=for-the-badge\" alt=\"Release\">\n </a>\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/releases/latest\">\n <img src=\"https://img.shields.io/github/release-date/PlatformEngineersToolbox/time-to-first-byte-package?color=blue&label=Released&style=for-the-badge\" alt=\"Released\">\n </a>\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/releases/latest\">\n <img src=\"https://img.shields.io/github/commits-since/PlatformEngineersToolbox/time-to-first-byte-package/latest.svg?color=blue&style=for-the-badge\" alt=\"Commits since release\">\n </a>\n <br />\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/.github/CODE_OF_CONDUCT.md\">\n <img src=\"https://img.shields.io/badge/Code%20of%20Conduct-blue?style=for-the-badge\" />\n </a>\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/.github/CONTRIBUTING.md\">\n <img src=\"https://img.shields.io/badge/Contributing-blue?style=for-the-badge\" />\n </a>\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/blob/master/.github/SECURITY.md\">\n <img src=\"https://img.shields.io/badge/Report%20Security%20Concern-blue?style=for-the-badge\" />\n </a>\n <a href=\"https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/issues\">\n <img src=\"https://img.shields.io/badge/Get%20Support-blue?style=for-the-badge\" />\n </a>\n</p>\n\n## Overview\n\nThis 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.\n\nWe also provide a simple [bash version](https://github.com/PlatformEngineersToolbox/time-to-first-byte) if you prefer that to a python package.\n\n## Installation\n\n```shell\npip install wolfsoftware.ttfb\n```\n\n## Usage\n\n```\nusage: ttfb [-h] [-d] [-v] [-V] [-m | -f] [-c COUNT] -u URL\n\nDisplay the time-to-first-byte for any given url.\n\nflags:\n -h, --help show this help message and exit\n -d, --debug Very noisy (default: False)\n -v, --verbose Verbose output - show scan results as they come in (default: False)\n -V, --version Show program's version number and exit.\n\nexclusive flags:\n -m, --minimal Show minimal set of timing values. (default: False)\n -f, --full Show full set of timing values. (default: False)\n\noptional:\n -c COUNT, --count COUNT\n How many times to test [1-25] (default: 1)\n\nrequired:\n -u URL, --url URL The URL to test (default: None)\n```\n\n## Results Output\n\n### Single Connection Test\n\n##### Standard Output (Default)\n```\n-----------------------------------------------------------------------------------------------------------\n Time to First Byte Test\n-----------------------------------------------------------------------------------------------------------\n Lookup Time: 0.005087 Connect Time: 0.025123 StartXfer Time (TTFB): 0.111106 Total Time: 0.111173\n-----------------------------------------------------------------------------------------------------------\n```\n\n##### Minimal Output (-m)\n\n```\n----------------------------------------------------------\n Time to First Byte Test\n----------------------------------------------------------\n StartXfer Time (TTFB): 0.106124 Total Time: 0.106208\n----------------------------------------------------------\n```\n\n##### Full Output (-f)\n\n```\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n Time to First Byte Test\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n 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\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n```\n\n### Repeated Connection Test\n\nIt 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)\n\n```\n-----------------------------------------------------------------------------------------------------------\n Time to First Byte Test\n-----------------------------------------------------------------------------------------------------------\n Lookup Time: 0.005112 Connect Time: 0.034810 StartXfer Time (TTFB): 0.119705 Total Time: 0.119777\n Lookup Time: 0.005087 Connect Time: 0.023240 StartXfer Time (TTFB): 0.108551 Total Time: 0.108623\n Lookup Time: 0.004158 Connect Time: 0.021478 StartXfer Time (TTFB): 0.110971 Total Time: 0.111036\n Lookup Time: 0.005108 Connect Time: 0.022807 StartXfer Time (TTFB): 0.111455 Total Time: 0.111526\n Lookup Time: 0.004764 Connect Time: 0.022720 StartXfer Time (TTFB): 0.111475 Total Time: 0.111547\n-----------------------------------------------------------------------------------------------------------\n```\n\n## Timing Key\n\n| Time | Description |\n| :---------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| Lookup time (time_namelookup) | The time, in seconds, it took from the start until the name resolving was completed. |\n| Connect time (time_connect) | The time, in seconds, it took from the start until the TCP connect to the remote host was completed. |\n| 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. |\n| 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. |\n| 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. |\n| 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. |\n| Total time | The sum of all the other times. |\n\n\n## Response Times: The 3 Important Limits\n\nShort note for your information.\n\n* **0.1 second** \u2013 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;\n* **1.0 second** \u2013 is about the limit for the user\u2019s 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;\n* **10 seconds** \u2013 is about the limit for keeping the user\u2019s 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 \n\n<br />\n<p align=\"right\"><a href=\"https://wolfsoftware.com/\"><img src=\"https://img.shields.io/badge/Created%20by%20Wolf%20on%20behalf%20of%20Wolf%20Software-blue?style=for-the-badge\" /></a></p>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Display the time-to-first-byte for any given url.",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://github.com/PlatformEngineersToolbox/time-to-first-byte-package",
"Homepage": "https://github.com/PlatformEngineersToolbox/time-to-first-byte-package",
"Source": "https://github.com/PlatformEngineersToolbox/time-to-first-byte-package",
"Sponsor": "https://github.com/sponsors/WolfSoftware",
"Tracker": "https://github.com/PlatformEngineersToolbox/time-to-first-byte-package/issues/"
},
"split_keywords": [
"python",
" time-to-first-byte"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "544be5f561df65c125d7dcf1b6a5a7c738c36e98594c41f767cff1af84d93ed2",
"md5": "8b78e562ca2614c9b912481f7441025c",
"sha256": "959f04ec8191f6c8a2527d0b712c32bfc8797469d957bb3bf9c12d59fe3e507a"
},
"downloads": -1,
"filename": "wolfsoftware.ttfb-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8b78e562ca2614c9b912481f7441025c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 13770,
"upload_time": "2024-05-23T11:32:38",
"upload_time_iso_8601": "2024-05-23T11:32:38.807349Z",
"url": "https://files.pythonhosted.org/packages/54/4b/e5f561df65c125d7dcf1b6a5a7c738c36e98594c41f767cff1af84d93ed2/wolfsoftware.ttfb-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "32c564438efc87048cb42a63643983a60f034fd8244b2b358c3c49e0725e6bf3",
"md5": "53e1ce2e0f7122a66ebba67f11e985fd",
"sha256": "f1d29592fe82bfcb3c404ed919cc92fad37d22cfbd91ebbba3c22f5f10dde477"
},
"downloads": -1,
"filename": "wolfsoftware_ttfb-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "53e1ce2e0f7122a66ebba67f11e985fd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 13617,
"upload_time": "2024-05-23T11:32:40",
"upload_time_iso_8601": "2024-05-23T11:32:40.382864Z",
"url": "https://files.pythonhosted.org/packages/32/c5/64438efc87048cb42a63643983a60f034fd8244b2b358c3c49e0725e6bf3/wolfsoftware_ttfb-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-23 11:32:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "PlatformEngineersToolbox",
"github_project": "time-to-first-byte-package",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "wolfsoftware.ttfb"
}