> For the complete documentation index, see [llms.txt](https://docs.serverlessapigateway.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.serverlessapigateway.com/glossary/l/latency.md).

# Latency

The delay before a transfer of data begins following an instruction for its transfer.

Latency is the time delay between a request being sent and the response being received. In networking and API contexts, it is typically measured in milliseconds and represents the total round-trip time for a request to travel from the client to the server and back.

API latency is affected by multiple factors: network distance between client and server, DNS resolution time, TLS handshake duration, server processing time, database query execution, and response payload size. High latency degrades user experience, especially in interactive applications and real-time systems.

Reducing API latency is a primary motivation for edge computing and edge-deployed API gateways. By processing requests at the network edge closest to the user, several latency-contributing factors are minimized. Techniques for lowering latency include response caching, connection pooling, payload compression, and geographic routing. API gateways can measure and report latency metrics, helping teams identify bottlenecks in their request processing pipeline.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.serverlessapigateway.com/glossary/l/latency.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
