liveBook · Manning

Timeout

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

A timeout is a limit on how long a software operation waits for a response or completion before it is treated as failed.

A timeout limits how long an HTTP request may wait before the application aborts it with an error. It prevents hung internal or external services from making customers wait indefinitely and supports a fail-fast response when something is already failing. section 11.4.6

Use request timeouts to control failure behavior in service-to-service communication:

  • Apply them to requests made with Node.js http.request or Axios. section 11.4.6
  • Treat the default Axios timeout as unsafe for production because it is infinite. section 11.4.6
  • Choose a maximum wait that lets the application report failure promptly rather than hold a customer request indefinitely. section 11.4.6
Listing 11.3 Setting a default timeout for HTTP requests with Axios
const axios = require("axios");
 
axios.defaults.timeout = 2500;     #1

Set a 2,500-millisecond default timeout for Axios HTTP requests. section 11.4.6

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Defines request timeout behavior and shows Axios configuration, but does not detail timeout error handling internals.
Examples
Uses internal service calls, a Dropbox integration scenario, and Axios configured with a 2,500-millisecond default.
What it assumes
Assumes familiarity with HTTP requests, Node.js, Axios, and microservice communication.
What you can do after
Operate/configure Axios requests with a finite timeout that aborts unresponsive calls promptly.
How it connects
Connects timeouts with microservices, HTTP requests, fault isolation, automatic retries, job queues, and circuit breakers.

Also explained in

Compare how 9 books explain timeout →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.