Posts: 162
drg
Joined: 22 Feb 2010
#61
The section that I used that made it work:
1. # load dependency modules
2. # kernels 3.4 onwards
3.
4. modprobe zram num_devices=$num_cpus
5.
6. if [ $? -gt 0 ]; then
7. # kernels 3.1 - 3.3
8. #modprobe zram zram_num_devices=$num_cpus
9. #else
10. echo -e"Your Kernel needs to be compiled with ZRAM support:" \

etc, etc.
Posts: 96
melodie
Joined: 15 Feb 2008
#62
drg wrote:EDIT point: the modified script I used was the one melodie pointed to yesterday, Aug10. Haven't read thru' his newest stuff yet. Just in case there is some difference.
Hi,

I pasted a diff file here, as said above :
In the diff there is"zram-a" which is the script provided by tradetaxfree,"zram-b" his script with modifications done by my two friends, (I pointed to their websites), and the whole thing is : it works !

The lines which were changed:

-# Required-Start:
+# Required-Start: $local_fs // needed in order to be started during boot - you can compare with other init scripts...

- memtotal=$(grep MemTotal /proc/meminfo | awk ' { print $2 } ')
+ memtotal=$(grep MemTotal /proc/meminfo | sed 's/[^0-9]\+//g') // there the friend thought /usr/bin/awk might not have been in the $PATH during the boot time

the rest of the changes is directly related to the first error messages echoed by the script. This part is the one which was changed first and allowed me to succeed starting it manually. The 2 above finished to fix it. Since then it has been loaded each time I have booted or rebooted that machine.
anticapitalista
Posts: 5,955
Site Admin
Joined: 11 Sep 2007
#63
I have been testing the modified zram script that melodie pointed to (zram-b) and it does seem to work
I'll test some more and then if all is still ok I'll upload the newer version via the antix-goodies-antix deb
(the new antix-goodies-antix deb will also make the youtube-viewer app work ootb without needing to set it up)
Posts: 347
Silent Observer
Joined: 08 Aug 2013
#64
I've read through this thread, but I'm not sure I've really understood how small a system's RAM or how slow the processor can be before zram is counterproductive -- I've got 288 MiB RAM in my Pentium II 300 laptop, and partitioned the hard disk with 1 GB swap; I rarely see any swap usage on conky, and then only a few megabytes, but I haven't gotten to the point of trying to get anything actually done on that machine, it's still mainly running streamtuner2 and xmms, playing internet radio or locally stored mp3 sound.

Is it likely to be worthwhile trying to set up zram on a machine with these specs?
Posts: 765
rust collector
Joined: 27 Dec 2011
#65
Someone else probably know more about this, but as long as you just use"a few" mb of swap, I would leave it alone.
At least until you try to do some real work.
Posts: 96
melodie
Joined: 15 Feb 2008
#66
Hi,

I have used it with 192 MB ram on a PII laptop. I had to setup the swappiness to avoid swapping which came fast, then it was alright. I had also setup libreoffice to be prelinked with prelink.

The %age RAM was setup to 25% of the available ram for the size of the block device, which is the value recommended by the dev of the compcache project (where zram comes from) for desktop computers.
Posts: 347
Silent Observer
Joined: 08 Aug 2013
#67
melodie wrote:Hi,

I have used it with 192 MB ram on a PII laptop. I had to setup the swappiness to avoid swapping which came fast, then it was alright. I had also setup libreoffice to be prelinked with prelink.

The %age RAM was setup to 25% of the available ram for the size of the block device, which is the value recommended by the dev of the compcache project (where zram comes from) for desktop computers.
Sigh.

Just when I start to think I'm understanding Linux, I get an answer that might as well be in Greek. __{{emoticon}}__

The only part of that that made any sense to me was setting up zram to use 25% of RAM, which given approximate 2:1 compression (average for random data, if they're using an algorithm as efficient as LZH), would eliminate swap usage (I plan on removing Libre Office from the laptop and using Abiword and Gnumeric for the limited productivity I'd want/need). I have no idea what prelinking libreoffice even means...

What I'm not sure about is whether the 300 MHz processor running compression will cost more performance than I save by not writing to the"redneck SSD" -- or whether the write cycle reduction will be enough to matter on the usable life of the Compact Flash I'm using for a hard disk.
Posts: 96
melodie
Joined: 15 Feb 2008
#68
Hi,

prelink is a program which allows prelinking the libs of a program to have them libs loaded at same time as the session, allowing the sayd program to be started faster when called.

I found how to set it up the most efficient way (the exemple given everywhere is very wrong, it suggests to prelink everything, and I have done tests, doing so does not help because the cache created is big and slows it all down).

Doing a prelink only on libreoffice helps starting it faster when it is launched from the menus.

ie:

Code: Select all

# prelink -vmR /usr/bin/libreoffice
Then you need to configure the cron prelink : remove the X bit, or it will probably prelink everything automatically at the next cycle. :[

and see the configuration fileā€¦ (the one under /etc fortunately has lots of comments to explain more or less clearly what the options do).

the swappiness, well you can read here for instance, about it:

========= SCRAPER REMOVED AN EMBEDDED LINK HERE ===========
url was:"https://wiki.archlinux.org/index.php/Swap#Swappiness"
linktext was:"https://wiki.archlinux.org/index.php/Swap#Swappiness"
====================================

(I plan on removing Libre Office from the laptop and using Abiword and Gnumeric for the limited productivity I'd want/need)
You could also choose to install just libreoffice writer and calc. You might want to compare both solutions and check which one brings in most depends as a total size. It might not make such a difference.

PS: of course prelink needs to be installed:"sudo apt-get install prelink".
Posts: 347
Silent Observer
Joined: 08 Aug 2013
#69
Ah, given the little swap hit I ever get on that machine is happening before RAM gets very close to 100% usage, I might be able to just tweak down the swappiness and get it to run all in RAM -- and avoid the compression overhead.

What I've read is that removing bits of LibreOffice doesn't help much for space or RAM usage, because the libre-office-core module is the biggest single part and it loads when any of the apps are in use -- IOW, even if I only have LibreOffice Write, I'll have to have libre-office-core to use it, and that is the big consumer of storage space and RAM in that suite. Abiword and gnumeric don't have big cores and can read/write formats that LibreOffice can import on my desktop systems.

I'll do some testing with Abiword and gnumeric, but I suspect I'll be able to avoid zram just by using those lighter applications and tweaking swappiness. Thanks for mentioning that -- that's going to be useful for me.
Posts: 96
melodie
Joined: 15 Feb 2008
#70
Hi,

In my opinion Abiword and Gnumerci are not light on resources. Yes the cpu of your machine does not provide enough. What could be used, would be online spreadsheet and text processor, with, perhaps, Midori? (Just an idea : and to be tested)

You won't stop the swappiness completely, it seems a little is needed sometimes even if all the ram is not used. But if you set it up to 0 it will use the minimum required and not more.
Posts: 765
rust collector
Joined: 27 Dec 2011
#71
In the case of my eeepc, which is very swap happy, I have to set swappiness to 4.
Any more, and it act the same as the default, and any less, and it some times gets confused, and locks up.
I would experiment with that a little.