Git Product home page Git Product logo

ttfb's Introduction

TTFB: CLI + Lib to Measure the TTFB of HTTP/1.1 Requests

Similar to the network tab in Google Chrome or Mozilla Firefox, this crate helps you find the timings for:

  • DNS lookup (if domain is specified, i.e. no IP is given)
  • TCP connection start
  • TLS handshake (if https/TLS is used)
  • Initial GET-Request
  • TTFB (Time To First Byte)

It builds upon the crates trust-dns-resolver for modern and secure DNS resolving of domains and native-tls for handling TLS v1.2/1.3.

Cross Platform

CLI + lib work on Linux, MacOS, and Windows.

Usage Binary/CLI tool

Install with cargo install ttfb. It takes one argument and passes it to the library. The string you pass here as first argument is the same as for the library function.

Additionally, the CLI takes a -k/--insecure option.
Example: $ ttfb -k https://expired.badssl.com

Usage Library

The library exposes the function ttfb(url: String). The string can be for example:

  • phip1611.de (defaults to http://)
  • http://phip1611.de
  • https://phip1611.de
  • https://phip1611.de?foo=bar
  • https://sub.domain.phip1611.de?foo=bar
  • http://12.34.56.78/foobar
  • https://1.1.1.1
  • 12.34.56.78/foobar (defaults to http://)
  • 12.34.56.78 (defaults to http://)

Example Output

If you installed the CLI and invoke it like $ ttfb https://phip1611.de, the output will look like:

TTFB for https://phip1611.de (by [email protected])
PROPERTY        REL TIME (ms)   ABS TIME (ms)
DNS Lookup    :         0.755           0.755  (probably cached)
TCP connect   :        35.484          36.239
TLS Handshake :        36.363          72.603
HTTP GET Req  :         0.011          72.614
HTTP Resp TTFB:        76.432         149.046

Rust version / MSRV

This crate uses the Rust edition 2021. This means, the MSRV is 1.56.1 stable.

ttfb's People

Contributors

phip1611 avatar byron avatar

Watchers

James Cloos avatar

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.