An Excellent, Low-Cost Web Server: Using the ODROID-N2 For Internet Hosting

As the developer of NEMS Linux, I’m always eager to try new boards that promise high performance and stability in the server room. Since NEMS is, itself, a headless server distro, I count it as an advantage that I do not need to deal with GPU drivers or desktop performance. What matters to me and my users is a lot different than what matters to an end user hoping for a desktop replacement powered by a single board computer.

It’s a bit of a revelation for me as I endeavor to provide a benchmark-based comparison–https://gigglescore.com/–to allow users to more easily figure out which board is the best value for the money. I had the opportunity to speak with @meveric when the ODROID-N2 was first released, and I must say I don’t envy how he and other desktop distro developers have to configure the graphic stack. They work hard to provide a good out-of-the-box user experience, and it cannot be easy. When I spoke with him, ODROID-N2 development was still at quite an early stage, and the lack of X11 drivers for the Mali-G52 GPU posed an interesting challenge. On the server distros I build I don’t have to deal with any of that, and the ODROID-N2 makes an excellent little solid-state server. Use case really does matter; a board that performs perfectly for NEMS Linux or other server-based distros may not be the same board that makes a great media center or daily driver. That’s why it’s so difficult to base purchase decisions on benchmarks alone and why Giggle Scores don’t always paint the complete picture.

It is within this context that I looked at the ODROID-N2 this month. I’d like to try it in a use-case where I feel it fits quite snugly; as a high-performance SBC web server.

The ODROID-N2 has a total of 6 cores consisting of a quad-core ARM Cortex-A73 and a dual core ARM Cortex-A53. It also features Gigabit Ethernet and up to 4 GB RAM.

Using Category5.TV SBC Benchmark v2.2 from https://github.com/Cat5TV/cat5tv-sbctest and a USD price for the ODROID-N2 of $79, my single test board running my Debian Buster base image reports as follows:

That’s slightly better than the average from https://gigglescore.com which reports the ODROID-N2 with a Ģv2 of 1304 (multithreaded), keeping in mind that a lower Giggle Score means better value (measured by multithreaded performance) for the price. Of course, my test above takes place on a vanilla Debian Buster install, so the numbers are true to an ODROID-N2 that is otherwise doing nothing. But even still, the ODROID-N2 presently demonstrates the best overall performance on GiggleScore.com and as a single board computer-based web server, the ODROID-N2 looks like a prime choice. Let’s build our own, and put it to the test.

First of all, keep in mind I’m starting with the Bald Nerd Base Image. This is Debian Buster, so no hackiness is required to get PHP 7.3 working. Our LAMP stack will include Apache2, PHP 7.3 with some helpful plugins, and ModSecurity 2.

Download the Debian Buster Build Base for ODROID-N2 and then flash it to your SD or eMMC card: https://baldnerd.com/sbc-build-base/

You can login to your ODROID-N2 either with a connected keyboard and TV, or from another computer on your network over SSH. The default login and password for my base image is “baldnerd”.

There are five things we need to do at first boot:

1) Check to ensure your SD card/eMMC (/) resized correctly:

df -h
2) Check your date/time is correct, and fix if not:
date
3) Create a Linux user account with root privileges. Here I’ll create a user called ‘robbie’ and give him sudo access. Just change ‘robbie’ to whatever you’d like your user to be.
$ sudo adduser robbie
$ sudo usermod -aG sudo robbie
4) Logout of your ODROID-N2 and log back in as robbie (or whatever your username is). Do not login as baldnerd anymore. 5) Delete the default user account:
$ sudo userdel -f -r baldnerd
Let’s build our LAMP (Linux, Apache, MySQL, PHP) web server. For those who prefer to perform the install programmatically, I have written a simple script here: https://raw.githubusercontent.com/Cat5TV/linux-tools/master/install-lamp

For those who want to get their feet wet and see every step, execute the following on your Debian Buster-booted ODROID-N2.

$ sudo apt update
$ sudo apt install apache2 php7.3 php7.3-cli php7.3-common php7.3-curl php7.3-gd php7.3-json php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-phpdbg php7.3-readline php7.3-sqlite3 php7.3-xml libapache2-mod-php7.3 libargon2-1 libsodium23 php-curl php-rrd mariadb-server libapache2-mod-security2 modsecurity-crs

Set a root password for MySQL

If you’ve installed mariadb-server in the past, you may remember that the installation procedure used to ask for a root password during installation. This has been removed. You must instead run a post-install application to set your root user and grant yourself root access to your MySQL database server.

$ sudo mysql_secure_installation
Hit enter when asked for the existing MySQL root password, since one doesn’t exist yet, and then follow the prompts to add a new root password. Remember what this password is and keep it safe. Be sure to say ‘yes’ to every question you’re asked to help harden your MySQL server by removing some of the sample data and accounts.

Give your user account access to editing the files Remember to replace ‘robbie’ with your username.

$ sudo usermod -aG www-data robbie
$ sudo chown -R robbie:www-data /var/www/html/
$ sudo find /var/www/html/ -type d -exec chmod -R 775 {} \;
$ sudo find /var/www/html/ -type f -exec chmod -R 664 {} \;
That’s it! Your web server is now running, and you can access it by visiting the IP address of your ODROID-N2 in a browser on any computer on your network. Files for the server are located in /var/www/html and owned by your user, and you already know the MySQL credentials. Access to MySQL is restricted to localhost, so for ease of use I’d recommend either using the mysql command line to create your MySQL users and databases, or adding phpMyAdmin and activating it only when needed, disabling it when you’re not using it. Remember that since SSH is active on the image, you can easily create files in /var/www/html, or use SFTP in Filezilla Client to move files back and forth from your computer.

And now, on with the benchmarks

Your server is ready to go, but benchmarks can be fun in a case like this. Maybe it’s my memories of giant 4U servers from my younger years in IT that have me excited about single board computers in the data center, but whatever it is, I’m impressed to see how well an ODROID-N2 performs in this role. You don’t personally need to perform these tests if you don’t want to–your work is done–but this article wouldn’t be complete without my own results.

My benchmarks below are very task-specific, focused entirely on using the ODROID-N2 as a web server. If you crave more or want a wider picture, check out the June 2019 issue of ODROID Magazine where Michael Larabel from Phoronix.com and Carlos Eduardo both provide their take on ODROID-N2 benchmark performance.

Now that we have Apache up and running, let’s benchmark it with Siege, the HTTP regression testing and benchmarking utility. I haven’t added a web site yet, so really we’re just testing the responsiveness of the static “It Works” page, but the results are still important to me. I recommend you put your site in /var/www/html and run the same benchmark to see how well your site performs. For this benchmark, we’ll do a load test with 50 simultaneous connections.

$ apt install siege
$ siege -c50 -d10 -t3M http://localhost/
Here is my result:
robbie@debian:/home/robbie# siege -c50 -d10 -t3M http://localhost/
New configuration template added to /root/.siege
Run siege -C to view the current settings in that file
** SIEGE 4.0.4
** Preparing 50 concurrent users for battle.
The server is now under siege...
Lifting the server siege...
Transactions:                   3540 hits
Availability:                 100.00 %
Elapsed time:                 179.16 secs
Data transferred:              14.85 MB
Response time:                  0.01 secs
Transaction rate:              19.76 trans/sec
Throughput:                     0.08 MB/sec
Concurrency:                    0.12
Successful transactions:        3540
Failed transactions:               0
Longest transaction:            0.20
Shortest transaction:           0.00
With every hit seeing a response in an average of 0.01 seconds, I’m really quite thrilled with this result. Most SMBs won’t see 50 simultaneous users on their website. Here, we generated 3,540 hits in 3 minutes.

Test the performance of MariaDB

Our MySQL server (MariaDB) is up and running thanks to the steps taken above. To test the performance of the database, I’ll use sysbench via the helpful mysql-benchmark.sh script that comes as part of my cat5tv-sbctest package on GitHub. I won’t go into how that works here, since those who are interested can look at the source code of the simple bash script. Suffice it to say, it compiles sysbench 1.0.17, creates 1 million MySQL entries, and benchmarks the performance of the database for 1 minute.

Here are my results:

Performing MySQL Benchmark: sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)

Creating table 'sbtest1'...
Inserting 1000000 records into 'sbtest1'
Creating a secondary index on 'sbtest1'...
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 8
Initializing random number generator from current time

Initializing worker threads...

Threads started!

SQL statistics:
    queries performed:
        read:                            35504
        write:                           10144
        other:                           5072
        total:                           50720
    transactions:                        2536   (40.83 per sec.)
    queries:                             50720  (816.58 per sec.)
    ignored errors:                      0      (0.00 per sec.)
    reconnects:                          0      (0.00 per sec.)

General statistics:
    total time:                          62.1083s
    total number of events:              2536

Latency (ms):
         min:                                   11.15
         avg:                                  194.09
         max:                                 4760.50
         95th percentile:                      846.57
         sum:                               492217.74

Threads fairness:
    events (avg/stddev):           317.0000/3.12
    execution time (avg/stddev):   61.5272/0.74
All of my queries were successful, and we performed a rather impressive 816.58 queries per second. This little guy will handle WordPress just fine! Remember, this is a single board computer that uses very little electricity, generates very little heat in the server room, and costs $79 USD. I’m impressed. If you’re looking for an affordable SBC-powered web server, whether for development, testing or production, the ODROID-N2 is ready to go and has enough power to serve your projects.

About the Author

Robbie Ferguson is the host of Category5 Technology TV and author of NEMS Linux. His TV show is found at https://category5.tv/ and his blog is https://baldnerd.com/. Robbie’s project, NEMS Linux is available for the ODROID-N2. Download the ready-to-boot Nagios Enterprise Monitoring Server distro from https://nemslinux.com/

Be the first to comment

Leave a Reply