Achieving low latency remote development
Tags: devops, vscode, jetbrains
Published: 2022-03-14 13:17:21

---
canonical_url: https://coder.com/blog/achieving-low-latency-remote-development
---

Remote IDEs bring speed and productivity benefits to software teams. Server-class machines lead to faster performance and reduced cycle time between changing code and seeing the result. For developers, this means faster [onboarding](https://coder.com/blog/automate-developer-onboarding-with-coder) and less time troubleshooting environments.

However, it’s important to make remote IDEs feel as fast, if not faster, than local machines. In this post, we’ll cover **latency**.


## Latency hinders flow

As demonstrated by a [typing latency simulator](https://input-delay.glitch.me/), delays immediately impact your productivity. Even with powerful servers, a reliable connection is just as important.


![Typing latency demonstration](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gl8r9dtspyqmi8b912x7.gif)

In this post, we’ll refer to “latency” as the connection delay between the developer (client) and workspace (server), and not operations inside the workplace itself (compiles, builds, tests) as those are unaffected by the user’s internet speed.

Let’s take a look at how we can tune remote workspaces to have the “snappy” experience we know and love. 


## Optimize your infrastructure 

First, we recommend using servers **close in proximity to your developers**! 🌎

At Coder, we have a distributed engineering team. Our developers can pick between servers in the United States, United Kingdom, Spain, Australia for the optimal experience. If engineers join from another location, we can quickly deploy another [workspace provider](https://coder.com/docs/coder/latest/admin/workspace-providers) in that region to support them. 


![Distributed map](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kyot5tkaw1byci3kzmyb.png)

If you are using a managed development platform, this is not something you can control. If geolocation and network speeds are important to you, self-hosting with your workspaces is advised. You can use software such as [Coder](https://coder.com/docs), [Gitpod](https://www.gitpod.io/self-hosted), or a homegrown solution.


## Use remote IDEs, when possible

If you’re developing through a virtual desktop solution (e.g VDI, RDP, VNC), the overhead from streaming an entire desktop environment will often result in additional latency.

Whenever possible, we recommend using native IDEs (web-based or desktop). With VS Code and JetBrains [remote development extensions](https://coder.com/docs/coder/latest/workspaces/editors), you can develop directly on remote workspaces with low latency.

If you still need to access desktop-only apps, you can still use your virtual desktop to complement your IDE, potentially all [through the same workspace](https://coder.com/blog/run-any-application-or-ide-in-coder).


![VNC with VS Code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g30lsehlqsf40qcn0qz0.png)

If you need fast remote desktop access, [Parsec](https://parsec.app/) is an emerging tool to keep an eye on. At the time of writing, it only supports Windows and macOS hosts.


## Use direct connections, whenever possible

Reducing proxies and network hops provides users a snappier and more reliable experience, which is why we went through the effort of [implementing a peer-to-peer network architecture](https://coder.com/blog/rearchitecting-coder-networking-with-webrtc) in Coder. As a result, we have achieved a 68% latency reduction, as measured by our [workspace ping utility](https://github.com/coder/coder-cli/blob/main/docs/coder_workspaces_ping.md) (61.23ms to 29.92ms) for our internal developer workspaces.

While your own performance improvement may vary depending on your network topology, in general, reducing the number of network hops and the physical distance between your computer and the server will reduce your perceptible latency.


## Improving SSH responsiveness

For those who prefer to use vim/terminals development, [mosh](https://mosh.org/) is a great tool for reducing perceived latency in SSH connections.


![Mosh landing page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/84jzxqfjr9eyiyqgp4yl.png)

Mosh particularly comes in handy if you are on a limited internet connection, or if you’re far away from the data center.


## What about offline mode? 

You may find yourself in cases where you’d like to access your workspace without a stable internet connection, such as on an airplane. 

We plan to cover this in a dedicated blog post, but our general recommendation is to define your remote workspaces with non-proprietary tools. With Dockerfiles, devcontainers, or standard VM images, you can optionally run your environments on local machines for an, albeit slower, offline development experience. Once an internet connection is restored, you can sync files back to your remote workspace.


## Coder: self-hosted developer workspaces

If you’re serious about moving software development to your infrastructure, we’d [love to chat](https://coder.com/demo). You can also [install Coder](https://coder.com/docs/coder/latest/setup/docker#installing-coder-for-docker) for free and try it yourself.