APCu and Memcaching Overload Postgres Database

My NC installation oftenly overloads the Postgres database of the server. In such cases my hosting provider temporarily blocks access to the database.

Therefore in the future, I want to avoid heavy load on the database but instead as far as neccesary reducing the performance of it?

Redis can not being installed in my hosting plan. So, Iam enforced to use ACPu.

What can I do?

Follow the recommendation in the Administrator guide to configure APCu.

I thought I did it. At least, the line

'memcache.local' => '\OC\Memcache\APCu',

is in my config.php. But is it really right, when the path to APCu.php at my server is in fact /lib/private/Memcache/APCu.php. So, should I replace OC by lib\private?

The answers are YES and NO. Nextcloud publishes access to internal function over an API, therefore it is correct what has written in the documentation. You can double-check that APCu is correctly loaded and enabled by executing the “phpinfo()” command.

Hmm:

$ phpinfo()
> 

That’s it. Nothing happens.

A php command need to be executed using a php interpreter :wink: Therefore create a php file, enter the php command “<?php phpinfo() ?>” and open it using a web browser.
You will find more detailed information in the php documentation:
https://www.php.net/manual/de/function.phpinfo.php

:+1: Looks good.

Hmm. But I can not connect my database. And my NC is down. What is the most effective method to find and target the cause?

Checking the Nextcloud log file, because it usually lists errors etc.

nextcloud.log is larger then 1 GB. How can I display, let’s say, only the last 100 lines or, even better, all lines newer than yesterday?

As usual may ways exist to extract data, e.g.

 tail -n <num-lines>  <file-name> | jq

grep "2021-02-1[5-6]" <file-name> | jq

This brought 205 MB of data. How can I find therein the needle in the haystack, that leads me to the reason of my stopped NC?

jq didn’t work.

You can try to filter the result, e.g. on “error”, “missing” etc., using the grep command to reduce the amount of data.