New adventures in hosting a single file

When I launched my Flickr Widget a couple of years ago, I decided I would host the tiny little Flash file that is the heart of the widget. I didn’t want to bother end users with downloads and installs and such. I put the file on Amazon’s S3 service, and offered an embed code generator form on this site. This worked well for a while, but more and more people started using the widget. Soon, Amazon started sending me hefty monthly bills.

I experimented for a while with hosting the file on the same server that runs this blog, but my host did not like that idea. Their terms of service don’t allow me to host non website-related files. So I moved the file to a friends VPS (Virtual Private Server). By then, the 5 KB Flash file was being served millions of times a month, causing around 30 GB of monthly traffic. I needed a more permanent solution.

A low end box

That’s when I stumbled across Secure Dragon. I found them through Low End Box, a community dedicated to running small, efficient VPS servers. They seemed to have a pretty good track record, their VPS servers came with plenty of monthly data and they were very affordable. I decided to try setting up a small, dedicated VPS with them just to host my Flash file.

Four megabytes of RAM

Signing up was super easy, and the VPS was activated instantly. I was a little surprised that I didn’t get to choose the OS image to be used for my VPS but it turned out to default to the one I wanted anyway. Secure Dragon offers a stripped down version of Debian Linux that uses only 4 MB of RAM when idle. To me, that’s astoundingly little memory. It leaves quite a bit of headroom, even on my 128 MB VPS. It comes with the bare essentials (SHH, cron, etc) but little else.

Lighttpd

For a client project, I’ve been trying to get Apache web server to cope with a large number of requests. I don’t want to go into details, but let’s just say Apache was not the right choice for my new low end box. I decided on lighttpd (“Lighty”) instead, because it’s really easy to set up, and is known for handling tons of requests with ease.

I set up Lighty with almost no extra modules. I didn’t need PHP or URL rewrites. A full LAMP stack (or rather LLMP) would have consumed more resources and introduced additional complexity. All I needed was LL (Linux, Lighttpd). Lighttpd had some problems with memory leaks in the past, but I have yet to notice anything out of the ordinary.

Load average: 0.00, 0.00, 0.00

The result is a tiny little VPS that is still significantly overpowered for what it’s doing. It’s humming along nicely, at near-idle load levels, while serving hundreds of thousands of requests daily. On average, the whole setup uses around 12 MB of RAM. This doubles when I sign in over SSH, so I have to rely on the graphs that SD offers in their control panel.

While I’m not a Linux system administrator, I feel confident that I did a decent job setting this up. The minimal Debian image was a great start, and there are tons of very good tutorials out there that help you install lighttpd and secure your VPS. I’m looking forward to maintaining this setup and keeping those Flickr images floating.

9 Comments

  1. Hi, I have been using this widget for the past month, or so, and it has recently disappeared from my blog today…Is there something I need to do as a result of your changes above to make it visible again? HELP!!
    Thx.

    Comment by Jacquee — October 19, 2012 @ 6:19 pm

    • It should not be affected at all. There was no interruption of service during the move, but perhaps there was a caching issue. It seems to work right now (on your site).

      Comment by Roy — October 22, 2012 @ 2:23 pm

      • Yes, thanks. It started working again shortly after I sent the above message.

        Comment by Jacquee — October 22, 2012 @ 2:32 pm

  2. Hello
    Ja use in my blog the years your flickr widget.
    Congratulations, it is wonderful
    I wonder if you have other models for flickr widget, using the same principle of “cloud”.
    Thank you

    Comment by Alessandra — November 10, 2012 @ 9:23 pm

  3. I’ve bee using the Flickr widget for quite some time now. I just wanted to say thank you!

    Comment by Nathan — December 10, 2012 @ 4:56 am

  4. Nice tip. Haven’t come across lighttpd before. Will check it out.

    Comment by EireSoft — December 11, 2012 @ 10:09 am

  5. never had a problem with some dell enterprise servers and apache. you got to do what you got to do right? may reason i left ms web server was do to low end boxes. came to find out linux ran my resources about 50 percent lower. nice article. thanks!

    Comment by michael — January 7, 2013 @ 11:17 am

  6. I just tried to add this to my wordpress blog and I am getting an error so to speak. Once I place the HTML code into the text widget (the preview on your website words perfect so I know I put the right RSS code in) and hit save …. it changes the HTML to say “Get this widget at roytanck.com” and will now show my pictures …. any ideas as to why or what I need to do differently?!?!

    Comment by Jeanine — July 16, 2013 @ 7:18 pm

    • Unfortunately, the widget only works on self-hosted WordPress blogs, not on wordpress.com.

      Comment by Roy — August 6, 2013 @ 8:46 am