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.
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.
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.
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.
I ran a few times. Below were the best observed.
RSA speed test with command line: openssl speed rsa
RSA | sign/s | verify/s |
---|---|---|
512 | 18018.8 | 304004.6 |
1024 | 8491.0 | 26482.4 |
2048 | 257.2 | 8664.1 |
4096 | 39.5 | 2573.9 |
AES speed test with command line: openssl speed aes
AES-CBC | 16 bytes | 64 bytes | 256 bytes | 1024 bytes | 8192 bytes |
---|---|---|---|---|---|
128 | 73542.90k | 63012.76k | 63044.69k | 64832.17k | 72859.48k |
192 | 53858.26k | 72861.08k | 67095.81k | 59642.20k | 63984.98k |
256 | 31454.13k | 15389.46k | 12743.85k | 12026.01k | 16037.21k |
See comparison against my other devices.
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.
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
RSA | sign/s | verify/s |
---|---|---|
512 | 24922.4 | 348484.8 |
1024 | 7523.2 | 122159.1 |
2048 | 1052.3 | 35556.3 |
4096 | 141.3 | 9169.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-CBC | 16 bytes | 64 bytes | 256 bytes | 1024 bytes | 8192 bytes |
---|---|---|---|---|---|
128 | 205552.27k | 216593.13k | 226590.63k | 224839.34k | 217838.93k |
192 | 168102.19k | 172801.09k | 174397.18k | 184247.98k | 187921.75k |
256 | 149979.53k | 158063.40k | 126086.14k | 132667.05k | 159730.35k |
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.