Koha on a Raspberry Pi: OPAC performance

The day after I returned from Kohacon 2012 in Edinbugh, a conference dealing with the free software integrated library system Koha, I was annoyed surprised by a constantly ringing doorbell at 8am. Having returned from Scotland with a cold and a severe amount of sleep deprivation, I did not plan to leave the bed that early. But the person at the door was very persistent. I expected nothing short of the house being on fire when instead I got a package delivered from the UK. The Raspberry Pi I ordered at the »launch« on February 29 finally arrived. It is a tiny, ARM-based $35 (plus taxes and shipping) computer with a 700mhz CPU (said to be comparable to a Pentium II 300mhz) and 256MB RAM.

After a week of Koha conference and hackfest, the most natural thing to do was to install Koha on the Raspberry Pi. I had spoken to a few people about that in Edinburgh and remembered that the Koha packages themselves should be no problem, rather the Zebra indexing server and MySQL might be problematic. It turned out that everything was available from the default repositories except for Koha itself. The Koha repository needed some tweaking because it does not contain packages for the ARM architecture yet, then he installation process started. I put up a more or less complete walkthrough of the installation of Koha 3.8 on the Koha Wiki.

What can you expect from a library system running on a $35 computer with a CPU less powerful than that of a recent smartphone?

The standard Koha 3.8 installation is functional. Search times in the OPAC are high (often more than 30 seconds), features like COinS or facet count should be avoided. The staff client is pretty slow too. Editing MARC frameworks was really not much fun. I created a library, a user, patron and media categories and what else is needed before you can import some data, all worked fine with some patience required.

Importing data via the staff client tools is a problem though. The file gets uploaded into RAM and then processed for import. Loading a big bunch of test data (30k biblios) failed because I ran out of RAM. I tried the same data with a swap partition enabled to get around that limitation but stopped that after the Raspberry Pi went unresponsive for more than 10 or 12 hours. It might have worked eventually but I wanted to continue playing with the device instead of waiting for what might have been days.

I imported smaller sets. 100 biblios went fine and did not take much time. ~980 biblios worked nicely too. Judging by the RAM use while importing I suppose that a few thousand records at once might be a problem. I have not tried any data import on the command line.

Koha has recently gotten some Plack patches that help to increase loading speed of pages in OPAC and staff client. They are not in the stable version yet but work with the development installation. So I pointed Koha to the git checkout to see how Plack would influence the performance. The result was amazing. I made some screen recordings for comparison.

Before each recording I emptied the cache and restarted Apache and Plack, so these are figures when opening the site or doing a search out of the blue. Expect subsequent searches and browsing to be a little faster.

1. Loading OPAC startpage: standard: 17,48s


Download file

2. Loading OPAC startpage: Plack: 9,23s


Download file

3. Search with multiple results: standard: 32,01s


Download file

4. Search with multiple results: Plack: 16,97s


Download file

5. Search with single result: standard: 59,87s


Download file

6. Search with single result: Plack: 25,86s


Download file

After some more search queries the dev installation with Plack got even faster. Searches with multiple search results started at 10 seconds, single hits that redirect to the detail page took about 17 seconds. The numbers varied though, sometimes it was several seconds slower, once in a while the first search returned no results and had to be repeated.

These results are still ’slow‘. Given that the device is ridiculously cheap and runs with 5V/700mA, that might be acceptable in certain cases. Especially in regions with unstable electricity it might be a valid option, maybe powered with solar panels or connected to a battery pack used as UPS.

The RAM of the Raspberry Pi is very limited, 32MB are instantly lost to the GPU even if you don’t use any graphics: the GPU is needed to boot the device, using proprietary software (a shame—have a heart, Broadcom). With Plack it is possible to turn off Apache to save some resources. There are probably more options than I have tried so far. We may not see huge Koha libraries running on this device, but a single branch seems possible once Plack enters the stable Koha release.

See also Koha on a Raspberry Pi: Staff client benchmarks

Dieser Beitrag wurde unter Koha abgelegt und mit , , verschlagwortet. Setze ein Lesezeichen auf den Permalink.