Nextcloud seems to have a bad reputation around here regarding performance. It never really bothered me, but when a comment on a post here yesterday talked about huge speed gains to be had with Postgres, I got curious and spent a few hours researching and tweaking my setup.
I thought I’d write up what I learned and maybe others can jump in with their insights to make this a good general overview.
To note, my installation initially started out with this docker compose stack from the official nextcloud docker images (as opposed to the AIO image or a source installation.) I run this behind an NGINX reverse proxy.
What I did first is migrate from maridb to postgres, roughly following the blog post I linked above. I didn’t do any benchmarking, but page loads felt a little faster after that (but a far cry from the “way way faster” claims I’d read.)
admin settings/system
to make sure Nextcloud is now using postgres. ./occ db:convert-type --password $POSTGRES_PASSWORD --all-apps pgsql $POSTGRES_USER postgres $POSTGRES_DB
docker compose up -d --remove-orphans
I followed above guide for connecting to Redis with sockets with details as stated below. This improved performance quite significantly. Very fast loads for files, calendar, etc. I haven’t yet changed the postgres connection over to sockets since the article spoke about minor improvements, but I might try this next.
config/config.php
, as well as config/redis.config.php
/etc/localtime
and /etc/timezone
volumes the app container did, as well as the volumes_from: tmp
I’m now connecting to Postgres over sockets as well, which gave another pretty significant speed bump. When looking at developer tools in Firefox, the dashboard now finishes loading in half the time it did before the change; just over 6s. I followed the same blog article I did for Redis.
/etc/localtime
and /etc/timezone
; add user: "70:33"
; add command: postgres -c unix_socket_directories='/var/run/postgresql/,/tmp/docker/'
; add tmp container to volumes_from
and depends_on
'dbhost' => 'postgres',
with 'dbhost' => '/tmp/docker/',
What have you done to improve your instance’s performance? Do you know good articles to share? I’m happy to edit this post to include any insights and make this a good source of information regarding Nextcloud performance.
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.
Rules:
Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.
No spam posting.
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.
Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
No trolling.
Resources:
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
Is there a way to self-host nextcloud by downloading one file, docker container, .nzb, .jpg, ANYTHING that includes all these parts and can just plug in and run? Is that a thing, or do all self-hosters spend every waking hour sudo updating?
Nextcloud AIO or all in one. It works relatively well. I run both my own container and an AIO instance and I’ve been pretty happy with it, I’ll likely migrate to it for my docker only one in the near future. Nextcloud AIO
I didn’t think Nextcloud AIO would actually work with existing files on a separate drive. I know it says it will … but … I’m not interested in buying a gigantic new harddrive to clone all my data to just to run one program.
Also, if it’s running in WSL or a VirtualBox VM it would be fucking hell to get it to play nice with the network.
You mean like the AIO image, the one officially supported way to install Nextcloud?
But if you want to tune it, I’m afraid you’ll have to run
sudo tune
once per waking hour.