I have my own Lemmy instance (Lemmy.emphisia.nl) but I had to take it offline, after running a while it was using more than half of the system memory (16gb in total). Causing the computer to crash as there are a lot of other services also running on it. The problem appears to come from postgress. In btop I can see it spawning a lot of processes all taking up about 80 MB in the beginning but rising as it runs, rising as high as 250 MB per process. I have already tried adjusting the postgress config to be optimized for less memory, but it seems to do nothing.

Is this normal, and if not, what is going wrong?

@youpie_temp@reddthat.com
creator
link
fedilink
English
88M

oh wow thanks, ill see if that fixes it! weird that it doesnt get killed by OOM killer on my server

Does your server has a big swap space?

@youpie_temp@reddthat.com
creator
link
fedilink
English
38M

It has zswap and a swapfile of about 8 gb, and it gets fully utilized

@redcalcium@lemmy.institute
link
fedilink
English
10
edit-2
8M

Yeah, this is why I have small swap on my servers. I’d rather the process got killed by the oom killer and got restarted automatically instead of running very slowly and trashing the entire server when it uses too much memory.

Jeena
link
fedilink
English
48M

Since my upgrade to 0.19 I really struggle to keep my servr online. It sounds like what is happening to me too. The whole server beco.en unesponsive after the load goes to 100. After I kicked NextCloud from the server in only kept happening every coupple of days. Let’s see if this workaround helps to fix it. If not then I’ll remove swap.

poVoq
cake
link
fedilink
English
28M

I have been running a cron script to automatically restart the lemmy backend, which in turn resets the postgres memory use ever since this problem started to happen months ago. For me 0.19.x actually made it less bad, but it is still an annoying issue.

Try limiting the database connection pool size too in lemmy.hjson. It helped a lot in my instance. I set mine to 30 in a small server with 8gb ram. You can set it to even lower value for lower postgres memory consumption.

database: {
        host: dbhost
        user: "lemmy"
        password: "secret"
        database: "lemmy"
        pool_size: 30
}
Create a post

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:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. 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.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 279 users / day
  • 589 users / week
  • 1.34K users / month
  • 4.55K users / 6 months
  • 1 subscriber
  • 3.5K Posts
  • 70K Comments
  • Modlog