Update #2 – 2015-05-19 – Three months after my first update I noticed that Rackspace has removed their FreeBSD VPS offering. Not surprising and probably for the best. Two clients that I recommend Rackspace to, that are also using FreeBSD VPS, are experiencing the same issues, so I know I am not alone. I have moved my mission-critical services to a Leaseweb bare-metal server. I’ve been with them for five months now. 100% uptime and no issues whatsoever. There’s twice been a 30ms jump in latency from where I am monitoring the server from; perfectly acceptable performance, if not amazing by server-farm standards. I am considering moving to Packet as I have just been told they intend to support FreeBSD very soon. They also offer a BYoIP (bring your own IP) service, which is extremely attractive as we have an IPv4 /23 and an IPv6 /48.
Update #1 – 2015-02-19 – After what seems like one of my servers hanging hundreds of times, and in reality is probably at least 60, I have moved off of Rackspace’s FreeBSD VPS for all my mission critical sites. Rackspace dev ops seem very uninterested in putting any effort into their FreeBSD product. Additionally, few of their Linux ops can support it. After all the swap nonsense and being affected by “noisy neighbors”, I’ve moved onto a bare-metal server. So far, zero downtime. A decade ago, I envied Rackspace’s product and support. Now, they are a far cry from Softlayer, Packet.net and many others who have left them in the dust. Their now lackluster support and lack of innovation could see them completely fall off the map. It’s quite sad to see how far the mighty have fallen.
Last October, one of the best VPS and bare-metal server providers on the planet, Rackspace, quickly fell from grace with many of its VPS customers. They made a decision — a poor one at that — to eliminate swap from their default Linux and FreeBSD VPS builds. They claim that this was in an effort to reduce disk IOPS, but in reality, they’ve achieved nothing but instability. Here’s their KB article:
Notice at the bottom they’ve provided a link for how Linux users can add a swap file. Also notice that there’s no mention of how to add a swap file using FreeBSD. I’ll get to that in a second. First, let’s break down what they’ve actually accomplished:
They’ve not actually reduced IOPS at all, because nearly everyone running a VPS will have manually created a swap file, because if you don’t, it’s possible that this can happen:
Apr 20 08:20:37 monitor kernel: pid 10861 (xenstore), uid 0, was killed: out of swap space Apr 20 08:20:37 monitor kernel: pid 172 (nova-agent), uid 0, was killed: out of swap space Apr 20 08:20:38 monitor kernel: pid 778 (sshd), uid 0, was killed: out of swap space Apr 20 08:20:38 monitor kernel: pid 965 (devd), uid 0, was killed: out of swap space Apr 20 08:20:38 monitor kernel: pid 2345 (sendmail), uid 0, was killed: out of swap space
Yes, that’s right, whilst compiling MySQL, and apparently running out of memory on a box that supposedly has 2GB of RAM, the server killed several critical processes.
Because you cannot have custom partitioning on their FreeBSD VPS, they force you to choose from one of many of the already capacity-deprived file systems in which to create the swap file.
Filesystem Size Used Avail Capacity Mounted on zroot 2.4G 205M 2.1G 9% / devfs 1.0k 1.0k 0B 100% /dev zroot/tmp 2.1G 424k 2.1G 0% /tmp zroot/usr 5.5G 3.3G 2.1G 61% /usr zroot/usr/home 3.8G 1.6G 2.1G 43% /usr/home zroot/usr/ports 3.1G 996M 2.1G 31% /usr/ports zroot/usr/ports/distfiles 2.2G 41M 2.1G 2% /usr/ports/distfiles zroot/usr/src 2.4G 276M 2.1G 11% /usr/src zroot/var 2.2G 3.4M 2.1G 0% /var zroot/var/crash 2.1G 148k 2.1G 0% /var/crash zroot/var/db 2.3G 185M 2.1G 8% /var/db zroot/var/db/pkg 2.2G 6.0M 2.1G 0% /var/db/pkg zroot/var/empty 2.1G 144k 2.1G 0% /var/empty zroot/var/log 2.1G 1.7M 2.1G 0% /var/log zroot/var/mail 2.1G 1.4M 2.1G 0% /var/mail zroot/var/run 2.1G 296k 2.1G 0% /var/run zroot/var/tmp 2.1G 1.7M 2.1G 0% /var/tmp
Which file system are you likely to throw a 2GB swap file on? This partitioning at its absolute worst. I’m using a grand total of about 200MB of the nearly 18GB of space allocated to all the many /var file systems.
But, I digress. Here’s how to add a swap file to your VPS:
You’ll need the memory disk driver install, which comes by default with the generic kernel. Rackspace at least had the foresight to keep this in their kernel.
Next, find a good place for your swap file. This will likely be determined by your partitioning. I’m going to create a 1024 MB swap file in /usr/swap and name is swap0. On my server the /usr file system is the largest partition on the server, so it makes the most sense. Next, I am doing to create the actual swap file:
dd if=/dev/zero of=/usr/swap/swap0 bs=1024k count=1024
Adjust the count to adjust your swap file size. 1 count is equal to 1 MB.
Next, change the swap file permissions:
chmod 0600 /usr/swap/swap0
Remember to add this new swap file to your /etc/rc.conf file:
To enable the new swap without rebooting, use the following commands:
mdconfig -a -t vnode -f /usr/swap/swap0 swapon /dev/md0
When you enter the mdconfig command, it will list the device name for your new swap file. Mine was md1. Yours may be different.