.NET Core on Google Cloud f1-micro instance

  • Last updated on April 4, 2017
  • Cloud

Given that .NET Core is capable of running on Linux, I decided to try running a simple Hello World test on Google Cloud Platform f1-micro instance and also ran OpenSSL speed tests.

Motivation

I have been working on a hobby project written in .NET Core and will be hosting it on Google Cloud Platform VM eventually. Aside from the running simple Hello World example, considering I ran OpenSSL speed test on some of my Raspberry Pi 2, NAS and router, I wanted to know how much faster or slower the f1-micro is relative to them.

Installing .NET Core

I provisioned a f1-micro instance with Ubuntu Linux 16.04 LTS operating system on 10GB standard disk. You can pick whichever as long as it is supported by Microsoft.

I ran the instructions as per the guide on Microsoft page:

sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893
sudo apt-get update
sudo apt-get install dotnet-dev-1.0.1
dotnet new console -o hwapp
cd hwapp

The output of interest were:

Decompressing 100% 10518 ms
Expanding 100% 60763 ms
Content generation time: 733.5919 ms

Note: f1-micro is burstable. From Google Console, I observed a 200% spike in CPU usage. The same level of spikes were observed in subsequent benchmarks below.

In contrast, my Intel i7 Q740 laptop with SSD achieved the following which I am (quite certain) did not take advantage of multiple cores:

Decompressing 100% 8895 ms
Expanding 100% 57911 ms
Content generation time: 86.7835 ms

Interestingly, almost equal performance except the content generation time which was more disk intensive.

Running .NET Hello World and timing it

I ran the following on f1-micro:

dotnet restore
echo `date +%s%3N` && dotnet run && echo `date +%s%3N`

The output with numbers in miliseconds:

1491231632032
Hello World!
1491231634465

Roughly 2.4 seconds to run.

Then, I ran similar test on my laptop with the following output:

 0:14:24.83
Hello World!
 0:14:27.09

Roughly 2.2 seconds to run.

OpenSSL benchmark on f1-micro

I ran a few times. Below were the best observed.

RSA speed test with command line: openssl speed rsa

RSAsign/sverify/s
51218018.8304004.6
10248491.026482.4
2048257.28664.1
409639.52573.9

AES speed test with command line: openssl speed aes

AES-CBC16 bytes64 bytes256 bytes1024 bytes8192 bytes
12873542.90k63012.76k63044.69k64832.17k72859.48k
19253858.26k72861.08k67095.81k59642.20k63984.98k
25631454.13k15389.46k12743.85k12026.01k16037.21k

See comparison against my other devices.

CPU usage of f1-micro

Google Cloud f1-micro CPU usage

As I mentioned earlier, f1-micro is burstable so take the performance numbers that I have reported above with a grain of salt. The bursts may come handy when you get short spikes in traffic.

OpenSSL benchmark on my laptop

In order to perform multi-core OpenSSL test, I had to use Windows Subsystem for Linux. The Windows OpenSSL binaries do not support multi-core speed test at time of writing this article.

RSA speed test with command line: openssl speed rsa -multi 4

RSAsign/sverify/s
51224922.4348484.8
10247523.2122159.1
20481052.335556.3
4096141.39169.2

Interestingly, my laptop was slower than the f1-micro for 1024-bit RSA sign/s test.

AES speed test with command line: openssl speed aes -multi 4

AES-CBC16 bytes64 bytes256 bytes1024 bytes8192 bytes
128205552.27k216593.13k226590.63k224839.34k217838.93k
192168102.19k172801.09k174397.18k184247.98k187921.75k
256149979.53k158063.40k126086.14k132667.05k159730.35k

Conclusion

Provisioning a new f1-micro Linux machine on Google Cloud was very easy. Installation of .NET Core was very quick and OpenSSL benchmark numbers gave me a rough indication of its performance. I could develop applications on my laptop and force it to run on a single core to get a rough indicator of the f1-micro’s throughput.