# Latency

> Latency is the time between submitting an SMS and its arrival on the handset, typically a few seconds on a healthy route; it is the metric that matters most for one-time codes.

For a [one-time code](https://smsmeteor.io/glossary/otp), latency is the product: a user waiting twenty seconds gives up and asks for another code, which costs a second message and often invalidates the first. Latency builds up along the chain: the gateway's processing and queue, the route's hops, the operator's message centre and the handset's own connection. It rises when a route is congested, when messages queue behind a large campaign, and when the phone sits on a weak signal.

It is worth measuring in two halves. The time from submission to hand-over to the carrier belongs to the gateway; the time from hand-over to the delivery receipt belongs to the route and the phone. Receipts can themselves arrive late or in batches, so latency measured from receipts is an upper bound: the phone may have had the message earlier.

Hypothetically, a code is created at 12:00:00, handed to the carrier at 12:00:01 and confirmed delivered at 12:00:05. End-to-end latency is 5 seconds, 4 of them between the carrier and the phone. Across thousands of codes, the median and the 95th percentile per destination say more than an average, because one slow operator disappears into a global mean.

Three mistakes are common with codes:

- Sending codes and campaigns through the same queue, so a marketing send can delay a login.

- Measuring one global average instead of per destination.

- Letting users request a new code every few seconds. Each request is a new message, and the first code often arrives just after the second is sent; the guide to [sending OTP codes that arrive](https://smsmeteor.io/guides/otp-and-verification-codes) covers resend limits.

At SMSMeteor: the message object records `created_at`, `sent_at` and `delivered_at`, so latency can be measured per message and per destination from your own traffic. Codes can leave at any hour with `window.quiet_hours` set to `bypass`, and `validity` can be set to the code's lifetime. Incidents are posted on the [status page](https://smsmeteor.io/status), with their history since launch.

Related terms: [Throughput (TPS)](https://smsmeteor.io/glossary/throughput), [OTP (one-time password)](https://smsmeteor.io/glossary/otp), [SMS route](https://smsmeteor.io/glossary/sms-route)

---
Source: https://smsmeteor.io/glossary/latency (HTML). Generated by SMSMeteor from the same data as the page. Summary of the whole site: https://smsmeteor.io/llms.txt
