liveBook · Manning

REST

As explained in Latency

A REST API is an HTTP-based application programming interface that exposes resources and operations according to REST architectural constraints.

A REST API is an HTTP-based interface that exposes operations through web endpoints and produces HTTP responses. A minimal server can register a GET /hello route, dispatch it to a handler, and return data obtained from a database. section 3.5

REST APIs also provide a useful boundary for measuring system latency. The placement of the database relative to the API server can dominate performance: embedding SQLite removes network access, while PostgreSQL introduces client-server communication. section 3.5 section 3.6

A database-backed greeting endpoint

A GET request to /hello invokes say_hello. The PostgreSQL version obtains a pooled connection and executes SELECT 'hello world'; the SQLite version locks an embedded connection and executes the equivalent query. In the reported benchmarks, PostgreSQL averaged 8.06 ms and 1,460 requests per second, while SQLite averaged 97.66 microseconds and 188,469 requests per second.

How Latency covers it

How deep it goes
Builds a runnable endpoint, handler, database integration, and benchmark, but does not detail REST architectural constraints.
Examples
Uses a GET /hello endpoint backed by PostgreSQL or SQLite, then compares latency distributions with wrk and an eCDF plot.
What it assumes
Assumes Rust familiarity and requires Rust, Actix Web, PostgreSQL or SQLite, and wrk for the demonstrated workflow.
What you can do after
Build it from scratch with Actix Web, connect PostgreSQL or SQLite, and measure endpoint latency with wrk.
How it connects
Connects REST APIs with HTTP servers, request handlers, databases, connection pooling, colocation, and latency benchmarking.

Also explained in

Compare how 22 books explain REST →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Latency. The section links point to the parts of the book it draws on.