[Koha] How to measure and improve Koha performance for our

dcook at prosentient.com.au dcook at prosentient.com.au
Mon Jan 17 19:16:59 NZDT 2022

Hi Mike,

Great to see another Australian library using Koha!

Regarding performance, I'd say the answer is "it depends". 

It looks like you're running Debian Buster (based on your Apache response), so I'm guessing you used the Debian packages to install Koha? I thought that new instances created this way used Plack out of the box, but I think I might be mistaken...

If you enable Plack/Starman, page loads and search times will be faster, because the application code is run in persistent processes that use pre-loading and caching of code. However, that comes at a cost. In practice, I find each Plack/Starman process reserves about 200-500MB RAM over its lifetime (default 50 requests before it's recycled if I recall correctly), and the default Koha configuration uses 2 Plack/Starman processes. Depending on expected usage, you may want more/fewer Plack/Starman processes. (Note that those processes are shared across the Staff Interface and the OPAC.) Overall, enabling Plack is the best way to improve Koha performance. At some point in the future, we hope to get rid of CGI support for Koha, but that's a long story. (Note that static assets like Javascript, CSS, images, etc are still served by Apache when Plack/Starman is enabled as Apache is much more efficient at serving those files.) (Another thing to note is startup for Plack/Starman processes are CPU resource heavy as a lot of work goes into setting up and verifying the REST API.)

I think Memcached might technically be optional, but you'll want to keep it for performance. Without it, performance would certainly degrade.

Overall, I'd say the more CPUs the better, especially if you're running your database on the same server. 

In terms of metrics, you can use third-party log analyzers (for the Apache logs) and web analytics (eg Google Analytics) to get an overview of how the application is performing overall. For more targeted analysis, I tend to just use the Developer Tools in the browser. For instance, I see your OPAC is taking about 4 seconds to serve the homepage. I tried one of the instances I manage (on a high specced server using Plack) and it took 333ms. There are other tools you can use for profiling the application, but that's a something you might want to explore with the "koha-devel" list instead. 

More reading: https://lists.katipo.co.nz/public/koha/2020-December/055598.html

I haven't used Linode so I can't really comment on its features, but other platforms like AWS make it very easy to switch between different CPU and RAM sizes. 

I'd say your first step is to enable Plack (on your test instance), and just manually compare similar web requests (like loading the home page, performing the same catalogue search). You should already have the RAM to handle it. I could see you getting into strife only having 1 CPU, as that 1 CPU would have a lot of work to do, but that's where the log analysis / web analytics can help you see real life usage. 

I hope that helps. Feel free to send more questions. 

David Cook
Senior Software Engineer
Prosentient Systems
Suite 7.03
6a Glen St
Milsons Point NSW 2061

Office: 02 9212 0899
Online: 02 8005 0595

-----Original Message-----
Date: Fri, 14 Jan 2022 16:04:11 +1100
From: Mike Lake <mikel at speleonics.com.au>
To: Koha <koha at lists.katipo.co.nz>
Subject: [Koha] How to measure and improve Koha performance for our
Message-ID: <daad1c0c667cacb91cb604a2e7797a9c at speleonics.com.au>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Hi all

We have a production library setup at https://opac.caves.org.au and its now ready for users to use. We also have a test instance that can be used for testing. I'm wanting to know the options for measuring and improving the performance - just basic load and search time that users perceive.

Currently we are running on a Linode instance with 1 CPU and 2 GB RAM. 
Yes it's a small library :-) Looking at Linode Longview it shows we have not hit more than 7% CPU usage and it usually sits at 1% CPU and 670 MB mem when idle. During a query cpu goes to 100% for a short period and mem to ~ 1 GB.

I see in htop that several memcache threads are running. That's now installed automatically with Koha? The wiki seems to suggest that its optional. And there is plack mentioned in the wiki. Should we be running plack?

I can double our Linode instance to 2 CPUs and 4 GB RAM but that's possibly an irreversible change (and double the $) so wish to leave that until I know it would make a significant difference. And how could I quantify that performance increase?



More information about the Koha mailing list