8000 docs: add a section about latency and how it's measured by EdwardAngert · Pull Request #16734 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

docs: add a section about latency and how it's measured #16734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions docs/admin/networking/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,64 @@ low-latency browser experiences for geo-distributed teams.

To learn more, see [Workspace Proxies](./workspace-proxies.md).

## Latency

Coder measures and reports several types of latency, providing insights into the performance of your deployment. Understanding these metrics can help you diagnose issues and optimize the user experience.

There are three main types of latency metrics for your Coder deployment:

- Dashboard-to-server latency:

The Coder UI measures round-trip time to the Coder server or workspace proxy using built-in browser timing capabilities.

This appears in the user interface next to your username, showing how responsive the dashboard is.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit more complex if there are multiple workspace proxies. The dashboard is always served from the primary Coder server deployment, which will be one specific entry, although I don't think we do anything special to indicate which one, unfortunately.

The other workspace proxies serve applications from the workspace, like web IDEs, the web terminal, etc. A low ping there will help those applications be more responsive, but it only measures part of the round-trip. The proxy to workspace leg is not measured.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had trouble figuring out how to add that to this doc in a way that doesn't take it too far off course, so I added it to workspace-proxies.md in 9e7dc7b

I also force-pushed to this branch because I repointed it to main so that the latency info isn't tied to a rework of the networking docs in general. hopefully I did that as cleanly as possible 🤞


- Workspace connection latency:

The latency shown on the workspace dashboard measures the round-trip time between the workspace agent and its DERP relay server.

This metric is displayed in milliseconds on the workspace dashboard and specifically shows the agent-to-relay latency, not direct P2P connections.

To estimate the total end-to-end latency experienced by a user, add the dashboard-to-server latency to this agent-to-relay latency.

- Database latency:

For administrators, Coder monitors and reports database query performance in the health dashboard.

### How latency is classified

Latency measurements are color-coded in the dashboard:

- **Green** (<150ms): Good performance.
- **Yellow** (150-300ms): Moderate latency that might affect user experience.
- **Red** (>300ms): High latency that will noticeably affect user experience.

### View latency information

- **Dashboard**: The global latency indicator appears in the top navigation bar.
- **Workspace list**: Each workspace shows its connection latency.
- **Health dashboard**: Administrators can view advanced metrics including database latency.
- **CLI**: Use `coder ping <workspace>` to measure and analyze latency from the command line.

### Factors that affect latency

- **Geographic distance**: Physical distance between users, Coder server, and workspaces.
- **Network connectivity**: Quality of internet connections and routing.
- **Infrastructure**: Cloud provider regions and network optimization.
- **P2P connectivity**: Whether direct connections can be established or relays are needed.

### How to optimize latency

To improve latency and user experience:

- **Deploy workspace proxies**: Place [proxies](./workspace-proxies.md) in regions closer to users, connecting back to your single Coder server deployment.
- **Use P2P connections**: Ensure network configurations permit direct connections.
- **Strategic placement**: Deploy your Coder server in a region where most users work.
- **Network configuration**: Optimize routing between users and workspaces.
- **Check firewall rules**: Ensure they don't block necessary Coder connections.

For help troubleshooting connection issues, including latency problems, refer to the [networking troubleshooting guide](./troubleshooting.md).

## Up next

- Learn about [Port Forwarding](./port-forwarding.md)
Expand Down
9 changes: 9 additions & 0 deletions docs/admin/networking/workspace-proxies.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ up to 60 seconds.

![Workspace proxy picker](../../images/admin/networking/workspace-proxies/ws-proxy-picker.png)

## Multiple workspace proxies

When multiple workspace proxies are deployed:

- The browser measures latency to each available proxy independently.
- Users can select their preferred proxy from the dashboard.
- The system can automatically select the lowest-latency proxy.
- The dashboard latency indicator shows latency to the currently selected proxy.

## Observability

Coder workspace proxy exports metrics via the HTTP endpoint, which can be
Expand Down
0