this post was submitted on 17 Sep 2025
17 points (94.7% liked)

Linux

58282 readers
554 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
 

cross-posted from: https://swg-empire.de/post/4511580

In my relentless pursuit of trying to coax more performance out of my Lemmy instance I read that PostgreSQL heavily relies on the OSs disk cache for read performance. I've got 16 GB of RAM and two hdds in RAID 1. I've PostgreSQL configured to use 12 GB of RAM and I've zram swap set up with 8 GB.

But according to htop PostgreSQL ia using only about 4 GB. My swap gets hardly touched. And read performance is awful. Opening my profile regularly times out. Only when it's worked ones does it load quickly until I don't touch it again for half an hour or so.

Now, my theory is that the zram actually takes available RAM away from the disk cache, thus slowing the whole system down. My googling couldn't bring me the answer because it only showed me how to set up zram in the first place.

Does anyone know if my theory is correct?

top 2 comments
sorted by: hot top controversial new old
[–] Overspark@piefed.social 4 points 1 day ago

You're probably correct, although I have no experience with zram so can't be sure. But you're absolutely right that PostgreSQL depends heavily on the OS disk cache for optimal performance. Lowering the PostgreSQL setting like Blaster M suggests won't improve performance much, since all that setting does is tell PostgreSQL's algorithms how much memory is likely to be allocated to the OS disk cache. Of course it's best if it's accurate, so you're best off seeing how much memory is actually allocated to disk cache under heavy use before setting it, but it shouldn't massively reduce performance if you don't get it right.

[–] Blaster_M@lemmy.world 2 points 1 day ago* (last edited 1 day ago)

Lower the postgre to 8GB and see what happens? Also, hard drives, ssds, or nvme ssds? Recent info suggests it is possible memcaching is actually slower than direct access to nvme ssd