# High CPU Load - every crontab - docker mysql

**URL:** <https://help.nextcloud.com/t/high-cpu-load-every-crontab-docker-mysql/161116>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Tags:** docker, ubuntu, redis, mysql, docker-compose\
**Created:** [April 28, 2023, 9:34am UTC](https://help.nextcloud.com/t/high-cpu-load-every-crontab-docker-mysql/161116 "2023-04-28T09:34:03Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Crys](https://help.nextcloud.com/user_avatar/help.nextcloud.com/crys/32/14270_2.png) [@Crys](https://help.nextcloud.com/u/Crys)\
**Post date:** [May 23, 2023, 3:58pm UTC](https://help.nextcloud.com/t/high-cpu-load-every-crontab-docker-mysql/161116/8 "2023-05-23T15:58:27Z")

</div>

> [@anon75456558](#):
>
> Have you tried searching the [forum](https://help.nextcloud.com/search?q=100%25%20cpu%20cron) and [internet](https://duckduckgo.com/?t=ffab&q=nextcloud+crontab+cpu&ia=web) and [documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/background_jobs_configuration.html) for more info on `Nextcloud crontab`
> 
> There are tons of topics on this

Of course, that should be part of the basis before any question 😉

A lot of questions, but no clear answer … and for me also no solution.

> **What I could exclude**
>
> [Cron.php hangs causing 100% cpu load](https://help.nextcloud.com/t/cron-php-hangs-causing-100-cpu-load/116758)
> 
> caused by bookmarks add-in. I dont’ use this
> 
> * * *
> 
> [A new cron.php every 10 minutes and 100% CPU load](https://help.nextcloud.com/t/a-new-cron-php-every-10-minutes-and-100-cpu-load/117512)  
> [Cron.php creats high mysql load and doesn't finish](https://help.nextcloud.com/t/cron-php-creats-high-mysql-load-and-doesnt-finish/34418)  
> [The cron.php tasks run for hours, constant CPU load, queries on oc\_filecache](https://help.nextcloud.com/t/the-cron-php-tasks-run-for-hours-constant-cpu-load-queries-on-oc-filecache/85054)
> 
> “cronjob never ends…” → my cronjos end every 5-7min sucessfully. No need to break it up.
> 
> * * *
> 
> [Cron.php running erratically](https://help.nextcloud.com/t/cron-php-running-erratically/153949)
> 
> no answer
> 
> * * *
> 
> [Why so many cron logs & high cpu load](https://help.nextcloud.com/t/why-so-many-cron-logs-high-cpu-load/31494)
> 
> only one cron is runing, on my machine
> 
> * * *
> 
> [[SOLVED] Occ command; PHP Fatal error, Allowed memory size of XXX bytes exhausted - #57 by crobarcro](https://help.nextcloud.com/t/solved-occ-command-php-fatal-error-allowed-memory-size-of-xxx-bytes-exhausted/108521/57)
> 
> commenting out memcache.local’ =\> ‘\OC\Memcache\APCu’, from /var/www/nextcloud/config/config.php, letting the cron job run
> 
> No improvement

> **What I (also) had tried without success**
>
> - Cron every 1min: It is executed every now and then. Mostly one start every 7-14min.
> - Cron every 2-10min: same behavior as above.
> - Cron \>10min: it is always executed.
> - Cron every 1-6h: same as above
> 
> The duration of an execution is always very same. Always 5-7min, no matter if every 1min or 6h.
> 
> * * *
> 
> ```auto
> docker exec -ti --user www-data nextcloud php /var/www/html/occ db:add-missing-indices
> docker exec -ti --user www-data nextcloud php /var/www/html/occ db:add-missing-primary-keys
> docker exec -ti --user www-data nextcloud php /var/www/html/occ db:convert-filecache-bigin
> 
> ```
> 
> No improvement
> 
> * * *
> 
> ```auto
> docker exec --user www-data nextcloud php --define apc.enable_cli=1 -f /var/www/html/cron.php
> 
> ```
> 
> No improvement
> 
> * * *
> 
> `-d memory_limit=4G`
> 
> it’s allredy set in compose file to `PHP_MEMORY_LIMIT=2G`
> 
> * * *
> 
> “slow\_query\_log” has no entries about queries that have run for more than 2s
> 
> * * *
> 
> I had stopped all (!) NC apps → no success.

> **What I had not yet tried so far**
>
> - Nextcloud Docker to fpm or fpm-alpine
> - find unprintable characters in MySQL DB (I had read somewhere, I can’t find it anymore)

* * *

**The solution is/was:**

- **Using MariaDB!**

I created a dump from my mysql 8 db and loaded it into a mariadb 10 (both docker). Since then the problem no longer occurs: (since 48h)

MySQL:

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/4/a/4a213e02ac1128f6444c9fae9948265507ef082b.png)

MariaDB:

 ![grafik](https://help.nextcloud.com/uploads/default/original/3X/f/8/f8db61f5d1a1ad7c7993166d397acb16161ff612.png)

What I also noticed here:

- the NC24 mysql database (lib folder) was 4.2GB
- the NC25 mysql db is 16GB !
- the dump of this db is 2,4GB uncompressed
- the NC25 MariaDB is 4,1GB

Not much new data has been added to the database since NC24 (last about February) (about 6TB).  
Since the switch to MariaDB I have not noticed any losses (of files, app data, …).

I will continue to follow the topic, but this one is closed (for now) for me.  
If someone needs more information (about the 16GB mysql db) for debbugging reasons, just contact me.

---

_[View the full topic](https://help.nextcloud.com/t/high-cpu-load-every-crontab-docker-mysql/161116)._
