Stop Doing Swap Partitions

a month ago by GolfFoxtrotLima to c/programmer_humor

Dirk 55 points a month ago

Remember when they said “swap should be 2 times the amount of RAM”.

Why would I waste 128 GiB of storage for nothing?

path: 0 25810482, hotness: undefined, score: 55, children: 8
FlexibleToast 21 points a month ago

They stopped saying that a long time ago. It became something like 2x ram until beyond 4GB then it was something more sane.

path: 0 25810482 25815237, hotness: undefined, score: 21, children: 0
istdaslol 12 points a month ago

Did the same thing but some apps are designed with that in mind and I had worse performance so had to do a swap file again

path: 0 25810482 25810552, hotness: undefined, score: 12, children: 5
Dirk 19 points a month ago

Never have I ever heard about apps that need a swap file to operate normally.

path: 0 25810482 25810552 25810628, hotness: undefined, score: 19, children: 4
AnAmericanPotato 19 points a month ago

Docker.

Only half-joking.

path: 0 25810482 25810552 25810628 25811788, hotness: undefined, score: 19, children: 0
istdaslol 5 points a month ago

Me neither but creating one fixed my performance issues so I figured that was the issue. TBF it was a pagefile under windows so it might be a windows specific quirk but the main point still stands

path: 0 25810482 25810552 25810628 25810727, hotness: undefined, score: 5, children: 2
flexicon 11 points a month ago

Yeah, your first mistake was using Windows and expecting performance.

path: 0 25810482 25810552 25810628 25810727 25812090, hotness: undefined, score: 11, children: 1
RedSnt 1 point a month ago

That's why whenever I've upgraded PC I always tried to double or more than double the amount of RAM my last PC had. So this last upgrade I went from 16 GiB to 64 GiB. DDR4 though. I doubt I'll be able to double it next time with these prices though.

path: 0 25810482 25820654, hotness: undefined, score: 1, children: 0
TootSweet 38 points a month ago

I know right now you're stuck exclusively using swap, but If you work hard and apply yourself, you may one day be able to afford one whole gigabyte of ram without going more than five figures into debt.

path: 0 25811342, hotness: undefined, score: 38, children: 0
mkwt 37 points a month ago

pagefile.sys has entered the chat.

path: 0 25811060, hotness: undefined, score: 37, children: 0
SleveMcDichael 30 points a month ago

Please, for the love of who ever you hold in high esteem, use swap. See: https://chrisdown.name/... Now I don't really like the whole "Heres an article from some rando to prove my point" thing, but anecdotally, the article does line up with my experience (with 32 gigs of system memory). Namely, when I went without swap I experienced frequent system lock-ups, when I added swap on zram, lock ups still happened but less frequently, and when I eventually changed swap on zram to disk swap on the recommendation of this article lock ups never happened again.

path: 0 25813123, hotness: undefined, score: 30, children: 3
kopasz7 17 points a month ago

To add some nuance to this, do not use ZRAM in combination with swap. There's ZSWAP for that which does what you would expect, without clogging up your RAM and gracefully handling a backing device. (ZRAM is just another block device for the kernel, so you will get LRU inversion if it fills up and you have another layer of swap on disk. Meaning your cold pages will be needlessly stuck in zram.)

path: 0 25813123 25813448, hotness: undefined, score: 17, children: 1
SleveMcDichael 10 points a month ago

Yeah, the same person who wrote the article I linked above also wrote one on zram vs zswap, which I think is also a good read: https://chrisdown.name/...

path: 0 25813123 25813448 25813544, hotness: undefined, score: 10, children: 0
auzy1 1 point a month ago

Use Swap FILE though.. Not Swap Partition

path: 0 25813123 25833567, hotness: undefined, score: 1, children: 0
anon_8675309 22 points a month ago

I’ll do whatever the fuck I want, thank you.

path: 0 25812327, hotness: undefined, score: 22, children: 0
PlexSheep 15 points a month ago

And if you need swap just do a swap file

path: 0 25810506, hotness: undefined, score: 15, children: 1
marcos 16 points a month ago

If you need swap, you probably should look at the tradeoffs of a file vs. a partition, or maybe even adding another entire disk.

But if you don't know if you'll need it, it's because you won't.

path: 0 25810506 25811112, hotness: undefined, score: 16, children: 0
Scoopta 13 points a month ago

Lol, I stopped swapping when I got enough RAM to never need swap

path: 0 25812359, hotness: undefined, score: 13, children: 2
kopasz7 14 points a month ago

Even if you don't run out of RAM your kernel will use swap to defragment your memory. Usually you end up with gaps in memory that are too small to effectively allocate as programs open, close or stay running over time.

path: 0 25812359 25813510, hotness: undefined, score: 14, children: 1
Scoopta 7 points a month ago

That's ok, I have enough RAM that I'm not particularly worried about that either. I also don't leave my computer on all night, I like to be nice to my tech, also locks my drives

path: 0 25812359 25813510 25813828, hotness: undefined, score: 7, children: 0
SalamenceFury 12 points a month ago

Sorry, my 8 GB study laptop freezes all the time on Librewolf and it has a Bay Trail chip. I gotta have it.

path: 0 25814530, hotness: undefined, score: 12, children: 2
Junkers_Klunker 3 points a month ago

You must have a bajillion tabs open, until recently I used an old thinkpad with 8gb of soldered ram and never ran into ram issues with only librewolf running. It was a different story though when I started qGIS and a couple of libreoffice instances.

path: 0 25814530 25816630, hotness: undefined, score: 3, children: 1
SalamenceFury 3 points a month ago

I usually have VSCode, Discord and MusicBee (with Wine) open in the background, but yeah I just open a bunch of tabs sometimes. I did make a swap file and not a partition however.

path: 0 25814530 25816630 25822997, hotness: undefined, score: 3, children: 0
shelf 12 points a month ago

I miss Intel optane

path: 0 25812077, hotness: undefined, score: 12, children: 1
Auth 9 points a month ago

dont worry Samsung zNAND-O is coming to fill the gap at unaffordable prices.

path: 0 25812077 25816085, hotness: undefined, score: 9, children: 0
Caitlyynn 9 points a month ago

My skyrim modpack need 60GB of Swap Space :(

path: 0 25811577, hotness: undefined, score: 9, children: 0
RiQuY 9 points a month ago

Everytime I install a fresh OS I setup swap when I feel I'm having OOM issues or random freezes, it's just creating one 16GB file and enabling it as swap. Much easier than going to read now about zswap zram or whatever I'm "supposed" to be using.

path: 0 25814895, hotness: undefined, score: 9, children: 0
ScarlettStunningSpace 6 points a month ago

Does it make a system more stable or less stable? What about under proxmox?

path: 0 25815782, hotness: undefined, score: 6, children: 1
twack 6 points a month ago

If you run out of RAM and have swap disabled, then some program must be killed to make room. That's handled by OOM (out of memory).

Whatever got killed might have been important, and you as the user don't get to pick at that point.

path: 0 25815782 25823962, hotness: undefined, score: 6, children: 0
serpineslair 6 points a month ago

I usually make swap partitions on hdds tho never on ssds. I can happily spare ~10GB hdd space in this memory drought.

path: 0 25811575, hotness: undefined, score: 6, children: 3
shitonit 2 points a month ago

nerddd

path: 0 25811575 25833406, hotness: undefined, score: 2, children: 2
serpineslair 2 points a month ago

ḭṙṏṆṆṆṆṆ

path: 0 25811575 25833406 25835956, hotness: undefined, score: 2, children: 1
shitonit 2 points a month ago

🫸🫸I̸̛̦̱̪͙̮͇̍͋̒͑͋̂͊r̷̤̺̳͇̻̠̤͇͋ͅȮ̶͇̱̫͖̭͙̞̖͚̔ͅŇ̷̘̠͓͍̞̠͉͓͚̩̽̏̓̾n̸̡̛͉͌̐́̉͌̊͒͝Ń̴̢̯̟̯̙̤̑̋̓̉̄͗ņ̸̧͇͕̺͕̎͆̿̓̓͠N̷͙͈̫̰͉̋͐̍̈̿̄̋̓̕🫷🫷

path: 0 25811575 25833406 25835956 25835989, hotness: undefined, score: 2, children: 0
MNByChoice 6 points a month ago

Great send up of Swap!

Swap is great though. And to point out again that there are ratings on quality SSDs for the lifetime writes. Pull up the data sheet and look for "DWPD", which is "Disk Writes Per Day". Typical numbers for good swap drives are 1 and 3. If DWPD is not listed, then plan for frequent drive failures if using heavy, heavy swap (like for ZFS swap drives (Yes, these are different from a OS swap partition)).

Anyway, I just wanted to point out the DWPD statistic.

path: 0 25813412, hotness: undefined, score: 6, children: 0
rumschlumpel 5 points a month ago

Oh, you mean the hibernation space? ZZzzzzz...

path: 0 25811536, hotness: undefined, score: 5, children: 0
Adderbox76 5 points a month ago

You'll have to pry my swap partition out of my cold, dead hands.

path: 0 25825693, hotness: undefined, score: 5, children: 0
zerofk 4 points a month ago

Go the other way: create a RAM disk.

path: 0 25834639, hotness: undefined, score: 4, children: 0
ohshit604 4 points a month ago

Meanwhile here I am partitioning 20Gb of SWAP because I want 0 chance of an OOM moment.

path: 0 25811760, hotness: undefined, score: 4, children: 0
ArsonButCute 3 points a month ago

I often use FreeBSD on a system with 2 gigs of ram. I WISH swap was useful. OOM killer is so overzealous the thing just kills whatever before even touching swap.

path: 0 25816019, hotness: undefined, score: 3, children: 2
Trail 3 points a month ago

Maybe tweak the swappiness?

path: 0 25816019 25816790, hotness: undefined, score: 3, children: 1
ArsonButCute 1 point a month ago

As far as I can tell that's not possible on FreeBSD. The vm.swappiness parameter doesn't exist there.

path: 0 25816019 25816790 25821264, hotness: undefined, score: 1, children: 0
Mikina 2 points 25 days ago path: 0 25872267, hotness: undefined, score: 2, children: 0
GottaHaveFaith 1 point a month ago

I have a laptop with 16GB of ram and discovered that if I connect an external display the available ram goes down to 12... but I'd hate to pay 32 GB as if they were 256 GB, I've resigned to keeping 1 (one) instance of intellij opened at a time

path: 0 25817974, hotness: undefined, score: 1, children: 0
programmer_humor
programmer_humor

@programming.dev

login for more options
33571
2550
7101

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn't find it funny, you're banned. Ha-ha!... For real: do not use the community for "statements". There are other places for such content. Keep it chill and funny.

go to feed...