XenialDog 64bit (Ubuntu 'Xenial Xerus' LTS, 64-bit)
Hi you guys !
I am talking about Xenial Dog (32 bit )
After a lot of doubts I came to this conclusion :
So i did finally completely remove zram-config (formerly installed ) and its remnants :
It means :
removed :zram.config from /etc/inid
removed :zram from /etc/inid.d
removed :init-zram-swapping from /usr/bin
removed :end-zram-swapping from /usr/bin
Now was able to use your Dancytrons script without any conflicting/interfering Effects that came with zram-config formerly installed .
Doing zramctl in Terminal showed clearly lz4 is enabled when doing "zram.sh start" in Terminal .
root@xenial:~# zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4 743.8M 4K 64B 4K 1 [SWAP]
root@xenial:~#
Not quite sure if installing lz4-tool was necessary, which i did before .
For Debian i can not proof if lz4 is activated because command "zramctl" does not work in Debian ........maybe someone knows how to accomplish this in Debian Dog .
I am talking about Xenial Dog (32 bit )
After a lot of doubts I came to this conclusion :
So i did finally completely remove zram-config (formerly installed ) and its remnants :
It means :
removed :zram.config from /etc/inid
removed :zram from /etc/inid.d
removed :init-zram-swapping from /usr/bin
removed :end-zram-swapping from /usr/bin
Now was able to use your Dancytrons script without any conflicting/interfering Effects that came with zram-config formerly installed .
Doing zramctl in Terminal showed clearly lz4 is enabled when doing "zram.sh start" in Terminal .
root@xenial:~# zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4 743.8M 4K 64B 4K 1 [SWAP]
root@xenial:~#
Not quite sure if installing lz4-tool was necessary, which i did before .
For Debian i can not proof if lz4 is activated because command "zramctl" does not work in Debian ........maybe someone knows how to accomplish this in Debian Dog .
Hi backi,backi wrote:
Some Thoughts on Zram and lz4 on the MX-Linux Forum :
https://mxlinux.org/forum/viewtopic.php?f=108&t=42935
Regards !
Coincidentally, and independently, I also came across a quick post on the mxlinux forum that suggested liblz4-tools was required so I had also yesterday installed that on my xenialdog64 system with zramconfig and rebooted. zramctl still however suggested lzo was being used rather than lz4 (the script dancytron found/provided did indeed however make zramctl indicate lz4 was being used - there is a line early on in that script which calculates the size of zram it provides). I would still like to find out how to achieve the same using zramconfig only - I read somewhere, I can't alas remember where, that it might be something to do with some other crypt software default - my quick check on that has revealed nothing so far. Also thought might be a zram config file for systemd that allows manual change from lzo to lz4 but haven't found that yet either. I'll unpack zramconfig deb package and see if I can find any clue in there if no one has 'the answer' or in the end, if can't otherwise find a zramconfig solution, also just use the zram.sh script. I'll report back of course if I find anything, which may take a while cos it is raining and my roof has been leaking so may have to work on things like that for a bit...
I also btw came across zswap alternative, but haven't looked into that yet (I think what I read said something had to be in the kernel for zswap to be used - maybe it already is - let us know if you try zswap and if it appears better in any way).
Though I'm mainly using a core II duo with 2 GB RAM, I'm also working on bringing my old Pentium M 1 GB RAM machine back to life (a Fujitsu Siemens Amilo M1424 - used to be 512MB but I upgraded it to 1GB) so will be using zram or similar with that. I also use xenialdog32 with that one (using forcepae kernel option).
cheers, wiak
Hi backi, dancytron,
Well I have now worked out one way how to get lz4 with zram-config. I extracted the deb and discovered:
/lib/systemd/system/zram-config.service
which contains:
I thus modified the /usr/bin/init-zram-swapping bash script to contain the indicated extra line (this is all that needs done to get zram lz4):
I thought all would be fine after that so, restarted that systemd service with:
EDIT: Fixed (I had put $i instead of ${DEVNUMBER} in first attemp...
zramctl now successfully gives:
wiak
Well I have now worked out one way how to get lz4 with zram-config. I extracted the deb and discovered:
/lib/systemd/system/zram-config.service
which contains:
Code: Select all
[Service]
ExecStart=/usr/bin/init-zram-swapping
ExecStop=/usr/bin/end-zram-swapping
...
Code: Select all
# initialize the devices
for i in $(seq ${NRDEVICES}); do
DEVNUMBER=$((i - 1))
echo lz4 > /sys/block/zram${DEVNUMBER}/comp_algorithm #wiak added
echo $mem > /sys/block/zram${DEVNUMBER}/disksize
mkswap /dev/zram${DEVNUMBER}
swapon -p 5 /dev/zram${DEVNUMBER}
done
Code: Select all
systemctl restart zram-config.service
zramctl now successfully gives:
Code: Select all
root@xenial64:~# zramctl
NAME ALGORITHM DISKSIZE DATA COMPR TOTAL STREAMS MOUNTPOINT
/dev/zram0 lz4 466.7M 4K 65B 4K 1 [SWAP]
/dev/zram1 lz4 466.7M 4K 65B 4K 1 [SWAP]
Last edited by wiak on Mon 22 Jan 2018, 00:34, edited 1 time in total.
By the way, if you want to increase the percentage of RAM used for zram swap to the same as the lz4-modded debian script dancytron provided, inside bash shell script /usr/bin/init-zram-swapping you can change the line:
to:
or make similar calculation mods for smaller or larger zram swap sizes.
Of course there is a limit as to how much actual RAM it is good to allocate to zram (since your system will run out of physical RAM and start using zram when it otherwise wouldn't and so on...). I'd stick with the lower zram amount you find you actually need to help avoid as much swapping as possible anyway.
wiak
Code: Select all
mem=$(((totalmem / 2 / ${NRDEVICES}) * 1024))
Code: Select all
mem=$(((totalmem * 75 / 100 / ${NRDEVICES}) * 1024))
Of course there is a limit as to how much actual RAM it is good to allocate to zram (since your system will run out of physical RAM and start using zram when it otherwise wouldn't and so on...). I'd stick with the lower zram amount you find you actually need to help avoid as much swapping as possible anyway.
wiak
Last edited by wiak on Mon 22 Jan 2018, 01:14, edited 1 time in total.
1.8 Gig Intell Dual Core, 3 Gig of Ram.
Seems to work.
Before, if I hit a bad webpage that leaked ram (or just had a ridiculous amount of stuff running)and it started to swap, that was it. I wrote a little "kill chrome and firefox" script, and if I could run it before it froze completely, then in about 5 minutes I could have my computer back, otherwise it was a hard shutdown.
To test, I opened Firefox 57 and opened about 20 tabs with lots of video and other crap and got it to start swapping. Then I opened up another Firefox, opened up about 8 more tabs, including CBSN live news. Conky shows mem at 88% 2.6 GiB and swap at 35% 810 MB. CBSN is playing fine. I am posting from it now. It has hiccuped a few times and is slower than normal, but it seems stable.
A big improvement. Now swapping 51%.
p.s. Just to be clear, I am running DD 64 Stretch, not Xenial Dog, but it seems more or less the same.
Seems to work.
Before, if I hit a bad webpage that leaked ram (or just had a ridiculous amount of stuff running)and it started to swap, that was it. I wrote a little "kill chrome and firefox" script, and if I could run it before it froze completely, then in about 5 minutes I could have my computer back, otherwise it was a hard shutdown.
To test, I opened Firefox 57 and opened about 20 tabs with lots of video and other crap and got it to start swapping. Then I opened up another Firefox, opened up about 8 more tabs, including CBSN live news. Conky shows mem at 88% 2.6 GiB and swap at 35% 810 MB. CBSN is playing fine. I am posting from it now. It has hiccuped a few times and is slower than normal, but it seems stable.
A big improvement. Now swapping 51%.
p.s. Just to be clear, I am running DD 64 Stretch, not Xenial Dog, but it seems more or less the same.
Yes, major headache - I do similar. XenialDog32 (but not xenialdog64) actually comes by default allowing ctrl-alt-backspace to drop down to commandline if done quickly enough on browser freeze - then startx to get desktop back. But kill script better option for such occurrence probably.dancytron wrote:I wrote a little "kill chrome and firefox" script, and if I could run it before it froze completely, then in about 5 minutes I could have my computer back, otherwise it was a hard shutdown.
wiak
If this zram thing works as well as it seems to, then I think those days are past.wiak wrote:Yes, major headache - I do similar. XenialDog32 (but not xenialdog64) actually comes by default allowing ctrl-alt-backspace to drop down to commandline if done quickly enough on browser freeze - then startx to get desktop back. But kill script better option for such occurrence probably.dancytron wrote:I wrote a little "kill chrome and firefox" script, and if I could run it before it froze completely, then in about 5 minutes I could have my computer back, otherwise it was a hard shutdown.
wiak
No, I've been using zram for a while but still occasional browser freezes (chrome sometimes for me) despite not many tabs open! I test zram browser use via opening multiple gmail tabs (since each such tab seems to use a consistent RAM amount and quite a lot of it) and monitor free and available RAM via top running in an always on top window. But yes, browser freeze is certainly very rare now with zram running on my system.
wiak
wiak
I still haven't tried zswap on my xenialdog, but though it has disadvantage that it also needs actual swap space allocated it has advantage that the first pages paged out of swap will be the Least Recently Used, whereas most recently used would be better (in my understanding at least). Nice post about zswap performance (much of which might apply to zram) here:
https://www.ibm.com/developerworks/comm ... y7?lang=en
But also from that post the comments section is very interesting.
I guess we just have to suck them and see (i.e. try them both out).
Note that you can also use a zram like any other block device. For example you don't need to use it for swap - you can make a filesystem (mkfs) on it and use as a temporary disc in ram.
wiak
https://www.ibm.com/developerworks/comm ... y7?lang=en
But also from that post the comments section is very interesting.
I guess we just have to suck them and see (i.e. try them both out).
Note that you can also use a zram like any other block device. For example you don't need to use it for swap - you can make a filesystem (mkfs) on it and use as a temporary disc in ram.
wiak
Doing some experiments...
Note how to enable zswap on kernel line of grub4dos menu.lst from above dmesg output. I don't have any other 'actual' swap except zram. I'm wondering how this goes - I'm presuming zram won't be used till zswap compressed cache area filled and maybe Most Recent In First Out will work in stead of zram Last In First Out.
EDIT: Of course, for more conventional zswap use (or combined for experiments with zram) I could create and activate a swap file like the following (also could effectively create it in RAM on Porteus changes folder boot machine by creating it in /root or similar...):
EDIT: Short answer is that mixing zram with zswap doesn't work so well cos both are taking RAM space (once swapping occurs) but zswap itself isn't actually contributing any additional swap space (unless a swap file or partition is also being used out of RAM, whereupon it might work well, assuming I reduce zram amount proportionally - to be tested...)
Anyway, sorry Fred, this stuff definitely needs thread of its own now...
wiak
Code: Select all
root@xenial64:~# dmesg | grep zswap
[ 0.000000] Command line: noauto from=/xenial64/ changes=EXIT:/xenial64/casper/ zswap.enabled=1 zswap.compressor=lz4
[ 0.000000] Kernel command line: noauto from=/xenial64/ changes=EXIT:/xenial64/casper/ zswap.enabled=1 zswap.compressor=lz4
[ 3.759855] zswap: compressor lz4 not available, using default lzo
[ 3.759911] zswap: loaded using pool lzo/zbud
root@xenial64:~# free
total used free shared buff/cache available
Mem: 1911492 95460 1400088 38080 415944 1608912
Swap: 955744 0 955744
EDIT: Of course, for more conventional zswap use (or combined for experiments with zram) I could create and activate a swap file like the following (also could effectively create it in RAM on Porteus changes folder boot machine by creating it in /root or similar...):
Code: Select all
dd if=/dev/zero of=/mnt/home/swapfile0 bs=1024 count=256k
# could also use 'fallocate -l 256M /mnt/home/swapfile0' command but only works on some filesystem types
chmod 600 /mnt/home/swapfile0
ls -lh /mnt/home/swapfile0 # to check creation size
mkswap /mnt/home/swapfile0
swapon /mnt/home/swapfile0
Anyway, sorry Fred, this stuff definitely needs thread of its own now...
wiak
Hi all,
Question: do either zram and/or zswap apply to people who are running more than, say, 1GB of RAM?
Reason I ask, is that I have both desktop machines and laptops I use, and when I go through & do everything to have either zram and/or zswap, I cannot tell one bit of "performance"or "speed" or "efficiency" differences (doing heavy loaded browser tests---multiple tabs and even multiple browsers open) on any of my machines. Even my Atom Intel netbook, with 2GB of RAM and that punk little atom processor, shows very little performance increase (less than 2-3%). And on my 8GB & 16GB RAM machines with old Athlon X2 processors & 7-10 yr old motherboards, there is "zero" performance and "speed" increase.
I've come to the conclusion this zram/zswap benefit is all in our heads, and both zram/zswap are not worth anything. What makes me even more suspicious is the talk on the zram/zswap wiki pages of..well, you know people, listen to us, our zram/zswap will "at least" give longer life (in terms of writes) to your USB and/or SSD drives. That stuff is marketing 101 bullsh!t, every one in the Linuzx industry has known that for years.
Please, I know this is contrary to what some of you say you are seeing with zram/zswap enabled, but I honestly just don't get it. How do you know for sure, other than non-technical "observation" tests now being performed, that zram/zswap is effective. Answer? You don't know for sure, unless you can dis-assemble a kernel (along with the hardware) and test each component individually with zram/zswap enabled vs dis-abled. Linux Torvalds & others debunked this a few years ago concerning zram/zswap.
Another additional observation: if zram and zswap were so effective, why is "neither of them" included in any other linux distro that I know of except for Lubuntu? And even Lubuntu's developers (of which I follow) are talking about abandoning it because it is a "solution" looking for problems that don't exist.
It is my belief to much time is wasted on stuff like this, but hey, what do I know, I am just a lowly user with absolute zero skills, lol.
Question: do either zram and/or zswap apply to people who are running more than, say, 1GB of RAM?
Reason I ask, is that I have both desktop machines and laptops I use, and when I go through & do everything to have either zram and/or zswap, I cannot tell one bit of "performance"or "speed" or "efficiency" differences (doing heavy loaded browser tests---multiple tabs and even multiple browsers open) on any of my machines. Even my Atom Intel netbook, with 2GB of RAM and that punk little atom processor, shows very little performance increase (less than 2-3%). And on my 8GB & 16GB RAM machines with old Athlon X2 processors & 7-10 yr old motherboards, there is "zero" performance and "speed" increase.
I've come to the conclusion this zram/zswap benefit is all in our heads, and both zram/zswap are not worth anything. What makes me even more suspicious is the talk on the zram/zswap wiki pages of..well, you know people, listen to us, our zram/zswap will "at least" give longer life (in terms of writes) to your USB and/or SSD drives. That stuff is marketing 101 bullsh!t, every one in the Linuzx industry has known that for years.
Please, I know this is contrary to what some of you say you are seeing with zram/zswap enabled, but I honestly just don't get it. How do you know for sure, other than non-technical "observation" tests now being performed, that zram/zswap is effective. Answer? You don't know for sure, unless you can dis-assemble a kernel (along with the hardware) and test each component individually with zram/zswap enabled vs dis-abled. Linux Torvalds & others debunked this a few years ago concerning zram/zswap.
Another additional observation: if zram and zswap were so effective, why is "neither of them" included in any other linux distro that I know of except for Lubuntu? And even Lubuntu's developers (of which I follow) are talking about abandoning it because it is a "solution" looking for problems that don't exist.
It is my belief to much time is wasted on stuff like this, but hey, what do I know, I am just a lowly user with absolute zero skills, lol.
belham,
You obviously haven't tried browser load tests (e.g. load multiple tabs with heavy use webpages such as gmail). Browsers such as Chrome or Firefox will crash on 2GB RAM machine with as little as 8 such tabs open. They manage around 12 such tabs open on my machine with zram-config installed. These are not just 'observations' - the memory versus swap-consumed are measurable via top command amongst others. Such work is my profession. It is not about performance increase - it is about more virtual RAM without so much loss of performance conventional swap file or partition would result in.
EDIT: By the way, since zram provides a block device you could also configure it to provide compressed /tmp filesystem, which could also be handy since gives a larger /tmp in RAM filesystem. Maybe even a compressed /mnt/live/memory/changes filesystem... could be very handy for certain types of development work.
wiak
You obviously haven't tried browser load tests (e.g. load multiple tabs with heavy use webpages such as gmail). Browsers such as Chrome or Firefox will crash on 2GB RAM machine with as little as 8 such tabs open. They manage around 12 such tabs open on my machine with zram-config installed. These are not just 'observations' - the memory versus swap-consumed are measurable via top command amongst others. Such work is my profession. It is not about performance increase - it is about more virtual RAM without so much loss of performance conventional swap file or partition would result in.
EDIT: By the way, since zram provides a block device you could also configure it to provide compressed /tmp filesystem, which could also be handy since gives a larger /tmp in RAM filesystem. Maybe even a compressed /mnt/live/memory/changes filesystem... could be very handy for certain types of development work.
wiak
Last edited by wiak on Mon 22 Jan 2018, 08:54, edited 1 time in total.
Hi Belham !
I just relate to Zram .
There are discussions/rumors about , if zram is use-full/less with more than 2 Gigs Ram .Some say using Zram with more than >2Gigs Ram could be counter productive .
It seems a lot of people "believe" to experience some Performance Boost when having little Ram .
Just a Placebo-Effect ?
Nevertheless ..... it seems there is no Disadvantage/Danger when using it on Low-Ram Machines .That`s for sure .
I am using it with additional Swap-Partion .(Seems Zram is used prior to Swap-Partition ) . Zram and Swap-Partiton both can both manually disabled/enabled seperately on Demand during Session.
Sometimes i flush Zram and/or Swap-partition by disabling and re-enabling during Session .Seems to make system work more fluent .
But maybe just my Imagination .
Nevertheless.....does not cost anything ....and seems no Risk in it .
B.T.W.------Feeling a bit uncomfortable highjacking Fred`s Thread with Zram Topic .
Regards !
Mostly recommended only for Machines with little Ram .Question: do either zram and/or zswap apply to people who are running more than, say, 1GB of RAM?
I just relate to Zram .
There are discussions/rumors about , if zram is use-full/less with more than 2 Gigs Ram .Some say using Zram with more than >2Gigs Ram could be counter productive .
It seems a lot of people "believe" to experience some Performance Boost when having little Ram .
Just a Placebo-Effect ?
Nevertheless ..... it seems there is no Disadvantage/Danger when using it on Low-Ram Machines .That`s for sure .
I am using it with additional Swap-Partion .(Seems Zram is used prior to Swap-Partition ) . Zram and Swap-Partiton both can both manually disabled/enabled seperately on Demand during Session.
Sometimes i flush Zram and/or Swap-partition by disabling and re-enabling during Session .Seems to make system work more fluent .
But maybe just my Imagination .
Nevertheless.....does not cost anything ....and seems no Risk in it .
B.T.W.------Feeling a bit uncomfortable highjacking Fred`s Thread with Zram Topic .
Regards !
Last edited by backi on Mon 22 Jan 2018, 09:07, edited 3 times in total.
Wiak,wiak wrote:belham,
You obviously haven't tried browser load tests (e.g. load multiple tabs with heavy use webpages such as gmail). Browsers such as Chrome or Firefox will crash on 2GB RAM machine with as little as 8 such tabs open. They manage around 12 such tabs open on my machine with zram-config installed. These are not just 'observations' - the memory versus swap-consumed are measurable via top command amongst others. Such work is my profession. It is not about performance increase - it is about more virtual RAM without so much loss of performance conventional swap file or partition would result in.
EDIT: By the way, since zram provides a block device you could also configure it to provide compressed /tmp filesystem, which could also be handy since gives a larger /tmp in RAM filesystem. Maybe even a compressed /mnt/live filesystem... could be very handy for certain types of development work.
wiak
Do you read "English"?
Read my post again. I've run heavy loaded, multiple browser tests. '
Pay attention, please.
And go read and look at what the major developers of Linux kernels say about zram/zswap.
You're arguing pixie dust fantasies here.
If someone wants to put a bandaid (zram/zswap) on a cut or bruise that doesn't exist, and make themselves "feel" better, that is their perogative.
But don't pretend otherwise.
True, but not really, since such discussion could end up providing DebianDog extra functionality/option especially configured. But, yes, needs own thread since much testing/configuration discussion needed if using outside the simple scenario. No harm of large GB machines either since zram (like standard swap) not normally used at all until swapping begins (at which time it is more performance efficient than slow hard drives or maybe even SSDs, since in RAM - only performance slow down is more CPU cycles for the lzo or lz4 compression/decompression but these are not so slow in practice I feel).backi wrote: B.T.W.------Feeling a bit uncomfortable highjacking Fred`s Thread with Zram Topic .
Regards !
Anyway, main thing is we got zram-config lz4-use systemd configuration sorted out above now.
By the way, since Android 4.4:
Clearly zram is useless belham...OEMs building the next generation of Android devices can take advantage of targeted recommendations and options to run Android 4.4 efficiently, even on low-memory devices. Dalvik JIT code cache tuning, kernel samepage merging (KSM), swap to zRAM, and other optimizations help manage memory
wiak
Hi wiak !
That`s the Way of the Pioneer (Avantegarde).....and that`s the Way it should be .
So....what about opening a separate Thread for Zram Topics.......who makes the first Step ? I am a bit too retentive/conservative .My english is a bit clumpsy .
You give me some Confidence .True, but not really, since such discussion could end up providing DebianDog extra functionality/option especially configured.
That`s the Way of the Pioneer (Avantegarde).....and that`s the Way it should be .
So....what about opening a separate Thread for Zram Topics.......who makes the first Step ? I am a bit too retentive/conservative .My english is a bit clumpsy .
Last edited by backi on Mon 22 Jan 2018, 09:32, edited 1 time in total.