What is AIM?
Aggregated Internet Measurement (AIM) is a Cloudflare framework that translates raw network metrics — download speed, upload speed, latency, latency under load, and packet loss — into a quality score for a specific use case such as video streaming, online gaming, or real-time communications. Each use case weights the underlying metrics differently. A score is computed by summing weighted metric contributions and mapping the result to a five-level quality classification.getScores()
getScores() only produces meaningful results after isFinished is true. The engine must complete all configured measurements before the scores reflect the full connection quality. Call getScores() inside onFinish to guarantee complete data.One entry per recognized use case (for example,
streaming, gaming, rtc).Classifications
| Index | Name | Meaning |
|---|---|---|
0 | bad | The connection is unsuitable for this use case. |
1 | poor | The connection will likely struggle with this use case. |
2 | average | Acceptable performance with possible degradation. |
3 | good | Reliable performance for this use case. |
4 | great | Excellent performance with headroom to spare. |
Contributing metrics
AIM scores are derived from the following measurements, weighted per use case:- Download bandwidth — raw throughput available to receive data
- Upload bandwidth — raw throughput available to send data
- Unloaded latency — round-trip time at idle
- Loaded latency increase — how much latency degrades under download or upload load (bufferbloat indicator); calculated as
max(downLoadedLatency, upLoadedLatency) − latency - Packet loss — ratio of UDP packets that did not complete the round trip
packetLoss was not included in the measurement sequence), its contribution defaults to 0 and the score is calculated from the remaining metrics.
Requirements
- All measurements in the configured sequence must complete before calling
getScores()for final results — checkisFinishedor use theonFinishcallback. - Loaded latency scores are only meaningful when
measureDownloadLoadedLatencyandmeasureUploadLoadedLatencyaretrue(both default totrue). - Packet loss scoring requires a configured and reachable TURN server. See Packet loss for setup instructions.
Usage example
Checking a specific use case
Guarding against incomplete results
Further reading
- Cloudflare AIM documentation — background on how AIM scores are defined and how Cloudflare uses them to assess global Internet quality
getScores()on the Results class — method signature and inline example- Results class — all accessor methods available on the
Resultsobject
