> ## Documentation Index
> Fetch the complete documentation index at: https://cockroachlabs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Network Latency Page

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The **Network Latency** page displays round-trip latencies between all nodes in your cluster. Latency is the time required to transmit a packet across a network, and is highly dependent on your network topology. Use this page to determine whether your latency is appropriate for your <InternalLink path="topology-patterns">topology pattern</InternalLink>, or to identify nodes with unexpected latencies.

To view this page, <InternalLink path="ui-overview#db-console-access">access the DB Console</InternalLink> and click **Network Latency** in the left-hand navigation.

## Sort and filter network latency

Use the **Sort By** menu to arrange the latency matrix by <InternalLink path="cockroach-start#locality">locality</InternalLink> (e.g., cloud, region, availability zone, datacenter).

Use the **Filter** menu to select specific nodes or localities to view.

Select **Collapse Nodes** to display the mean latencies of each locality, depending on how the matrix is sorted. This is a way to quickly assess cross-regional or cross-cloud latency.

## Understanding the Network Latency matrix

Each cell in the matrix displays the round-trip latency in milliseconds between two nodes in your cluster. Round-trip latency includes the return time of a packet. Latencies are color-coded by their standard deviation from the mean latency on the network: green for lower values, and blue for higher.

<img src="https://mintcdn.com/cockroachlabs/sp2JmBkYRdlOjfFZ/images/v23.1/ui_network_latency_matrix.png?fit=max&auto=format&n=sp2JmBkYRdlOjfFZ&q=85&s=fb4cab3ca52d584d04a46723582c68e2" alt="DB Console Network Latency matrix" width="2286" height="1070" data-path="images/v23.1/ui_network_latency_matrix.png" />

Rows represent origin nodes, and columns represent destination nodes. Hover over a cell to see round-trip latency and locality metadata for origin and destination nodes.

On a <InternalLink path="demo-low-latency-multi-region-deployment">typical multi-region cluster</InternalLink>, you can expect much lower latencies between nodes in the same region/availability zone. Nodes in different regions/availability zones, meanwhile, will experience higher latencies that reflect their geographical distribution.

For instance, the cluster shown above has nodes in `us-west1`, `us-east1`, and `europe-west2`. Latencies are highest between nodes in `us-west1` and `europe-west2`, which span the greatest distance. This is especially clear when sorting by region or availability zone and collapsing nodes:

<img src="https://mintcdn.com/cockroachlabs/DqKzx0qjg1R7yDTM/images/v23.1/ui_network_latency_collapsed_nodes.png?fit=max&auto=format&n=DqKzx0qjg1R7yDTM&q=85&s=c4c5fc13958fd34f67ec7e902e5e33ea" alt="DB Console Network Latency collapsed nodes" width="1466" height="848" data-path="images/v23.1/ui_network_latency_collapsed_nodes.png" />

### No connections

Nodes that have lost a connection are displayed in a separate color. This can help you locate a network partition in your cluster.

A network partition occurs when two or more nodes are prevented from communicating with each other in one or both directions. A network partition can be caused by a network outage or a configuration problem with the network, such as when allowlisted IP addresses or hostnames change after a node is <InternalLink path="node-shutdown">drained and restarted</InternalLink>.

In a **symmetric** partition, node communication is disrupted in both directions. In an **asymmetric** partition, nodes can communicate in one direction but not the other.

CockroachDB protects against asymmetric partitions by converting all asymmetric (uni-directional) network partitions into symmetric (bi-directional) network partitions. This increases cluster resiliency by reducing the number of partition-related failures that can occur.  Many temporary symmetric partitions can be recovered from automatically without operator intervention.

The effect of a network partition depends on which nodes are partitioned, where the ranges are located, and to a large extent, whether <InternalLink path="cockroach-start#locality">localities</InternalLink> or <InternalLink path="configure-replication-zones">zone configurations</InternalLink> are defined. A partition that cuts off at least `(n-1)/2` replicas from a <InternalLink path="architecture/overview">range</InternalLink> will cause range unavailability which will cause some data unavailability. If there are no localities or other constraints on where replicas are placed, then a partition of any (<InternalLink path="configure-replication-zones">`num_replicas`</InternalLink> / 2) nodes will likely cause unavailability.

Click the **NO CONNECTIONS** link to see lost connections between nodes or <InternalLink path="cockroach-start#locality">localities</InternalLink>, if any are defined.

## Topology fundamentals

* Multi-region topology patterns are almost always table-specific. If you haven't already, <InternalLink path="topology-patterns#multi-region">review the full range of patterns</InternalLink> to ensure you choose the right one for each of your tables.
* Review how data is replicated and distributed across a cluster, and how this affects performance. It is especially important to understand the concept of the "leaseholder". For a summary, see <InternalLink path="architecture/reads-and-writes-overview">Reads and Writes in CockroachDB</InternalLink>. For a deeper dive, see the CockroachDB <InternalLink path="architecture/overview">Architecture Overview</InternalLink>.
* Review the concept of <InternalLink path="cockroach-start#locality">locality</InternalLink>, which CockroachDB uses to place and balance data based on how you define <InternalLink path="configure-replication-zones">replication controls</InternalLink>.
* Review the recommendations and requirements in our <InternalLink path="recommended-production-settings">Production Checklist</InternalLink>.
* This topology doesn't account for hardware specifications, so be sure to follow our <InternalLink path="recommended-production-settings#hardware">hardware recommendations</InternalLink> and perform a POC to size hardware for your use case. For optimal cluster performance, Cockroach Labs recommends that all nodes use the same hardware and operating system.
* Adopt relevant <InternalLink path="performance-best-practices-overview">SQL Best Practices</InternalLink> to ensure optimal performance.

<Note>
  Network latency limits the performance of individual operations. You can use the <InternalLink path="ui-statements-page">Statements</InternalLink> page to see the latencies of SQL statements on gateway nodes.
</Note>

## See also

* <InternalLink path="topology-patterns">Topology Patterns</InternalLink>
* <InternalLink path="performance#latency">CockroachDB Performance</InternalLink>
* <InternalLink path="performance-best-practices-overview">Performance Tuning</InternalLink>
* <InternalLink path="demo-low-latency-multi-region-deployment">Low Latency Reads and Writes in a Multi-Region Cluster</InternalLink>
