Tag Archives: Raspberry Pi

Nginx v Apache

I finally got around to doing some testing with Nginx.  I’ve written a description of how I set up Nginx on a Raspberry Pi.

I did a comparison of Nginx and Apache to see which would provide the best performance for my site.  Nginx was fastest for static content and dynamic content.

I want to deploy Nginx on my cluster, but first I have to figure out some issues with cache headers.  Hopefully I’ll get that worked out in the next few days.  I’ve posted a question about it on stackoverflow: http://stackoverflow.com/questions/19995097/setting-the-expires-header-stops-nginx-passing-requests-to-uwsgi

The makers of the Pi Face interface board have built themselves a new site.  They’ve linked to my site on this page – look for the picture of the robot buggy:  http://www.piface.org.uk/products/piface_digital/

 

 

Advertisements

My Raspberry Pi cluster was featured on Hackaday.com

A few days ago Hackaday featured an article about my Raspberry Pi cluster:  http://hackaday.com/2013/11/05/can-an-8-node-raspberry-pi-cluster-web-server-survive-hackaday/

The article was published at 12.00GMT, and my cluster served 2,440 pages in the first hour. In 12 hours, my site served 21,000 pages.

I checked the load on the load balancer and the backend servers, and everything seemed to be fine. This is the most traffic my site has had to handle so far, and I was pleased with the way it went. Page load times stayed low, and the cluster still had plenty of spare capacity.

Feedback was generally good. Some people questioned whether I really need an eight node cluster. I guess I don’t need eight Pi servers, especially for the amount of traffic my site is currently handling.

There are some dynamically generated pages on my site, and serving these pages uses a disproportionate amount of CPU time. I will probably add more dynamic content in the future, so I believe it’s a good idea to have some spare processing power.

It’s also important to consider that visitors don’t arrive on my site at evenly spaced intervals. If someone tweets a link to my site, there may be a rush of visitors in a short space of time, so the cluster needs to be able to handle spikes in traffic.

Some people left comments suggesting that my internet connection could be a bottleneck, and my internet connection will choke before the cluster gets overloaded. This seems like a reasonable point. If this becomes a problem, I may need to upgrade my internet connection.

Over the last few days I’ve been working on setting up uWSGI with Nginx. Everyone says Nginx is much faster than Apache when serving static content. Most of the pages on my site are cached, so it will be interesting to see how well Nginx performs with the CMS that I’ve written. I’ll write an article about Nginx and uWSGI in a few days.

My site got a spike in traffic from Facebook and Google+

In the week before last I added four more Pi servers to my cluster.  My site had served 45,000 pages in the last 30 days, so I decided to add some more horsepower.   Here’s a picture of my new cluster with new racks:

A Raspberry Pi server cluster with eight nodes

Eight node Raspberry Pi server cluster

You can see some note on how I extended the cluster here: http://raspberrywebserver.com/raspberrypicluster/adding-more-nodes-to-the-cluster.html

Since then the Raspberry Pi Foundation posted a link to my site on their Facebook page and their Google+ page.   This caused a huge spike in traffic.  I got over 1,000 hits in the first hour:

My site served over a 1,000 page views in one hour

Over 1,000 hits in one hour

I got almost 8,000 hits that day:

My site served over almost 8,000 hits on one day

8,000 page views in one day

That was about a week ago, and my cluster has now served over 64,000 page views in the last 30 days.  My site’s Alexa rank has gone down to 241,405.

 

Facebook Page

I’ve just made a Facebook page dedicated to my Raspberry Pi site. Feel free to visit and hit the like button!

I’ll be using it to share new posts on my site, and Raspberry Pi related links.

On site optimization

I’ve spend some time optimizing my Raspberry Pi web site so that pages load more efficiently. It’s made a noticeable difference to page load times.

I’ve also got four more Raspberry Pi computers to add to my cluster. I’ve made new racks for them, and I hope to get them on line over the next few days.

SQLite temperature logging on a Raspberry Pi

Recently I’ve written tutorials about database programming and CGI programming on a Raspberry Pi. I wanted to write a tutorial that builds on the ideas in earlier posts, so I built a temperature logging system that stores data in an SQLite database, and displays the contents of the database graphically in a web page.

I built a temperature logging system using a Raspberry Pi and a DS18B20 connected to the GPIO pins. I wrote a web script to query the database and display the temperature as a graph. The web UI also displays minimum, maximum and average temperatures. Follow this link to see how I built the Raspberry Pi temperature logger.

Here’s a screenshot of the web UI:

Raspberry Pi web UI

Raspberry Pi web UI for SQLite temperature logging system.

I’ve also written an article about getting a Raspberry Pi web server on-line.  This is a brief guide to making a Raspberry Pi web site visible on line.

 

Pi Repository

I’ve added my site to Pi Repository.  It’s a site that links to all the Raspberry Pi web servers that people have set up.  The owner’s still tweaking the site a little bit, but it looks pretty good.

It hasn’t been up long.  I’m sure there are more Pi servers out there, hopefully they will also register on Pi Repository.