Raspberry as a dedicated server? The result is amazing
Raspberry has been one of the greatest revolutions of modern computing. It sold over 5 million units since 2015. Most of the people use it as a media centre, video games emulator console, music player, advertising outdoors… And now Copahost thought: why not using it as a cheap dedicated server?
First of all, the setup
We used one stock Raspberry Pi 3 B (49€), with 1GB of RAM and a 1.2GHz 64-bit quad-core ARM Cortex-A53 CPU. The storage is one 32GB Adata Class 10 MicroSD card (9€).
This Cortex-A53 is 10 times faster than the original Raspberry 1 CPU. That’s a huge improvement.
We installed Raspbian Jessie on it.
Let’s bring the Raspberry “junior” dedicated server into the data center and power it on
Expand the filesystem with raspi-config
By default, Raspbian will partition the SD card only using a small partition. We must enter raspi-config, in order to expand the filesystem to use all the available space in the SD card.
And then simply select “Expand Filesystem” and hit enter.
Note: you have to reboot it so that changes take effect.
After the reboot, we can now see the whole space mounted in /
Installing LAMP – Apache MySQL and PHP
First of all, let’s install Apache web server
# sudo apt-get install apache2 -y
Now let’s install PHP5 with Libapache
# sudo apt-get install php5 libapache2-mod-php5 -y
Now we will install MySQL
# sudo apt-get install mysql-server php5-mysql -y
Let’s see it running
Benchmark – Dedicated server vs Raspberry Pi 3 B
We made a stress test in the web server, to check what was its limit. We performed 50 concurrent and sequential connections to it, using curl. The result was amazing. It was pretty stable with up to 35 connections, and still worked fine with 50 simultaneous connections!
We created a script called stress.sh, with this content:
max=50 for (( i=1; i <= $max; ++i )) do curl -s "http://rasptest.copahost.com?[0-500]" & done
Of course we know Raspberry have a simple CPU, compatible with its price. So we put an old dedicated server together and tested both of them with sysbench for linux.
In Sysbench we got a score of 40.23s in E2180 versus 954.90s in Raspberry Pi 3. The lower, the better. The performance of the Raspberry Pi 3 may be a bit disappointing if compared with a standard dedicated server.
In other words, this CPU is 23 times slower than a standard Pentium Dual Core.
Conclusion: is it possible to run Raspberry Pi as a dedicated server in production?
The Cortex-A5 CPU, present in Raspberry 3, is 10 times faster than Raspberry Pi 2 CPU. Using it to host a simple site with a simple MySQL database works perfectly. You can consider using a Raspberry dedicated server for simple operations. As you populate a MySQL database with many results or install some WordPress plugins, the performance may be suffering a bit.
Very low power consumption
Can be used as a small and simple web and database server
External USB Hard disks can be connected to it
Very low price
Poor CPU performance
Poor IO performance, as it depends on an SD card
Lacks a reboot button (there are some mods for it)
For those who need a cheap but a powerful server, the best option is still a VPS Server.
In the next versions, Raspberry should be more competitive and able to handle more and more crowded websites. Copahost hope the “Junior server” will grow and be a competitive piece of hardware within a few years.