[Q] To SWAP or not to SWAP... - Nexus One Q&A, Help & Troubleshooting

If anyone could help me out here I will love you LONG time:
I am wondering id I should set up a swap partition and use it with this script (apps/data 2 ext, supports swap). I am starting fresh on my Nexus One installing a Gingerbread MIUI ROM using this script for the first time. I was wondering if I should use a SWAP with my class 4 16gig sd card. I will have a 1gb EXT partition. If anyone could state simple pros/cons I would MUCH appreciate it. I have heard good but mostly bad about swap on gingerbread saying that it is not needed and can cause bad.
Does the N1 really need SWAP with Gingerbread? I'm shaking in my pants posting this but I have not seen any related articles, let alone for the N1. I have done a Google search but that doesn't help, it confused me more if it is worth it.
Thanks again. Deuces.

There are some comments from experienced users here on swap, most are against. Here is a link that has a lot of comments--
http://zerocredibility.wordpress.com/2009/08/24/why-android-swap-doesnt-make-sense/
I am no android tech, but never used and don't have issues. I run a lot of apps over a hundred from the Market alone

Thanks! Exactly what I needed. No SWAP for me!

Glad to help--

I'm no expert either. But I do have a 256MB swap partition.
Swap *should* only be used when physical memory is low, and more is still needed by the system. If you're low on memory and need more, then swap might be useful then.
There's a kernel setting called "swappiness". I have this set to a low setting "5", which I believe means that swap should only be used as a last resort i.e. more importance is put on using physical memory over swap.
Yes swap is slower. If a system is swapping out, then it's logical to add more physical memory to the system. However as we cannot upgrade physical memory on our phones, so I suppose swap is the next best thing.
Anyhow that's just my personal thinking. My Nexus is running sweet and I don't notice any considerable slowdowns. However perhaps my swap has never really been required?!

Swap is made for desktop OS, where there is such thing as "lack of memory".
Such thing doesn't exist on Android, mobile OS of completely different design.
The reason is - desktop OS can't kill the tasks you've left running. Mobile OS can, and will, once it senses that it needs more memory. And the tasks themselves are built to be killed.
Adding SWAP is fooling Android that it has more actual memory than there really is - and the OS is using it like it was real memory, not killing tasks when it should. And while doing that, SWAP is far slower than just killing and reloading tasks - because it requires writing to and reading from the SWAP partition the whole app, while when killing and loading it, only reading is required - making the process MUCH faster.
I believe that's the essence of the earlier reference.
Shortly, unless there is severe lack of RAM (and on N1 there isn't by any parameters) - SWAP will make things worse, not better.

By activating compcache (~18% should do), and kernel samepage merging, there is no need for swap. I think texasice confirmed this, although I am not sure.
Sent from my Nexus One using Tapatalk

I would never use swap for GB. Tough there is discussion of using it on ICS, the few times I have tried it I did not use it.

I used swap a long time ago on CM6 or early 7 and there was absolutely no benefit in my opinion. Doesn't swap force more read/write times on SD which can decrease the life as well? That's just my $0.02.

TheAndroidStop said:
I used swap a long time ago on CM6 or early 7 and there was absolutely no benefit in my opinion. Doesn't swap force more read/write times on SD which can decrease the life as well? That's just my $0.02.
Click to expand...
Click to collapse
Swap isn't useful when it's not being used, and FroYo or Gingerbread hardly uses that much RAM. ICS, however, with its full hardware acceleration, is a real memory hog. Now, though, if we enable kernel samepage merging and a zram amount of like 18%, we wouldn't need a swap partition. Like it's been said before, swap is very slow, much slower than actual RAM.
Sent from my Nexus One using Tapatalk

Swap seems as use full as a taskiller in Android....
Sent from my Nexus One using xda premium

Hello, does not swap hard Android phone for auxiliary memory damage the hard?

Related

how to activate linix swap

So from what I understand linix swap is a method to make your phone run faster. My phone has been acting a bit sluggish lately when loading the home screen.
When partitioning my sd card (using ra recovery) it asked how large of a swap to use, I checked another thread and found out that the recommened size for cupcake is 64mb. I set it at that. Is my phone currently using the swap or do I need to activate it/ use an app
In addition to the obove questions could someone outline the advantages/disadvantages.
Thanks a lot for any help.
asb123 said:
So from what I understand linix swap is a method to make your phone run faster. My phone has been acting a bit sluggish lately when loading the home screen.
When partitioning my sd card (using ra recovery) it asked how large of a swap to use, I checked another thread and found out that the recommened size for cupcake is 64mb. I set it at that. Is my phone currently using the swap or do I need to activate it/ use an app
In addition to the obove questions could someone outline the advantages/disadvantages.
Thanks a lot for any help.
Click to expand...
Click to collapse
In cyanogen you will need to edit the user.conf or userinit.sh, I'm not sure which, to activate linux-swap as he uses compcache as default
It depends on who you ask... CompCache (CC), IMO, is better than swap for many reasons, the most of which is that it seems to be faster in scientific testing, and the best test of all, the seat of your pants test.
The problem with CC is that if you want to flash a ROM that is huge, ie a Hero ROM, you run out of room, so it becomes slower compared to a swap where you are actually adding "RAM" by using the SD card to do this. Some have been able to make Hero small enough to work with CC, but not enough for most people wanting all the bells and whistle's of Hero.
CC has some draw backs, the biggest being that it is slower than no CC in a solo task since the CPU has to uncompress the data when you re-open a program (You really see this when you open your browser back up and it takes 5 seconds to "reload" the page). But this is about the only real draw back.
Swap has a few more draw backs... it burns up your SD card, although it isn't a "huge" deal, it is still a draw back. As well, like CC, the CPU has to pull this data off the SD card, it isn't just sitting in memory like true RAM, so it's speed is limited by the speed of the SD card and the speed of the G1 at reading the SD card. In the end, since swap tends not to be compressed anywhere close to what CC is, it ends up being not that big of a deal in terms of actual speed... ie the browser might take half a second longer to open than CC right out of the box, but if you end up with 15 apps running and Rosie(what makes a Hero ROM a Hero ROM) it will take less time since it is at least still in the "RAM" and doesn't have to be re-opened 100%.
I hope this makes sense, and for those wiser than I, if I misrepresented let me know and I shall bow down like red chowder bows down to white chowder.
you can also use the app "user.conf v.030"
that's what i use, because i can control swappiness
i have now compcach enabled 64MB, ccbackinswap (swappiness 50), and 128MB linux-swap (swappiness 50)
works like a charm
shmigao said:
you can also use the app "user.conf v.030"
that's what i use, because i can control swappiness
i have now compcach enabled 64MB, ccbackinswap (swappiness 50), and 128MB linux-swap (swappiness 50)
works like a charm
Click to expand...
Click to collapse
And I take it that this will make my phone run quicker? My phone has been a bit sluggish in loading the home dash
would this make my phone run quicker? and cold you explain swappiness
asb123 said:
would this make my phone run quicker? and cold you explain swappiness
Click to expand...
Click to collapse
It depends, try it out and see how it works for you. Every person uses their phone differnetly, so for some it is an improvement, for others it is not.
And "swappiness" means the actual amount of data being swapped...
ie:
I have my linux-swap partition at 200MB, and my swappiness set at 96MB, meaning that only 96MB of data are actually being swapped on to the SD card.
Now, I don't use swap at all myself on donut, I stick to compcache or nothing depending on what the chef decided to do. If it uses swap out of the box, I will turn it off and put it onto compcache for a donut build.
Before you start playing around with swap, maybe get a task killer installed and use it sparingly (Android runs better when you don't kill stuff because of the way it is designed, but there is a limit, so task killers are nice, especially to kill something like music player or video player running in the background) This will speed things up just by keeping heavy CPU/RAM use programs actually fully closed.
Also, how slow is slow? At first, any ROM fly's on snapping back etc... but they all slow down a bit, some more than others. Actions should not and will not be instant, they should take time... not 15 seconds, but if it takes a second to load the home screen, so be it, that is damn good my friend.

Why Doesn't the Phone Use More of the Swap Partition?

hello.
I currently have a 90mb swap. In terminal my phone never uses more than 65mb.
People recommend an even bigger swap for the legend ROM, why does the phone not just use more of my swap than have me create a bigger swap?
Linux will use the swap space as it needs it.
If it runs low on real memory it will use swap, if it is not running low it wont.
Thats my understanding of the swap system anyway
How much swap is used also depends on what your swappiness is set at.
Be glad it's not - the more swap used, the slower your phone.

Swap on a class 2 card worth it?

I've noticed that my G1 (Running CM6) tends to run out of RAM fairly often, I was thinking maybe having swap space might help me a bit with this, however I only have a Class 2 SDHC Card (16GB), would I see any performance increment or should I just wait until I can afford a much faster one? (eg. The Kingston Class 10 one)
I would suggest to use no swap at all ... if RAM is too low, try to enable compcache it will help you probably a bit. I noticed a massive performance drop when enabling swap on CM6.
Sent from my Htcclay's Superfly G1 using XDA App
Swap and CM5/6 don't get along. The memory killer in the kernel thinks that swap is actually free RAM and keeps more things open, stopping tasks from being killed at all. If you want to use swap, I recommend you use a donut/cupcake/hero rom that uses a different kernel so that things don't get down to a screeching halt. And anyways, the fastest speed I have ever seen my phone write something from my computer to the phone via USB is 2.7mb/s, compared with 6-12mb/s I get from an sdcard reader. That means that even when your phone is writing at top speed, it is just barely far from the 2mb/s write speed guaranteed by a class 2. You will definately see better performance with swap on a class 4, but anything higher won't benefit your phone much at all, unless you regularly transfer large amounts of files to your memery card via a card reader.
AndDiSa said:
I would suggest to use no swap at all ... if RAM is too low, try to enable compcache it will help you probably a bit. I noticed a massive performance drop when enabling swap on CM6.
Sent from my Htcclay's Superfly G1 using XDA App
Click to expand...
Click to collapse
Compcache didn't improve performance at all, for me at least.
mejorguille said:
Swap and CM5/6 don't get along. The memory killer in the kernel thinks that swap is actually free RAM and keeps more things open, stopping tasks from being killed at all. If you want to use swap, I recommend you use a donut/cupcake/hero rom that uses a different kernel so that things don't get down to a screeching halt. And anyways, the fastest speed I have ever seen my phone write something from my computer to the phone via USB is 2.7mb/s, compared with 6-12mb/s I get from an sdcard reader. That means that even when your phone is writing at top speed, it is just barely far from the 2mb/s write speed guaranteed by a class 2. You will definately see better performance with swap on a class 4, but anything higher won't benefit your phone much at all, unless you regularly transfer large amounts of files to your memery card via a card reader.
Click to expand...
Click to collapse
What if I have a task killer app? Because running out of RAM is just as bad as having too much running...I don't have many apps as I only keep what I actually use as well.
I have to ask, what are you seeing as the symptom of "running out of ram" the system will always use all ram so it will always have nearly none free.
By this I of course mean what is taking forever from you the end users perspective.. from there we can tweek in the right direction or work on making the phone prioritize what is needed to be useful.
Many times people put tons of swap only to find the the problem application is still removed from ram/swap due to configuration and the system is even slower with swap.
Also before enabling swap try the settings -> adw -> system -> system persistent is enabled. (Or equivalent on other launchers)
If you really want to try swap, it wont be fast but in very little amounts
ezterry said:
I have to ask, what are you seeing as the symptom of "running out of ram" the system will always use all ram so it will always have nearly none free.
By this I of course mean what is taking forever from you the end users perspective.. from there we can tweek in the right direction or work on making the phone prioritize what is needed to be useful.
Many times people put tons of swap only to find the the problem application is still removed from ram/swap due to configuration and the system is even slower with swap.
Also before enabling swap try the settings -> adw -> system -> system persistent is enabled. (Or equivalent on other launchers)
If you really want to try swap, it wont be fast but in very little amounts
Click to expand...
Click to collapse
Well, if I have MSN Talk open, the home screen tends to fall out of memory (Yeah, I have System persistent enabled) and Messaging is extremely slow (To the point where a letter appears a good second after I press the key), it's that kind of thing when I run certain programs, it makes it hard to have stuff like JuiceDefender running because I always run out of RAM even just running the Speedtest app then.

[Q] Anyone used Swapper 2 ? Whats it for?

I found this app called Swapper 2 when I first got my phone months ago. I have no idea what it does other then it sounds like a lagfix before such thing was known. Theres not much docu's on it but from what I gather Its a Swap File to extend your working ram memory and it needs a Kernel to work. Can anyone shine some more light on this app and would it be useful on a SGS?. I can only think of using this on a G1 to extend its working ram to run 2.1/2.2
would like to know this as well so gonna bump this topic...
Its kind of like the page file on windows, Google search Linux Swap. I used to use it back in the g1 days due to the pathetic amount of ram it had . Simply put It creates a file on your sd card and 'swaps' information in and out like its an extension of the ram. You can set the 'swappiness' which is how frequently information is swapped in and out. I tried it out when I first got this phone it slowed the phone down for ne but ymmv.

[Q] RAM Swap on Z1?

Hey Guys,
I was just around XDA and I was reading about someone who was saying that the Ram Swap have the "opinion" to not be useful at all but someone else who complain about the ram consumption saying that Swap is needed at must if on low Ram, and that was said from Power Users on XDA.
I understand that on High-End Devices this script not have space in the first place but I want to go extreme. Why Not?
Like all we know we have enough Ram to share but we also know that all the latest applications and Games eat a lot of Ram and when they consume Ram in excess Android will kill all the applications in background to let other applications working well.
Let's said that 2GB of Ram (1,66GB effective) it's not much on our Z1 and probably nobody take my idea seriously but I think that after few years when huge applications will come out on our devices, hungry of ram, then you will see that maybe this will help.
So my question is if it will be possible to expand the Ram with Swap on SD to let Android not kill Applications and have more Ram (virtual and real) to share. Like 1,66 real + 1GB Swap?
Do you think it will be a good Mod? It's difficult to make it real? It will be ever available on our Z1?
Well the Z1 only has 11gb or usable internal memory and i wouldnt want to make 1 or 2 of that useless just in case i run out of 1.7gb of ram on the device which doesnt happen very often. and the other thing is if you actually make a swap partition and manage to set it up , then when you run out of ram and device start to use the sd card or the external sd (which i think is even slower) as a ram the phone will start to run extremely slow compare to normal. i think swap partition make more sense on a linux production machines or a server when you cant afford any programme to be shut down. having said that if the mod is ever going to be availible ill probably make 500Mb swap just incase
Yes it is possible to make a swap partition on the Z1, just don't bother with it. Swap is really slow, your apps won't get killed but it will take a very long time to open them again since your internal memory/sd-card is that much slower than the RAM in your device.
You could try messing around with the Android minfree settings but other than that, deal with it. Try searching on Google for some tutorials on customizing your minfree settings.

Categories

Resources