My self host isn't as "fast" as other sites

AI-generated summary

Genisis is experiencing slower performance on their self-hosted Discourse site, despite having a powerful 12-core CPU and 40GB of RAM. They’ve noticed that the site is quicker when not logged in and suspects that the large number of images and videos might be the issue.

Architect suggests that hosting videos on another platform, such as YouTube or Vimeo, could help improve performance. merefield shares their own experience with a much smaller server, achieving near-instant page transitions by serving videos via YouTube.

pfaffman points out that Genisis’ db_shared_buffers setting is excessively high, recommending 10GB or 25% of the total RAM. Genisis reduces the setting to 10GB and also sets up Cloudflare tunnel, resulting in significantly improved performance. pfaffman explains that allocating too much RAM to PostgreSQL can leave insufficient resources for the web server, which was likely the cause of the slowdown.

Genisis is happy with the improved performance and grateful for the advice. pfaffman mentions that the app.yml file contains comments with reasonable default values, which can be used as a starting point for optimization.

my self host isn’t as “fast” as other sites, I notice other sites are near instant/really quick, mines quicker when not logged in I realized, its not unusable slow at all but for my specs I’d think it’d be quicker.
12 core cpu, 40GB ram. for privacy reasons I can’t share domain.
any tips on what to check or how I can optimize my app.yml would be grateful.
it mostly has images/videos, is that the issue?

db_shared_buffers: "34096MB"
db_work_mem: "90MB" (uncommented)
UNICORN_WORKERS: 25

proxied through Cloudflare (for DDoS protection, pro plan)

A lot of images and videos could be the problem, are those all uploaded directly to the discourse site or do you have videos on another platform?

If you are able to host videos on another platform and post links at discourse site that could help.

uploaded directly to the platform.. hmm maybe

Few supported platforms that integrate with discourse are brightcove, youtube and Vimeo:

Yeah, for reference I get near “instant” page transitions on:

  • 4GB, 3 Core with
  • 2 Unicorns (on review this could probably be upped!)
  • db_shared_buffers: "256MB"
  • no CDN

But serving any videos via YouTube.

Everything more or less default

Shared buffers should be about 10gb. Am I confused or do you have 34gb of shared buffers?

You could change to 6 unicorn, from what I’ve read. 3 cores, 2 uniform per core so 6 :slight_smile: but yeah i get it

Yes :frowning: thought it would make it faster some how. I could change it to 10GB

Yep, I commented out that setting and rebuilt :+1:

A hangover from days when I was on a smaller VPS.

The recommendation is 25% of ram. If you give postgres almost all of the RAM then you have no ram left for the web server. This is probably your problem.

I see, wish there were more docs on how to optimize it etc, not all the time the bootstrapped thing is efficient, I set it up on a new server, and changed it to the suggestion you made, I also set it up with Cloudflare tunnel, is it a good idea long term? everything loads fast now! im happy

There are comments in the app.yml file. discourse-setup creates reasonable values. Those defaults would likely work with several million monthly pageviews.