Saturday, June 17, 2017

What Can You Do With A Free Server In The Cloud?

I apologize for the clickbait title, but it's verbatim the exact question I asked myself when I learned about Google's Always Free tier for their cloud computing. This was a step up from what Amazon offered, because Amazon's free tier for computing only lasts 12 months. Naturally, I was really excited to have a free VM in the cloud that never had to be turned off. In this post, we can test the limits of these servers and see what you can do with them. Hopefully this can apply to developers and non-developers alike.



So here are the relevant usage limits to the compute side:

  • A free f1-micro instance (0.60GB of RAM and 1 shared CPU with bursting capability)
  • 30GB of hard drive space, essentially
  • 1GB of outgoing traffic (I assume this is aggregated across all services you use)
Now, I know what you may be thinking. 0.60GB of RAM is not a lot. You're right, but you can also create swap space on your 30GB of hard drive, so there's that. We'll cover very quickly how to do that later on.

But we want to see what this is capable of! Obviously, you can serve a reasonably complicated website from this server, but what else can you make it do? Let's find out!

Minecraft Server ❌

Cloud computing hasn't really been the most cost effective way to start a Minecraft server. There are services that can do it a lot cheaper and easier. But nothing is cheaper than free! So let's set up a server and see how they perform. For each of these tests, I'll be starting with a VM from scratch so I don't clobber any other performance tests. I will also be using Ubuntu 17.04 in the us-central1-a zone.

So to install the Minecraft server, I simply installed the default-jre and downloaded the jar from the minecraft website. We'll run it without a swapfile so we can see how terrible the performance is. Let's give it a stack and a heap of 256MB.

java -Xmx256M -Xms256M -jar minecraft_server.1.12.jar nogui

Literally as soon as the server was done generating the world, it said it was behind and had to skip 88 ticks. Not a good sign for the shared core, but maybe we can get some kind of performance out of it. Of course, you also have to open the Minecraft port open through the firewall so that you can actually connect to it.

I noticed as soon as I started flying that the game would stutter because it couldn't update my postion fast enough. Walking around was fine but you could also see animals with very jerky movements. The server was having a very hard time keeping up with the world's speed, and it eventually crashed. So let's make two gigabytes of a swapfile and see if that helps.

To do that, we need to make a file, format it as swap, and turn the swap on on it. If this were permanent, I'd add it to my fstab, but it's not so I really don't care. Run these commands as root:

  • fallocate 2G /swapspace
  • chmod 600 /swapspace
  • mkswap /swapfile
  • swapon /swapfile
Then I relaunched the server giving it 512MB of both stack and heap space. The results were basically the same. It jerked around just as much as it did before - especially when rendering new chunks. This leads me to believe that the memory isn't the issue here, it's the CPU power. We are on a shared core after all.

So a Minecraft Server failed, what's next?

OwnCloud ✔

OwnCloud is an interesting software. It allows you to run your own file sync service without having to touch public cloud services like Drive or OneDrive. This is perfect if you're paranoid about snooping companies. Granted, you only have 30GB of HD storage, but that's still more than Drive offers for free, right?

To install, I simply followed the instructions here to get the process going. It installed really quickly, so then I went to /owncloud on the server and created an admin account. I figured it'd be best to keep the default database (SQLite) because we didn't need another process with a memory footprint running. Then I played around with it to see if anything was laggy.

Uploading was a touch slower than I'd expect, but it wasn't bad. Downloading was okay as well. I was also able to install apps really quickly (except for the Calendar which didn't install because it couldn't verify the signature.) This ecosystem may be a touch advanced for the average user, but OwnCloud makes it really easy to use. It runs fairly well on the free f1-micro instance, so I'd give this one a green checkmark!

Source Control ✔



This one should be very easy and straight forward to do. Basically, I'm just going to install Gitblit Go on the server and see how it handles a reasonably large repository. So I installed the default-jdk again and downloaded the package from the Gitblit website. I followed the setup instructions and then I cloned the Gitblit Go source repo. I figured it'd be a good enough test to see if it could handle its own code.

Uploading was a bit slow again, but everything else worked really well. I was able to browse the code without much issue. I know Git is a lightweight tool, but this was really impressive that a Java implementation could run so light as well. I then pulled the repo back down and it was much faster. I could see this being very useful, especially alongside something like CI running on the same server. That's a pain to set up so I'm not going to test it. I don't know how well that'd do, but with smaller projects, CI may run perfectly well on an f1-micro instance. But, we'll move on instead.

Plex ❌



I didn't even have to try this one. Simply put, this VM doesn't have enough beef to transcode things. 


VPN ❌



Technically this is possible, but it would be very slow and I also think it's against Google's ToS.

Just a Linux Box ✔



This is what I use this for. It provides a nice Linux workspace that I can get to from anywhere. I've installed all of the tools I use, and I'm really happy with it so far.

So, in conclusion, you can only do so much with this free VM. If you want to do some more intense stuff, get your own box to serve everything you need, or simply get a larger VM and swallow the cost. The cloud is worth it in my opinion, and this free instance Google offers is really nice.

No comments:

Post a Comment