Ok so i am running Cyan's 3.6.8.1 currently. I was running the newest 7 up untill this morning. And i woke up and booted my phone and had extreme lag. Restarted, had some bad lag still. I checked my swap and it said 0 across the board. I cant remember checking it with a fresh install. So my question is:
Does swap partition work with the most recent cyanogens? Also i keep seeing stuff pop up about compcache, ive read the tutorial but it looks like there isnt a recent userinit.sh for the newest cyan rom. How much faster is compcache if any over the swap partition?
I may be wrong but ithink the difference is one is dumped on sdcard (swap) and the other internally (compcache). Thaty means a slower sd card would result in slower read/write times. Also giving more wear on the sd. The userinit posted should be fine with cyanogens newest, however swappiness seems to be set a little high (60) that is a endless debate for the perfect setting. Mine is set to 10 though.
I have been reading some conflicting posts over which is better (linux swap vs compcache). Having used compcache for a week now, I am not happy with it--my swappiness was originally set at 60 and is now at 20. Some are saying that the linux swap allows their phones to operate very quickly and smoothly, which is unfortunately not the case with my phone. Add the confusion that there is a solution involving compcache with a backing swap file, and things look really complicated.
Also, I actually saw a poster claiming that NO SWAP worked better than having a swap at all. If anyone has some real data, please tell us: 1) whether swap increases phone performance (and how), and 2) which swap (linux, compcache, or compcache with backing swap) is better.
Thanks!
derfolo said:
I have been reading some conflicting posts over which is better (linux swap vs compcache). Having used compcache for a week now, I am not happy with it--my swappiness was originally set at 60 and is now at 20. Some are saying that the linux swap allows their phones to operate very quickly and smoothly, which is unfortunately not the case with my phone. Add the confusion that there is a solution involving compcache with a backing swap file, and things look really complicated.
Also, I actually saw a poster claiming that NO SWAP worked better than having a swap at all. If anyone has some real data, please tell us: 1) whether swap increases phone performance (and how), and 2) which swap (linux, compcache, or compcache with backing swap) is better.
Thanks!
Click to expand...
Click to collapse
Compcache with backing swap uses both compcache and the linux swap partition (or a regular swap file). Because this uses both methods, this would be fastest. Its actually made the JACHero ROMs ridiculously usable (compared to before anyways...). The swappiness doesn't matter, it just determines how often android will use compcache or linux-swap. It differs from build to build, each build will have an optimal setting.
Linux-swap is faster than regular swap file.
I don't have any data, but testimonial(ly?) when I use JACHero with vs without compcache and linux-swap is like night and day. Without it, the phone is unusable, with it, the phone is very much improved.
Kind of off topic, but how do i change the size of the compcache file?
cronin4392 said:
Kind of off topic, but how do i change the size of the compcache file?
Click to expand...
Click to collapse
Edit the userinit.sh file you're using. Check the proper threads for compcache in development forums.
As far as Compcache vs swap, I've gone back to no swaps, it seems snappier by itself without these methods. It could be a personal preference though depending on what apps/services you use the most.
Related
Hey everyone,
Just interested to see what everyone is using for their swap settings.
Compcache, Compcache w/ backing, or linux swap?
Swappiness?
Thanks!
It depends for me. I don't use the regular scripts people use, instead, I load it all from a file at boot. I pretty much use slightly-modified solid stock builds with a few unnecessary things removed (updater apps or htc log apps for example) and a few performance options tossed in (kernel changed, cpu pegged at 528 mHz, and compcache).
If I'm running a rom made for the Dream, for example, an AOSP rom, or an ADP or T-Mobile G1 rom, I use 24 MB compcache with 60 swappiness.
If I'm running a Hero rom or any other demanding port that was not made for the Dream, I usually make up for the lack of memory by compressing it all, so I use 96+ MB compcache, and I have it swap pages like crazy to keep compache from storing stale pages, so I set swappiness to 100. It has a slight hit in performance, but it's very, very reliable and, for example on Hero ports, I get no loading screens even with all 7 screens full of widgets and shortcuts coming back from Browser on pages with flash while listening to music.
I don't use linux-swap at all. I like being able to remove my sdcard and using it as it was intended, I don't use a2sd for the same reason.
Thanks for the response. I am using several differnt build, all AOSP thoigh. Ive been experimenting for a while now, Ill give the 24mb compcache 60 swappiness a shot
Could someone please inform me on what's the significance of having a linux swap partition on your SD? What is it and how do i do it?
and does compcache really help speed up the phone? i've heard that it actually makes it slower.
a response would be appreciated, thanks!
phillyboi47 said:
Could someone please inform me on what's the significance of having a linux swap partition on your SD? What is it and how do i do it?
and does compcache really help speed up the phone? i've heard that it actually makes it slower.
a response would be appreciated, thanks!
Click to expand...
Click to collapse
A linux-swap partition acts the same as a file swap would, becoming a place for the system to place cache for your apps. It helps speeds up app loading times by keeping them (and their components) in cache, even when not in use. Basically it expands the phones hardware RAM.
Compcache essentially expands your onboard RAM. The only tradeoff is that the extra space must be dynamically compressed/decompressed, which is considerably more taxing for the CPU.
I can't say out of experience that compcache actually slow down the phone substantially.
compcache w/ backingswap ftw. look into that. i've tried swap - its decent. i've tried compcache - hate it. compcache w/ backing swap? amazing!
After many tests I think that we really suffer from a lack of RAM. But the internal memory (NAND) should be the same speed as RAM I think. So why we don't use another 128Mb of NAND as additional RAM? A sort of swap part, but used as RAM and not as normal swap....
If someone related to the kernel would answer is it possible or not, it would be good)
DiMiK said:
After many tests I think that we really suffer from a lack of RAM. But the internal memory (NAND) should be the same speed as RAM I think. So why we don't use another 128Mb of NAND as additional RAM? A sort of swap part, but used as RAM and not as normal swap....
If someone related to the kernel would answer is it possible or not, it would be good)
Click to expand...
Click to collapse
Using it as RAM would propably require major changes to the kernel if it is even possible which I doubt it is. Using it as swap would be the possible alternative and I pretty sure that is very possible and would help performance but at a cost.
1. You would either have very little left for system and data or you would have to put system and/or data on the SD-card and that alone may make you lose anything you gain from putting swap on NAND.
2. I actually asked the swap-on nand question myself and well, we can't replace our NAND, at least not easily and swap is I/O intensive and intesive I/O will sooner or later wear out the NAND. So basicly this is not a good alternative unless you want to turn your phone into a paperweight sooner than you had planned.
So what we can do is using compcache and/or swap on SD-card. The easiest thing is to just enable some compcache. It uses RAM as swap and uses compression on the contents so we can hold more things in RAM that we would usually be able to. This means Android can keep more apps in "sleep" allowing for faster switching between apps but it will also decrease the possible amount of available RAM for the active app. I usually turn on compcache with the default setting which is to use 25% of the RAM for compressed swap. It might be placebo but IMHO it feels a it "smoother" to use after that.
Another alternative is to use a swap partition in the sdcard. Just using swap means you do not need to load any compcache kernel modules and there is no compression taking place so it's a good alterantive. However you need know your way around partitioning SD-cards to get this running so it's not as easy as just enabling compcache (assuming the build supports compcache).
For the really advanced you can enable compcache with backing swap. It means it uses a certain amount of compressed swap i RAM and when it runs out of space there it starts putting stuff on the SD-card swap partition. Once again, a bit tricky to setup but may be the best alternative.
Read more about it here: http://wiki.cyanogenmod.com/index.php/Compcache
kallt_kaffe said:
I usually turn on compcache with the default setting which is to use 25% of the RAM for compressed swap. It might be placebo but IMHO it feels a it "smoother" to use after that.
Click to expand...
Click to collapse
It make good effect: more applications can run simultaneously.
Hi, I was wondering if I can use the 10 mb ram hack with my g1 with CM 6.0 RC2. I noticed most of the tutoriials are using 4.xx.xx so I wanted to ask before I do it. My phone is kind of slow even though it is overclocked at 576mhz and 64 mb class 6 memory swap. Thanks.
Ties0 said:
Hi, I was wondering if I can use the 10 mb ram hack with my g1 with CM 6.0 RC2. I noticed most of the tutoriials are using 4.xx.xx so I wanted to ask before I do it. My phone is kind of slow even though it is overclocked at 576mhz and 64 mb class 6 memory swap. Thanks.
Click to expand...
Click to collapse
There is no 10 mb hack and won't be. It is not possible with Froyo.
As indicated above there is no 10mb hack and there never will be.
I am currently using the latest nightly and it is super fast and stable. As fast as donut (no ****).
3D Gallery works perfectly and there have been a bunch of small cool features added to the nightly.
I highly recommend it.
Awesome work has been done by Cyanogen and Crew.
ok thanks for the reply guys. Is there any other way to make my rom faster? Thanks.
Ties0 said:
ok thanks for the reply guys. Is there any other way to make my rom faster? Thanks.
Click to expand...
Click to collapse
Of course reduce or remove swap,
android has it's own swap mechanism that causes little ram to actually be least recently used, thus if swap is enabled the phone will be constantly swapping it in/out!
In addition to reducing the life of the SD card its slow. I understand a very little bit of swap *may* allow some edge cases where a *little* more ram is needed or to offload something like launcher that may be configured to stay in ram to work faster.. however you can't forget the speed issue.
Try this enter console on your phone and run:
dd if=/dev/zero of=/sdcard/swapspeedtest bs=1048576 of=64
Note the time it takes, that is the time to write 64mb on a swap out operation.. if it seems too long to wait for a task its too much swap. 12mb is almost acceptable. I just stick to comp cache only. . Upped it from the default 12 to 15 MB since I had one or two tasks that just needed a tad more memory to play nice.
Also what is slow, returning to home? A particular app? I doubt its everything, usually its launcher and there are ways of locking it in home, upgrades to awd, and alternative launchers. These may help.
ezterry said:
Of course reduce or remove swap,
android has it's own swap mechanism that causes little ram to actually be least used, thus if swap is enabled the phone will be constantly swapping it in/out
In addition to reducing the life of the SD card its slow. I understand a very little bit of swap to allow some edge cases where a little more ram is needed or to offload something like launcher that may be configured to stay in ram.. however you can't forget the speed issue.
Try this enter console on your phone and run:
dd if=/dev/zero of=/sdcard/swapspeedtest bs=1048576 of=64
Note the time it takes, that is the time to write 64mb on a swap out operation.. if it seems too long to wait for a task its too much swap. 12mb is almost acceptable. I just stick to comp cache only. . Upped it from the default 12 to 15 MB since I had one or two tasks that just needed a tad more memory yo play nice.
Also what is slow, returning to home? A particular app? I doubt its everything, usually its launcher and there are ways of locking it in home, upgrades to awd, and alternative launchers. These may help.
Click to expand...
Click to collapse
Thanks for the detailed response! I will try lowering the swap partition, I always thought it would be fast because of the class 6 speeds. Does putting all my apps on SD make it slow as well? Also, returning to home is the main lag I'm talking about as it takes quite a while to see my apps. Thank you!
ezterry said:
Of course reduce or remove swap,
android has it's own swap mechanism that causes little ram to actually be least used, thus if swap is enabled the phone will be constantly swapping it in/out
In addition to reducing the life of the SD card its slow. I understand a very little bit of swap to allow some edge cases where a little more ram is needed or to offload something like launcher that may be configured to stay in ram.. however you can't forget the speed issue.
Try this enter console on your phone and run:
dd if=/dev/zero of=/sdcard/swapspeedtest bs=1048576 of=64
Note the time it takes, that is the time to write 64mb on a swap out operation.. if it seems too long to wait for a task its too much swap. 12mb is almost acceptable. I just stick to comp cache only. . Upped it from the default 12 to 15 MB since I had one or two tasks that just needed a tad more memory yo play nice.
Also what is slow, returning to home? A particular app? I doubt its everything, usually its launcher and there are ways of locking it in home, upgrades to awd, and alternative launchers. These may help.
Click to expand...
Click to collapse
I have about 3-5 apps that I would like to be running at one time? Should I be using CompCache or Swap? Currently I am on SuperD 1.9.3 WGK. I have been reluctant to run Froyo roms because they are so much more memory hungry in my experiences. My current rom runs pretty fast with a 96mb swap. If I were to fun a Froyo rom, what can I do to be able to run the 3-5 apps and retain speed?
Ties0 said:
Thanks for the detailed response! I will try lowering the swap partition, I always thought it would be fast because of the class 6 speeds. Does putting all my apps on SD make it slow as well? Also, returning to home is the main lag I'm talking about as it takes quite a while to see my apps. Thank you!
Click to expand...
Click to collapse
If you are using BOTH SWAP & have applications installed to the sdcard, then it will ****REALLY**** be slow.
With just applications on the sdcard, your speed should be fine.
Ties0 said:
Also, returning to home is the main lag I'm talking about as it takes quite a while to see my apps. Thank you!
Click to expand...
Click to collapse
This is a symptom of launcher being evicted from ram, try the stay in ram option in settings->adw launcher->system settings->system persistent in the more recent versions of adequate (I think included with rc2 if my memory serves me)
It may not be perfect as it will still get killed if a very large application is loaded.
Either you need a launcher that behaves as a good android application, and can quickly reload it's last state, even if it was not in ram when you requested it.. or launcher needs to be considered outside the usual android memory management and to be kept in ram.
These persistent processes are where you may depending on your usage of the phone find comp cache or swap in low amounts (32mb combined is probably the absolute max) may help as they will have allocated ram that is rarely used and not automatically freed as they are persistent..
ezterry said:
This is a symptom of launcher being evicted from ram, try the stay in ram option in settings->adw launcher->system settings->system persistent in the more recent versions of adequate (I think included with rc2 if my memory serves me)
It may not be perfect as it will still get killed if a very large application is loaded.
Either you need a launcher that behaves as a good android application, and can quickly reload it's last state, even if it was not in ram when you requested it.. or launcher needs to be considered outside the usual android memory management and to be kept in ram.
These persistent processes are where you may depending on your usage of the phone find comp cache or swap in low amounts (32mb combined is probably the absolute max) may help as they will have allocated ram that is rarely used and not automatically freed as they are persistent..
Click to expand...
Click to collapse
Thanks for the detailed response! I just changed the adw launcher and deleted my swap partition... It seems to be much slower when pressing home (icons are taking a while to load) so I might just use 32 mb for swap.
EDIT: question, what exactly does ext4 do? I know swap is like external ram, but what does ext4/ext3/etc exactly do? and how much should I put in? I tried googling but could not find the answer. Thanks!
Ties0 said:
EDIT: question, what exactly does ext4 do? I know swap is like external ram, but what does ext4/ext3/etc exactly do? and how much should I put in? I tried googling but could not find the answer. Thanks!
Click to expand...
Click to collapse
On CM6, nothing. On CM 4 & 5, it was used for Apps2Ext (formerly known as Apps2SD - before Google came out with their own flavor). However, CM6 does not have Apps2Ext. It has been indicated that it will be targeted for 6.1.
my 2c about compcache (now "zram") and swap
Both compcache and swap are used to improve performance AND maximum number of open apps.
1)How they work:
swap is the classic way to "increase" ram on a system.
Swap is a space on a non volatile memory (="not ram") where unused ram data are parked instead of being deleted.
Swap wears(and kills) memories it is put on. It is an heavy access file. Sdcards don't like it. They are not full-featured SSD Disks. Think of your photographs
Compcache is the new way to "increase" ram on a system,
compcache :
-reserves a part of you ram (cache),
-then it looks for unused data sitting on remaining, "real", ram,
-compresses these unused data (with a very primitive,loseless, algorithm) and
- send them to its cache OR to swapfile.
Compcache's trick works well when you have lots of higly,easily, compressable data in your ram. Text is higly compressable, an executable is less compressable.
1a)
-if, after compression , data are still "big" (compressed data > original data /2), then compcache sends compressed data to swap, not to cache.
-and when compcache is full, unused compressed data are sent to swap.
2) because of compression involved, compcache uses more cpu cycles than classic swap.
3) settings of both depends on
-hardware specs of the system.
-use of the system
4) compcache+swap is better than swap alone if your ram is filled with EASILY compressable data.
4a)Remember point 1a : compcache has a simple compression algorithm, and ALWAYS first compresses data.
AFTER COMPRESSION it decides if keeping them in cache or sending them to swap. This means that
if compcache has always to work with not compressable data, it will compress them AND send to swap. this means double work: compression AND swap access.
4b) First practical conclusion :
compcache is useful for people using LOTS of text-intensive apps (forums, webpages, docs, facebook)
compcache may be useful in apps using SIMPLE still images (some games, driving assistant)
compcache is useless in multimedia activity (watching youtube, movies, photographs, listening to mp3s, playing some other games.)
5) The swap file.
As told at the beginning, swap, both improve performance(=speed) AND number of apps simultaneously open.
Lets' take a look to the PERFORMANCE thing.
5a)On "classical" (fragmented, not-SSD hard disk) systems, a swap file is always faster than retrieving datas from original disk locations. EVEN IF the swap file is on the same disk where original datas are.
This happens mainly because :
5a1)-data in swap file are less fragmented, needing less seek time.
5a2)-swap file is usually put in the external (=fast) zone of an hard disk,
5b)On SSD systems (phones included) 5a1 and 5a2 are not true, and a swapfile is USELESS IN IMPROVING PERFORMANCE EACH TIME THAT it is keeping data which are already present on its same phisycal memory.
Examples :
5b1)opera browser executable is on phone memory; but Opera-cached-webpages have been moved on sdcard via app2sd.
In this situation a swap file on sdcard is obviously useless to improve internet browsing with Opera.
5b2) i use apps (facebook, Whatsapp) which DON'T have a good caching of their own. Swap could be useful: it could avoid re-downloading data from the internet.
Now, the INCREASE MAXIMUM NUMBER OF OPEN APPS argument.
This is always true.
So:
5c)swapfile on SSD speeds up multitasking ONLY IF you use apps that
-badly manage (or don't have) a cache of their own.
-don't like force closing
Since this seems to happen very often to android apps, a swapfile is useful.
5c1)Swapfile could speed multitasking also IF an app's well-designed-cache is on a media WAY SLOWER than swapfile (but this is not LG O2x situation: it has a class10 internal memory).
So, my 2 cents about "increasing" RAM in LG O2X is :
-leave apps on phone memory, and put swap on a class10 sdcard.
-enable compcache only if you use lots of text-rich apps.
First: I think this doesn't really fit into the development section.
Then: I can't second the post you made.
mercxda said:
Both compcache and swap are used to improve performance AND maximum number of open apps.
(...)
As told at the beginning, swap, both improve performance(=speed) AND number of apps simultaneously open.
Click to expand...
Click to collapse
zRAM does NOT improve the speed of your device. Everything that's in the reserved zram storage will get compressed and decompressed, which takes some time (and cpu).
Swap is performing even worse. Instead of the fast RAM or the semi-fast compressed zRAM usage it's swapping onto the slow SD.
Sure, you can increase the maximum number of open apps, but the price is a lower performance.
So you're probably just meaning multitasking performance.
But still I can't agree to your conclusion:
mercxda said:
So, my 2 cents about "increasing" RAM in LG O2X is :
-leave apps on phone memory, and put swap on a class10 sdcard.
-enable compcache only if you use lots of text-rich apps.
Click to expand...
Click to collapse
As I wrote above zRAM is way faster than swap. So zRAM should be the first choice if you're running into low RAM situations.
If you still need more go and enable swap as well.
Last but not least:
Why are you talking about compache all the time? It's called zram nowadays, so call it that way.
tonyp said:
First: I think this doesn't really fit into the development section.
Click to expand...
Click to collapse
First : thanks for your interest in this post . I partially agree with you: this post is on the borderline beetwen Q&A and Development, because swap is not a development matter, it's standard unix's way of working.
On the other side zram's use,way of working, and even its inclusion (or not) itself in default installs, is still under development.
https://lists.ubuntu.com/archives/ubuntu-devel-discuss/2012-December/014122.html
Sure, x86/x64 is not ARM. And CM is not ubuntu.
Then: I can't second the post you made.
zRAM does NOT improve the speed of your device. Everything that's in the reserved zram storage will get compressed and decompressed, which takes some time (and cpu).
Swap is performing even worse. Instead of the fast RAM or the semi-fast compressed zRAM usage it's swapping onto the slow SD.
Sure, you can increase the maximum number of open apps, but the price is a lower performance.
So you're probably just meaning multitasking performance.
Click to expand...
Click to collapse
I, again , partially agree, i was fundamentally talking about multitasking performance. And sure, zram takes cpu cycles... I reserved a full, standalone point to say that.
But
i wouldn't be so sure about one being better than the other. My arguments are in the original post.
As I wrote above zRAM is way faster than swap. So zRAM should be the first choice if you're running into low RAM situations.
If you still need more go and enable swap as well.
Click to expand...
Click to collapse
As I wrote, and argumented, before, compcache/zram is way faster in a way limited range of situations.
Last but not least:
Why are you talking about compache all the time? It's called zram nowadays, so call it that way.
Click to expand...
Click to collapse
Because
1) I'm an old cat.
2) "Compcache" is a well chosen autodescriptive term.
3) It's been "compcache" for over 4/5 of it's life, and, well...
4) I'm an old cat. ;D
Have fun, and thanks for all your work in O2x developing.