64 Cores on Fire: Supercharging My Development Experience
Tags: rust, vscode, azure
Published: 2019-05-08 14:57:46

---
title: 64 Cores on Fire: Supercharging My Development Experience
published: true
description: How I made working on the Rust standard library easier by throwing more cores at the problem
tags: rust, vscode, azure
---

I recently started contributing to the [Rust](https://github.com/rust-lang/rust) standard library to start fleshing out networking support for the WebAssembly system interface (WASI). The issue is that building rustc and its component parts like LLVM takes two and a half hours on my 2015 MacBook Pro. 

![My poor machine](https://thepracticaldev.s3.amazonaws.com/i/77s8wl6im1ubgco6eh97.png)

If I was to be able to be productive, I needed a different solution!

## Moar Cores!

The easiest answer when your machine isn't running something fast enough is to try throw more cores at it and see if it helps. Luckily a large part of building rustc is building llvm which massively speeds up when it has access to more cores.

So my co-worker, [Duncan](twitter.com/duncan) and I spun up a F64s_v2 virtual machine on Azure which has 64 total cores. The Fsv2 series of VMs on Azure are compute optimized making them the right VMs for the job.

With this machine, the build times went down dramatically to a total of around  17 minutes! 

![All the cores!](https://thepracticaldev.s3.amazonaws.com/i/rxuoxwfe215mempe4pwm.png)

Wondering what would happen with less cores, we ran the same setup on a F32s_v2 with 32 cores and a F16s_v2 with 16 cores. These builds ran in 21 and 30 minutes respectively - not too bad!

## Estimated Cost

Azure VMs are usually a bit cheaper in the U.S. so we hosted them there. I'm located in Europe, but in my experience latency isn't really an issue as the dev tools I use (ssh and VS Code remote extension) handle the latency fine. 

[The cost](https://azure.microsoft.com/en-us/pricing/details/virtual-machines/ubuntu-advantage-standard?WT.mc_id=devto-blog-rylevick) for the 64 core machine at the time of this writing $2.73 per hour, while the 32 core machine is $1.38 per hour and the 16 core machine is $0.71 per hour. 

Given that the smaller machines are much cheaper, I opted for doing an initial build on a 32 core machine and then for incremental builds transferring the disk to a B8MS virtual machine. B8MS is an 8 core machine that is optimized for "burst" workloads (i.e. high CPU usage that happens every once in a while - like compiling). It only costs $0.36 per hour. Of course, you should still remember to shut down the machine when you're not using it.

You'll also have to [pay for storage](https://azure.microsoft.com/en-us/pricing/details/managed-disks?WT.mc_id=devto-blog-rylevick). Using a standard SSD with 64GB of RAM, only costs $5 per month.

If we put all this together, I estimate it costs around $2.00 for typical dev session of around 4 or 5 hours. Not too bad if it means I spend almost all that time coding instead of waiting for the thing to compile.   

## Dev Experience

Obviously getting a machine setup takes a bit of time, but with simple shell scripts using the [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest&WT.mc_id=devto-blog-rylevick), I now can easily reproduce the setup of both machines and the swapping the disk between them.

As for, writing actual code, I've been really enjoying [VS Code](https://code.visualstudio.com?WT.mc_id=devto-blog-rylevick)'s [Remote Development Extensions](https://code.visualstudio.com/docs/remote/remote-overview?WT.mc_id=devto-blog-rylevick). Most of the time I don't notice, I'm not working on my machine. I've had similar experiences as a vim user in the past, but this is next level, even making file transfer to the remote machine, super simple.


Hope this was an interesting look into remote dev on a big project like Rust. Let me know what you think by commenting below or reaching out on [Twitter](twitter.com/ryan_levick)