DEV Community

Ben Potter
Ben Potter

Posted on • Originally published at coder.com

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 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, delays immediately impact your productivity. Even with powerful servers, a reliable connection is just as important.

Typing latency demonstration

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 in that region to support them.

Distributed map

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, Gitpod, 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, 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.

VNC with VS Code

If you need fast remote desktop access, Parsec 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 in Coder. As a result, we have achieved a 68% latency reduction, as measured by our workspace ping utility (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 is a great tool for reducing perceived latency in SSH connections.

Mosh landing page

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. You can also install Coder for free and try it yourself.

Top comments (0)