CM7 - Swap? Compcache? Both?

Discussion in 'Cyanogenmod' started by chmcclellan, Feb 5, 2011.

  1. chmcclellan
    Offline

    chmcclellan New Member

    Joined:
    Jun 17, 2010
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    Hey all-
    Since there is a lull in MIUI releases, I thought I would jump over to CM7 nightlies to see what its like to run gingerbread. I had never gotten around to setting up an apps2sd partition, but have been getting space warnings, so decided to go ahead. Since this is a convenient time to also set up a swap partition, I thought I might do that as well.

    Questions:
    1. As explained here, I understand compcache is virtual swap in RAM itself. This would seem to suggest it is pointless to use swap and compcache simultainiously - yes?

    2. Assuming the answer to 1. is yes, which is better? Seems like setting aside RAM for compcache is a little counterproductive if I am hoping to speed up my device. At the same time I hear swap will speed up wear on the SD card.

    3. Assuming the answer to 2. is that swap is preferable, what is the maximum helpful swap size? I see a lot of recommendations for 32 MB, but considering I am not maxing out my SD card as it is, doubling or quadrupling this is feasable - would it help?
  2. chmcclellan
    Offline

    chmcclellan New Member

    Joined:
    Jun 17, 2010
    Messages:
    49
    Likes Received:
    0
    Trophy Points:
    0
    For that matter, what is the maximum space I would need in the partition to be used for apps?

    So much anxiety when deciding on partition sizes - like my dad always said measure twice and cut once!
  3. Bear in NM
    Offline

    Bear in NM Active Member

    Joined:
    Nov 12, 2009
    Messages:
    1,389
    Likes Received:
    1
    Trophy Points:
    38
    CH,

    Tough questions. I do not have answers to what is best, as it depends on what you need for your phone, your apps and your speed.

    If you check in the nightly CM7 thread, and take some time reading from about page 80-90, you will see where compcache is "fixed" by member Prime. It is offshoot of the compcache tutorial thread here in this forum, which itself was an offshoot to the long compcache thread. We are just starting to explore the issues with CM7 (GB), native task killing and compcache. It does seem to work, and while this does not answer your question (or need) of speed v. available ram, it appears to have worked for some folks. The speed can be had with overclocking.

    I would say the bottom line for your phone and your needs would be to try the compcache, proper overclock and then balance your results against what it is you are doing. And hopefully you are not just looking for a raw score in Quadrant, as this is a quantitative bench for comparisons, it really sucks as a guage to how your phone will run with your apps.

    As to the partitioning, I am weak here, but froya and GB support apps to sd without need for partitioning. Natively only a portion of the app is moved to the sd card, so perhaps you are looking for something more? As to card life, my best recollection when I was searching the web trying to get my noodle around cards is that they are typically rated for 100K read/write cycles. That is a lot for folks who use the card for file storage, rom flashing pictures and the like, but may not be a lot for constant read-writes. I guess if I had so many apps that I had to have them on SD, then factor in the cost of new cards every so often as the price of admission. And I would suggest getting in the habit of routinely backing up your card for your personal files (photos/music/videos etc.)

    Craig
  4. GodfatherIP
    Offline

    GodfatherIP New Member

    Joined:
    Feb 22, 2010
    Messages:
    249
    Likes Received:
    0
    Trophy Points:
    0
    I have been wondering about these same issues. I recently got a lexar class 10 32gb microsdhc card so I figured the first thing I would do was partition it for apps to sd-ext with rom manager and while setting this up it asked if I wanted to do a swap partition as well so I figured what the heck and made a 128mb swap partition too, thinking if I wanted to use it down the road it would be easier to go ahead and partition now while my card was still blank. Looking into it though it seems people have had a wide range of experiences with swap from saying it slows down the phone making it unusable to people saying it made their phone run better than ever. I used compcache before on CM6 and I didn't feel like it improved things, in fact it seemed like things were a little slower and memory wasn't managed as well but as mentioned it just takes part of the ram and makes it compressed and swaps in and out of that so you have less uncompressed ram but seemingly more total ram. It would appear to me that sdcard swap might be preferable since it leaves all of the original ram untouched but of course it has the downside of slow read/write speeds to the card. I'm not too worried about SD card wear since the card has a 10 year warranty and will probably last until it is obsolete even with swap (a year or two from now and these cards will probably only be ~$20 anyway). So has anyone used swap with CM7 yet and how did it work out for you? I am hopefully going to have some time to flash CM7 tonight so I'll report back if I get everything working.

    In response to Craig, as far as the apps to sdext I have definitely heard that this has advantages over the froyo apps2sd although I haven't tried it yet (I will as soon as I install CM7). For example the entire app is moved rather than just part of it, the apps load more quickly on boot, and when you mount your sd card to your pc the sd ext apps will still work unlike froyo apps2sd where the apps can't run while the sd card is mounted.

    I remember a while back reading about someone working on repartitioning the phone's internal memory (I think maybe it was a xda thread on the G1). That made me think that maybe if someone was using an sd-ext partition on their phone for their apps that potentially part of /data could be partitioned as a swap space and maybe using the phone's internal rom for swap would be faster and better than the sd card swap. Anyway I would have no idea how to even begin addressing such an idea or if it would really be preferable, just throwing it out there. RAM definitely seems to be one of the Droid's biggest limitations so any way to improve upon this would be awesome.
  5. Bear in NM
    Offline

    Bear in NM Active Member

    Joined:
    Nov 12, 2009
    Messages:
    1,389
    Likes Received:
    1
    Trophy Points:
    38
    GF,

    Thanks for the detailed post. I think you have pretty much nailed the biggest complaint, possible card life shortening. Your eyes are wide open, and your mind is clear on it. That is 90% of the battle. It certainly does make sense that having the entire ap in one place has got to help. And by and large about the only time I have remembered seeing questions on this have been when folks really are flat out of room in data. Our Droids are old, about to become relatively slow and have limited resources. About the best we can hope to do is chip away at the margins.

    And in allhonesty, it really is going to come down to you using it and finding out for yourself. Not sure I have ever seen a single thread where something like this was discussed where you did not have a bunch of folks finding heaven, with a similar number finding hell. With all of my music and photos/videos, my SD space is more precious than /data..........

    Craig
  6. Ozzie
    Offline

    Ozzie Member

    Joined:
    Aug 6, 2010
    Messages:
    824
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Minnesota
    I love this topic...I just purchased a 32GB 10X card myself not long ago and felt the tug to explore other options with it. I may still end up digging in if the development slows a bit.
    Just a thought...off track a little, but I wonder if we could use the micro usb for an additional storage device? I found an adapter for a usb drive...
    Last edited: Feb 17, 2011
  7. gambit07
    Offline

    gambit07 New Member

    Joined:
    Oct 22, 2010
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    0
    I haven't tried swap because I'm too worried about killing my sdcard, I heard a lot of things back and forth on compcache but once I realized GB's task killer was so aggressive that I couldn't keep more than one app open at a time I decided to see what it could do. My experience has pretty much been all positive with it. I have compcache at 18% and VM heap at 32m. My launcher almost never force closes, even after opening apps and playing games. I can keep at least 4 or 5 apps open at the same time without them closing.

    People also say that since the cache has to be compressed and decompressed your ram will be slower, which is true I suppose but in real world experience I haven't noticed any slowdown in opening/running tasks or smoothness of scrolling, in fact scrolling seems much better on the launcher. After 1 or 2 days it will start to slow down, all you need to do is restart your phone and it'll work fine. Anyway RAM is definitely our biggest bottleneck on the droid so I don't think there's any reason not to use compcache.
    Last edited: Feb 17, 2011
  8. pdroid
    Offline

    pdroid New Member

    Joined:
    Mar 4, 2010
    Messages:
    2,252
    Likes Received:
    7
    Trophy Points:
    0
    Location:
    Philly
    Yeah, it's starting to look like things like compcache, higher clock rates, etc. are going to have to be the order of the day to get good GB operation on these devices.
  9. gambit07
    Offline

    gambit07 New Member

    Joined:
    Oct 22, 2010
    Messages:
    384
    Likes Received:
    0
    Trophy Points:
    0
    Once you sort out the ram I think GB runs better than froyo did though. Games most definitely run better and the system seems to be more responsive overall. I actually am clocked slightly less with GB than I was with froyo. Another nice thing is that for whatever reason GB doesn't seem to get as bogged down over time as froyo did.
  10. Bear in NM
    Offline

    Bear in NM Active Member

    Joined:
    Nov 12, 2009
    Messages:
    1,389
    Likes Received:
    1
    Trophy Points:
    38
    Oz,

    Drivers, or specifically the lack thereof:) At least in all of the threads I have seen about peri. devices, no drivers seems to be the bottom line.

    Craig
  11. prime
    Offline

    prime Kernel Developer Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,845
    Likes Received:
    30
    Trophy Points:
    48
    Location:
    Florida
    You can run other things from the Droid USB port such as a USB hard drive, mouse, gamepad, etc..etc

    You simply need the proper driver (kernel .ko file).

    Compcache supports whats called backing swap, you can use compcache with a swap partition without issue as it's designed for doing just this.
  12. Sparkimus
    Offline

    Sparkimus New Member

    Joined:
    Sep 5, 2010
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Calhoun, GA
    Hey Prime,

    I just flashed your reprimed kernel and enabled compcache (18%) and under free I have roughly 230000 in memory, and 933000 in swap. Swap used to be closer to 52000 before. I have my SD partioned with a 512 partition and a 64MB swap from when I was messing around with swapper 2, but I no longer have Swapper 2 installed and the partition still seems to show up. I went into my /sd-ext and deleted the swap file that was left from S2 and it still reports a swap size of 933000 after a few reboots. Any idea what is going on?


    Edit: Swap is actually 700000, 933000 is total memory.

    Sent from my Droid using DroidForums App
  13. prime
    Offline

    prime Kernel Developer Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,845
    Likes Received:
    30
    Trophy Points:
    48
    Location:
    Florida
    Let me see the output of 'compcache stats' from a terminal.
  14. Sparkimus
    Offline

    Sparkimus New Member

    Joined:
    Sep 5, 2010
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Calhoun, GA
    export PATH=/data/local/bin:$PATH
    $ export PATH=/data/local/bin:$PATH
    $ su
    # free
    total used free shared buffers
    Mem: 231368 226868 4500 0 28
    Swap: 702456 21880 680576
    Total: 933824 248748 685076
    # compcache stats
    DiskSize: 702464 kB
    NumReads: 3060
    NumWrites: 5964
    FailedReads: 0
    FailedWrites: 0
    InvalidIO: 0
    NotifyFree: 494
    ZeroPages: 793
    GoodCompress: 73 %
    NoCompress: 12 %
    PagesStored: 4677
    PagesUsed: 1657
    OrigDataSize: 18708 kB
    ComprDataSize: 6505 kB
    MemUsedTotal: 6628 kB
    #

    Sent from my Droid using DroidForums App
  15. prime
    Offline

    prime Kernel Developer Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,845
    Likes Received:
    30
    Trophy Points:
    48
    Location:
    Florida
    Let me see the output 'dmesg | grep swap'.
  16. Sparkimus
    Offline

    Sparkimus New Member

    Joined:
    Sep 5, 2010
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Calhoun, GA
    export PATH=/data/local/bin:$PATH
    $ export PATH=/data/local/bin:$PATH
    $su
    # dmesg | grep swap
    <6>[ 16.088531] ramzswap: num_devices not specified. Using default: 1
    <6>[ 16.179443] ramzswap: There is little point creating a ramzswap of greater than twice the size of memory since we expect a 2:1 compression ratio. Note that ramzswap uses about 0.1% of the size of the swap device when not in use so a huge ramzswap is wasteful.
    <6>[ 16.375335] ramzswap: /dev/ramzswap0 initialized: disksize_kb=702464
    <6>[ 16.424530] Adding 702456k swap on /dev/block/ramzswap0. Priority:-1 extents:1 across:702456k SS
    #free
    total used free shared buffers
    Mem: 231368 228412 2956 0 536
    Swap: 702456 6564 695892
    Total: 933824 234976 698848
    #

    Sent from my Droid using DroidForums App
  17. prime
    Offline

    prime Kernel Developer Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,845
    Likes Received:
    30
    Trophy Points:
    48
    Location:
    Florida
    What ROM and revision are you using, something is really wrong.
  18. Sparkimus
    Offline

    Sparkimus New Member

    Joined:
    Sep 5, 2010
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Calhoun, GA
    CM7 nightly 41. I wiped before flashing #26 and have been flashing on top of that since. I think maybe swapper 2 messed something and I need to do a fresh install of 41.

    Sent from my Droid using DroidForums App
  19. Sparkimus
    Offline

    Sparkimus New Member

    Joined:
    Sep 5, 2010
    Messages:
    190
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Calhoun, GA
    Other than the huge swap number everything seems fine.

    Sent from my Droid using DroidForums App
  20. prime
    Offline

    prime Kernel Developer Premium Member Developer

    Joined:
    Apr 26, 2010
    Messages:
    1,845
    Likes Received:
    30
    Trophy Points:
    48
    Location:
    Florida
    Change the % in cm performance/compcache settings to %10 and reboot, then check swap amount.

    *edit*
    I don't want to hijack this thread...I apologize to OP.
Search tags for this page
cm7 compcache ram usage
,
compcache android
,

compcache cm7

,
compcache cyanogen
,
compcache ram cm7
,
compcache ram usage
,
compcache ram usage android
,

compcache ram usage cm7

,
dalvik.vm.heapsize
,
enable swap cyanogenmod 7
,
high priority sd swap
,
swap cm7