Using Coconuts - a Pythonic Blog

Username:

Password:


Don't have an account? Get one!

Uptime!

After my last post of dismay about my blog's instability, I thought that maybe a module my blog may have been outdated and in need of an update. It could be a bug in third party code which was keeping me down. However, when I ran my apt-get update, I noticed a slowdown of the server... and my blog crashing.

On a hunch, I restarted the blog, and ran an aptitude command again. This time, aptitude had problems allocating memory. Soon it became clear: my server was memory-choked.

/upload/thinking-cat

Can has moar memory?

See, my website runs on a server that doesn't really exist, a virtual server. That means there is a much more powerful actual machine which is running a program that's pretending to be a web server for me to use. This allows the owner of the machine to keep control of it, and to make sure I pay my bills.

However, as a college student, I can't afford too high bills, so I am only using a virtual server that has 256 MB of dedicated memory. This can be expanded to 512 MB on demand during high-load times, but I am only ever guaranteed 256 MB.

Now, if you remember, I switched from the relatively lightweight Durus object databse because it was unstable, to a heavyweight solution: ZODB. This is akin to my using the Titanic to transport a dozen people across the Atlantic. It works, and a storm isn't going to tip it over (but a Slashdot iceberg still likely will). The downside is that it's really heavy.

/upload/lift-heavy-box-cat

In this case, it means a whole lot of RAM usage, enough to bring my server to a constant 230 MB usage. This works until the part where something else needed to use more memory, when either my blog or the other memory-needy program would crash.

Normally what I would have to do in this situation is buckle up and pay the money for more RAM for my VPS. Luckily, though, I have a cheaper, and more importantly, more convoluted and interesting solution.

/upload/blog-vpn-setup

So basically, when you ask my server for blog.opensourcenerd.com rather than www.opensourcenerd.com, it redirects the request via a Virtual Private Network (VPN) to a computer in my room which has more memory and processing power available. A VPN is a fancy way of saying that I have a way of treating all my computers as if they were connected to a network hub that is sealed off from the rest of the internet. Since the way the data in the virtual network is transmitted is irrelevant (in fact, my VPN is also encrypted), all my computers can connect to each other regardless of firewalls. This is why the computer in my room can respond to requests from the external internet: because to it, it is only responding to requests over a local network. No firewall involved.

/upload/scared-cat

Okay, okay, just one more paragraph of jargon.

As you can see by the diagram, I mention shios.opensourcenerd.com. I have another such site set up which does the same thing. In its case, it is because of the large amount of disk space required for data files, and the relatively large amount of processing and memory it requires for rendering the killboard.

Okay, so now I'm done with explaining how it works, why have I not done this before? The approach I'm taking here has two disadvantages.

Speed. I'm adding another layer of complexity. That, plus the encryption and decryption of the data going two ways across the VPN probably adds to page load times. However, contrary to expectations, the amount of additional is actually not very large, and is certainly worth the stability gains.

/upload/turtle

Slow, but stable.

Stability. Wait, didn't I just say this was a more stable solution? Well, yes, and no. Sure, the blog won't crash because of having too little resources, but what if I accidentally knock the ethernet cable out of the computer? Or what if my college's awesome Laser Internetâ„¢ encounters some fog?

/upload/blog-vpn-setup-fail

The VPN is not a real network, it still needs the internet to function! In this instance, my blog would go offline (as would the Shioshi website). Because this does occasionally happen (and I am occasionally to blame for it), I have actually set up a nice error page that people are redirected to in case of failure -- instead of the ugly 503 error page that appeared before.

In any case, enjoy viewing my now re-stabilized blog. Until its next outage.

Phillip says... source permalink

I always enjoy cheap, interesting, and convoluted solutions. In fact - I'm tempted to try this myself. What (hopefully free as in beer as well as in liberty) VPN software are you using?

on 2010-09-29 00:30:07.299999

OpenVPN! More details on my setup (along with my iptables setup) here: http://blog.opensourcenerd.com/iptables-port-forwarding-with-vpn [blog.opensourcenerd.com]

on 2010-09-29 00:57:04.947547
New Comment
You're not logged in! Log in to be awesome!
Format: BBCode ReStructured Text

Author (max. 20 characters):