Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
zswap - is it always worth it?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ATpwwu
n00b
n00b


Joined: 17 Dec 2015
Posts: 5

PostPosted: Thu Dec 17, 2015 12:47 am    Post subject: zswap - is it always worth it? Reply with quote

Because it's so simple to turn off and on I decided to try it, While copying files from one hard drive (ntfs) to another (btrfs, lzo compression) and defraging compressing a third (also btrfs and lzo) and surfing the web.

Without zswap cpu usage was around 50% and kde ran smoothyl

Witzh zswap cpu usage was 80% and everything was stuttering.


Specs i5 4460, 16gb ram, main drive (wasn't really in use) samsung evo 840 500gb with 16 gb swap (I call bullshit on the whole swap on ssd issue), ntfs drive WDC WD7500BPVX-00JC3T0 (some sort of 2.5 inch laptop drive), other two WDC WD30EFRX-68EUZN0 (wd 3tb red model)
Back to top
View user's profile Send private message
Keruskerfuerst
Advocate
Advocate


Joined: 01 Feb 2006
Posts: 2288
Location: near Augsburg, Germany

PostPosted: Thu Dec 17, 2015 7:55 am    Post subject: Reply with quote

Zswap compresses the data written to swap with lzo.

I would not use it.
Back to top
View user's profile Send private message
ATpwwu
n00b
n00b


Joined: 17 Dec 2015
Posts: 5

PostPosted: Thu Dec 17, 2015 11:05 pm    Post subject: Reply with quote

It's just one echo to enable and I was bored and wanted to see what would happen :)

But there's something more going on here, if I'm copying a file why should't even work way. it shouold not even touc any cache, just be streamed from one device do the other with dedicated he oh board do t it go o ram o ram. Tue CPU should just teoo dev9ce 1 c90s ahd cijoress cecrors,ssed and writen? s
Back to top
View user's profile Send private message
davidm
Guru
Guru


Joined: 26 Apr 2009
Posts: 557
Location: US

PostPosted: Thu Dec 17, 2015 11:15 pm    Post subject: Reply with quote

ATpwwu wrote:
dedicated he oh board do t it go o ram o ram. Tue CPU should just teoo dev9ce 1 c90s ahd cijoress cecrors,ssed and writen? s


???
Back to top
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Fri Dec 18, 2015 6:59 am    Post subject: Re: zswap - is it always worth it? Reply with quote

Summary.

check with top / htop how much ram you really need. =>>> get rid of 16gb swap partition, it is not needed at all

stick to proven file systems like ext4 => do not use btrfs, when you are an "inexpierenced user" => some call them "noobs"

Very bad: swap partition on SSD will make your Drive fail much faster, and you will loose warranty because of the write cycles. And I assume your data is also on that ssd, you will expierence full data loss.

Hint => backups are your friend.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6014

PostPosted: Fri Dec 18, 2015 6:31 pm    Post subject: Reply with quote

zswap is single-threaded by default; you need to pass $(nproc) to your zramctl command for decent performance.
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6296

PostPosted: Sat Dec 19, 2015 9:31 am    Post subject: Reply with quote

Ant P. wrote:
zramctl command

zram != zswap
Back to top
View user's profile Send private message
user
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2004
Posts: 145

PostPosted: Sat Dec 19, 2015 10:47 am    Post subject: Reply with quote

I don't use zswap, I use zram for compressed swapped pages in memory still.
I have sufficient ECC memory to _not_ write (compressed) swapped pages to physical disc.

Code:
# cat /etc/udev/rules.d/10-zram.rules
KERNEL=="zram0", SUBSYSTEM=="block", DRIVER=="", ACTION=="add", ATTR{initstate}=="0", ATTR{comp_algorithm}="lz4", ATTR{disksize}="512M", RUN+="/sbin/mkswap $env{DEVNAME}"
KERNEL=="zram1", SUBSYSTEM=="block", DRIVER=="", ACTION=="add", ATTR{initstate}=="0", ATTR{comp_algorithm}="lz4", ATTR{disksize}="512M", RUN+="/sbin/mkswap $env{DEVNAME}"
KERNEL=="zram2", SUBSYSTEM=="block", DRIVER=="", ACTION=="add", ATTR{initstate}=="0", ATTR{comp_algorithm}="lz4", ATTR{disksize}="512M", RUN+="/sbin/mkswap $env{DEVNAME}"
KERNEL=="zram3", SUBSYSTEM=="block", DRIVER=="", ACTION=="add", ATTR{initstate}=="0", ATTR{comp_algorithm}="lz4", ATTR{disksize}="512M", RUN+="/sbin/mkswap $env{DEVNAME}"
# swapon -s
Filename                                Type            Size    Used    Priority
/dev/zram0                              partition       524284  188136  16383
/dev/zram1                              partition       524284  187732  16383
/dev/zram2                              partition       524284  187968  16383
/dev/zram3                              partition       524284  187852  16383
# zramctl
NAME       ALGORITHM DISKSIZE   DATA  COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4           512M 159.5M  85.9M   92M       1 [SWAP]
/dev/zram1 lz4           512M   159M  85.4M 91.2M       1 [SWAP]
/dev/zram2 lz4           512M 159.3M  85.6M 91.5M       1 [SWAP]
/dev/zram3 lz4           512M 159.2M  85.4M   91M       1 [SWAP]
Back to top
View user's profile Send private message
ATpwwu
n00b
n00b


Joined: 17 Dec 2015
Posts: 5

PostPosted: Sun Jan 03, 2016 4:14 pm    Post subject: Re: zswap - is it always worth it? Reply with quote

tw04l124 wrote:
Summary.

check with top / htop how much ram you really need. =>>> get rid of 16gb swap partition, it is not needed at all

stick to proven file systems like ext4 => do not use btrfs, when you are an "inexpierenced user" => some call them "noobs"

Very bad: swap partition on SSD will make your Drive fail much faster, and you will loose warranty because of the write cycles. And I assume your data is also on that ssd, you will expierence full data loss.

Hint => backups are your friend.

I have more backups than brains (srs, anything important is on at least 4+ devices in separate locations, anything not important is probably still backuped once. Learned that lesson a long time ago.

Uh, I've used gentoo on multiple pcs between 2005, to 2012-3 when a series of hw failures made me switch to windows because.... idk just because.. wanted to see how the other side was. Then I had a really nice laptop die about 1 year ago and was forced to use win 8.1 (and later win 10) a tablet with 2GB ram and some shitty emmc (really, why do they cripple these things with so little ram and bad io.... if the thing had 4-8gb and a real ssd (nothing big, 250gb would have been plenty the z3775 cpu couldn't look half as bad.. in cpu limited situations it was about as fast as an ivy bridge i3 running at the same frequency). Not to mention the dozens of vpses I ran. I may be a lot of things (alcoholic maybe sine one of the hw faliures was caused by me spilling a bottle of rum on a laptop), but I'm not a noob.

Quote:
dedicated he oh board do t it go o ram o ram. Tue CPU should just teoo dev9ce 1 c90s ahd cijoress cecrors,ssed and writen? s
eat a bunch of xanax (well actually it was desmethylflunitrazepam but nobody would kwnow what that it..... i think it was about the equivalent of 20mg xanax) and write a coherent post :)
Back to top
View user's profile Send private message
kernelOfTruth
Watchman
Watchman


Joined: 20 Dec 2005
Posts: 6111
Location: Vienna, Austria; Germany; hello world :)

PostPosted: Mon Jan 04, 2016 5:29 pm    Post subject: Re: zswap - is it always worth it? Reply with quote

Naturally zswap should only affect anything if you're using swap (zswap) - otherwise you

could go with a few gigs of zram,

zswap also supports lz4 compression with should be more efficient.


Not sure about your usage pattern but usually I don't need swap at all or only a few MiB are taken so the effect on system responsiveness here is very very low,

with the previous system and 8 GiB swap was used more often but the effect also wasn't that bad with zswap


I guess it depends how up-to-date your kernel and system (software side) are and what else works in the background during this stress test


ATpwwu wrote:

Quote:
dedicated he oh board do t it go o ram o ram. Tue CPU should just teoo dev9ce 1 c90s ahd cijoress cecrors,ssed and writen? s
eat a bunch of xanax (well actually it was desmethylflunitrazepam but nobody would kwnow what that it..... i think it was about the equivalent of 20mg xanax) and write a coherent post :)


Wow - that bad ? 8O

Was once in a situation I wanted to go that route but got disadvised (one among them a pharmacologist who also had taken it and said that it had quite an effect on thinking-ability) from several people to avoid doing so :o
_________________
https://github.com/kernelOfTruth/ZFS-for-SystemRescueCD/tree/ZFS-for-SysRescCD-4.9.0
https://github.com/kernelOfTruth/pulseaudio-equalizer-ladspa

Hardcore Gentoo Linux user since 2004 :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum