Chapter 2: The network

TCP connection

Also called TCP

A reliable conversation between two programs across a network. Before any data moves, the two sides exchange messages to open the connection, and that costs one full trip there and back.

Opening a connection is expensive, and you pay for it per connection, which agents rarely think about. Code that opens a new database connection for every request can look perfectly clean and still fall over when many people use it at once.

Say it to your agent

“Don't create a new database client inside the request handler. Create one at startup and reuse it through a pool. Tell me the pool size you chose and how it compares to the database's connection limit.”

The workshop

Name a word, or describe what you mean in everyday language.