[Koha] Out of memory

Mark Tompsett mtompset at hotmail.com
Thu Apr 5 17:05:47 NZST 2018


Greetings,

If you are not running plack, then you are probably experiencing 1MB per 
query leak with a default apache configuration with 100MB per query used. 
Digital Ocean has a nice 3GB droplet for $15/month.
As someone else also mentioned, MySQL loves to cache which leads to hogging 
memory. If you have implemented the auto-increment fix 
(https://wiki.koha-community.org/wiki/DBMS_auto_increment_fix),
then a weekly reboot isn't a bad idea. Also, use MariaDB over MySQL. :)

We were experiencing problems with our Koha, then I discovered my colleague 
had set up pingdom to check on the status of the OPAC every minute from 
multiple locations (the equivalent of really high use). We changed it to 15 
minutes from one location, implemented the auto increment fix, cleaned up 
the data manually, rebooted on Sundays, and upgraded to 3GB. We have not had 
a problem since with our over 120K items. However, we have a relatively low 
circulation, and small to moderate use compared to the number of items we 
have.

As for how much memory you should have, take a look at 
/var/spool/koha/{instance name} (I think) and see the size of the two files 
for any given day. Take that size and multiply it by at least 3. This will 
leave you room to run a full reindex, have MySQL cache things, and still 
have space for a several page loads per minute. If you have much higher use 
and/or circulation, you'll need to account for that. Imagine 100 students 
simultaneously accessing OPAC (okay, everyone press enter on your search in 
3,2,1... now), you probably want to have 10GB (100MB*100/1024 ~= 9.75GB) in 
addition to amount you calculated before. Imagine 5 librarians cataloguing 
simultaneously (okay, everyone click New Record in 3,2,1... now), you 
probably want another 1GB (100MB*5/1024 ~= 488MB always ceiling round up) in 
addition to amount you calculated before.

Currently, I do not recommend less than 2GB. Though, like Fred, I have had a 
test system hobble with 512MB. That is not recommended at all.

Ideal Size = 2 GB + Backup Size in GB * 3 + (Number of Simultaneous Users * 
100 / 1024) GB. Make sure to ceiling up to nearest GB size available.

That's my attempt at this question. :)

GPML,
Mark Tompsett

-----Original Message----- 
From: RubenoFernández
Sent: Monday, March 19, 2018 2:12 AM
To: koha at lists.katipo.co.nz
Subject: [Koha] Out of memory

Hi all,

How much memory do you need to run Koha?
I run a database with about 22000 records on a virtual server on Digital 
Ocean
with 1GB memory and very low usage, but the server is crashing very often.

With dmesg I find this kind of messages several times a day:

[Sun Mar 18 16:10:10 2018] addbiblio.pl invoked oom-killer:
gfp_mask=0x24201ca, order=0, oom_score_adj=0
[Sun Mar 18 16:10:10 2018] addbiblio.pl cpuset=/ mems_allowed=0
And then MySQL crashes and restarts:
Sun Mar 18 16:10:10 2018] Out of memory: Kill process 6539 (mysqld) score 
222
or sacrifice child
[Sun Mar 18 16:10:10 2018] Killed process 6539 (mysqld) total-vm:1538124kB,
anon-rss:224948kB, file-rss:0kB

From /var/log/syslog:
Mar 18 16:10:11 biblioteko systemd[1]: mysql.service: Main process exited,
code=killed, status=9/KILL
Mar 18 16:10:11 biblioteko systemd[1]: mysql.service: Unit entered failed
state.
Mar 18 16:10:11 biblioteko systemd[1]: mysql.service: Failed with result
'signal'.
Mar 18 16:10:11 biblioteko systemd[1]: mysql.service: Service hold-off time
over, scheduling restart.
Mar 18 16:10:11 biblioteko systemd[1]: Stopped MySQL Community Server.
Mar 18 16:10:11 biblioteko systemd[1]: Starting MySQL Community Server...

Just yesterday the killed process was rebuild_zebra.p, which didn't restart,
and Koha was retrieving no results for searches.

The strange thing is that Digital Ocean's own monitoring tool never reports
such memory spikes: usage is usually high but never more than 80%. Maybe the
spikes are too short? What would you recommend for a more fine-grained
monitoring of memory?

Right now my memory is this:
root at biblioteko:~# free
              total        used        free      shared  buff/cache
available
Mem:        1016056      555304      266328       14936      194424
292164
Swap:             0           0           0

On file /etc/mysql/mysql.conf.d/mysqld.cnf the value of
"innodb_buffer_pool_size" is 385M, if that's of any help.

Do I really need more physical memory on my server?
_______________________________________________
Koha mailing list  http://koha-community.org
Koha at lists.katipo.co.nz
https://lists.katipo.co.nz/mailman/listinfo/koha 



More information about the Koha mailing list