Running large, computationally intensive R scripts is often a very slow process; how can we upgrade to a more powerful server, while keeping costs low?

The Google Cloud Platform (GCP) allows us to use Virtual Machines (VM) of various configurations and only pay for what we use. This pricing structure makes it feasible to run a large and intensive script for relatively cheap. And if your workflow is fault-tolerant, preemptible machines can reduce your total expenditure significantly more.

For the purpose of this article, I will use an n1-standard-16 machine (16 vCPUs and 60 GB of memory), with a Debian GNU/Linux 9 (stretch) disk image and preemptibility configured. The cost of this machine came out to be $0.161 hourly — my specific task took an average of 3 hours to run once a week, totaling around $2 dollars a month. Make sure you turn the VM off after using it, as keeping it on would increase that number.

Image for post

Note: Of course, with a preemptible machine, there is always a risk that the instance will terminate while you are using it. That has personally never happened to me, but it is always a risk. As always, if your workflow is not fault tolerant, preemptible machines are not recommended.

#google-cloud-platform #rstudio #cloud

Running R/RStudio in a GCP VM
1.35 GEEK