page ins outs in activity monitor adjust to improve performance

Discussion in 'MacBook Pro' started by Sossity, May 22, 2011.

  1. Sossity macrumors 6502a

    Joined:
    May 12, 2010
    #1
    I read a thread here about someone who found their mac slow & they looked at activity monitor & there was something about adjusting the page in & outs to 0 to free up memory.

    I ask because today, Adobe InDesign crashed on me 2 times since I have been using it this semester. I notice it was getting a little slow & the fans would start to spin up more loudly & it became unresponsive.

    right now with InDesign running I have; VM size; 120.60 BG, page ins; 444.8 mb, page outs; 107 kb, & swap used 2.3mb.
     
  2. dusk007 macrumors 68040

    dusk007

    Joined:
    Dec 5, 2009
    #2
    There is nothing you can do and it doesn't look like any kind of memory problems. 107kb page outs means you probably just restarted your notebook and there is currently no shortage of memory.
    If the Page out/page in ratio becomes too high you need more memory. They used to say something above 25% is reason to upgrade. Today with cheap prices some do it sooner.

    My data with 4GB RAM is currently 186.53 VM, 50.35GB Page in, 1.7GB page out and 1.83GB swap used.
    All those numbers just keep increasing the longer your machine hasn't seen a restart and only the ratio counts. 0.107/444.8 is very far from any possible problem. You need to post the numbers aber running it for day with your use to get any meaningful data.
     
  3. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #3
    Incorrect. It has nothing to do with the ratio between pageins and pageouts. All pageouts are bad, so anything above 0 means you don't have enough memory. You are using 1.83GB of swap space, so you basically *need* 2GB more RAM to do whatever it is that you're doing right now. The OP is only using 2.3MB of swap space, which is nothing.
     
  4. mac00l macrumors 6502

    Joined:
    May 3, 2011
    #4
    No, the problem with using swap-used as a reference, is that it is deceiving time frame wise. He may had swap the 1.83GB in a month, so 1.83 in a month is like 59MB per day, which is almost nothing.

    By using pagesin as a reference, then you have another reference to compare to, and take a better decision, that's why the pagesin/pagesout ratio is used.
     
  5. GGJstudios, May 24, 2011
    Last edited: May 24, 2011

    GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #5
    This isn't true. Page outs are a natural occurrence when memory demands are high enough, which might only be infrequently. Page outs and swap used are cumulative numbers from the last restart, so the best way to determine if you need more RAM is to restart, which resets page outs and swap used to zero. Then, under normal use, check to see if significant paging is occurring. Unless page outs and swap used are significant with a normal workload, you don't need more RAM.
    Page ins have nothing to do with it. No ratio between page ins and page outs is meaningful. Page ins occur when you write anything from hard drive to memory, which is required to work on documents or do most things. There will always be page ins. There may not ever be page outs.

    Mac OS X: Reading system memory usage in Activity Monitor

    There is nothing for you to "adjust". The poster was wrong. Mac OS X manages memory quite well, without the need for user involvement.
     
  6. tamvly macrumors 6502a

    tamvly

    Joined:
    Nov 11, 2007
    #6
    Well said. Also, keep an eye on "free" memory, as that dynamically changes and indicates the current state of affairs.
     
  7. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #7
    Free and inactive memory are both available for use by running apps.
     
  8. mac00l macrumors 6502

    Joined:
    May 3, 2011
    #8
    It is, page in writes to memory, so if it gets full, it will temporarily write it to hard disk (page out). With the ratio you are checking how often your memory gets full and need to do page-out, if it is meaningful, then you need more ram.


    There is a way with "launchctl unload -w " instruction. But disabling swapping is dangerous for the machine, and not advised at all. So please don't.
     
  9. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #9
    The ratio of page ins to page outs is meaningless. Only the amount of page outs and swap used is meaningful in determining RAM needs. Page ins do not play a role in that determination.
    That's not an adjustment, as the OP indicated.
     
  10. mac00l macrumors 6502

    Joined:
    May 3, 2011
    #10
    I won't elaborate, but yes, the fastest and easiest way to know if you need more RAM, is with the ratio. It may have a standard deviation of +/-10% in accuracy, but is faster and easiest than rebooting, and using x or y software.

    FYI a change (enabling-disabling) is an adjustment, for better or worse, but it is.

    Cheers
     
  11. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #11
    You don't know what you're talking about. If you have page outs of 3GB under normal use, you likely need more RAM. It doesn't matter if your page ins are 8GB or 80GB. The ratio is NOT useful. You should learn how paging works, so you don't continue to post false and misleading information.
    That is NOT adjusting the page ins and page outs, as the OP stated:
    I can adjust the thermostat on my air conditioner, but that doesn't have anything to do with the OP's post, either, even though it's an adjustment.
     
  12. mac00l macrumors 6502

    Joined:
    May 3, 2011
    #12
    My god... the OP asked for a way to adjust page in & out to 0. By disabling the OS capacity to do any page in/out, then you are effectively adjusting it to zero 0, nada.

    And I know what page in/out are, I am really as hard as I can trying to make you understand how it actually works. You are just repeating what Apple support page says, which is not wrong, but is not deep enough info.

    It is just lineal math, we have 2 speeds, a fast one, and a slow one. If the slow one is kicking in just every once in a while, then there is no point to upgrade.

    Enough said, if you want to believe me or not is your choice, I just beg to everyone to research in a little deeper, and by any means not staying just with what GGJStudios and me are saying.

    Cheers.
     
  13. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #13
    I understand perfectly well how it works. You don't need to make me understand anything, especially with the misinformation you're posting.
    No, I'm repeating what is true, which is why the Apple support page agrees with my statements, and vice versa. It's more than sufficient information to answer the OP's question. the information you've been posting is false and misleading.
    That's more evidence that you have no idea what you're talking about. There aren't "2 speeds". You're not making sense.
    Given the choice between truthful facts and what you've been posting, I'll stick with the facts. The fact is that page ins have nothing to do with whether or not a user needs more RAM. Neither does any ratio between page ins and page outs.
     
  14. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #14
    No, swap used is how much of your hard drive you are using at this very moment to store running programs. That's not 59MB per day. That's 1.83GB right now. Quit open programs, and that number will go down.

    Yes, I oversimplified by saying all pageouts are bad, but ultimately, one page out is 4kB of RAM that was needed that was not available. Also, pageouts is different from swap used. The pageout count is cumulative, whereas swap used is not. If you have 1.83GB of swap used, you are shy nearly 2GB.

    If you want to watch this stuff in action, run "vm_stat 15" at the command line:

    Code:
    Mach Virtual Memory Statistics: (page size of 4096 bytes, cache hits 0%)
      free active   spec inactive   wire   faults     copy    0fill reactive  pageins  pageout
     85832 258265  22175    29120  63233 84070939  9230352 36166237   182546   413022   145605 
     73110 268977  22760    29437  64116   581159    51524   296799        0       49        0 
     61588 279779  23534    29432  64149   300220     4553   235313        0       19        0 
     62778 276060  24274    31335  64118   236235     2134   203884        0        2        0 
    
    and it keeps updating every fifteen seconds. The last column is pageouts. You can watch as your computer writes to disk when it runs out of memory. Anything other than 0 in that last column means you've run out of memory within that fifteen second time span; something that was open got written to disk, so when you need it next, it will have to be read back from the disk.


    The ratio between the two numbers is irrelevant. You may have run the machine for 30 days without ever having paged anything to disk. Then you fire up Parallels and absolutely everything gets paged to disk. Your ratio will be low, but you absolutely without a doubt need more RAM to do what you wanted to do.
     
  15. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #15
    All of this. :) Except swap the words "page outs" in the second sentence with "swap used". I agree that 3GB of pageouts spread over a month is not a really big deal, but it does still mean you don't have enough RAM, though 3GB swap used is a big deal.
     
  16. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #16
    Yes, page outs is cumulative, as is swap used, in the sense that the swapfile will grow as needed, but will not shrink by closing apps, even though it may not be used anymore, until a restart. Both numbers represent the page outs/maximum swap used since the last restart. Therefore, restarting will set them both back to zero, so the user can see what page outs and swapfile space is used under normal operating conditions.
     
  17. Detrius macrumors 68000

    Joined:
    Sep 10, 2008
    Location:
    Asheville, NC
    #17
    Swap used is not cumulative. It will shrink. Due to memory fragmentation, though, the amount of physical space used on the drive may not decrease, even though that actual amount logically used by the paging system has been decreased. The memory is split up in 4kB pages, and if there's still one of those in one of the 1GB swap files, the file won't be deleted. Whether you see the swap used decrease when you quit a program depends entirely on whether or not that specific program has any pages that have been swapped to disk, which very well may not be the case, since it's a program you're using.

    At the moment, I have 512MB of swap files on my disk (it's located at /var/vm). I've had 568MB of page outs since booting the machine yesterday, and I have 293MB of swap used. Therefore, necessarily, 275MB has been removed from my swap files.
     
  18. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #18
    No, the swap file doesn't reduce in size once it allocates space, until a reboot. You're misreading the numbers. You have 568MB of page outs since your last reboot, but that doesn't mean that all of that was paged out at the same time. Remember, it's a cumulative number. Your 293MB of swap used represents the peak swap file demand at one time. Your swap file didn't grow to 568MB, then shrink back down to 293MB. It never got above 293MB. You can test this yourself, as I have done. Once the swap file grows, it will not reduce until a restart.
     
  19. mac00l macrumors 6502

    Joined:
    May 3, 2011
    #19
    :p

    I really suggest you both to have a nice reading of this:
    http://developer.apple.com/library/...tual/ManagingMemory/Articles/AboutMemory.html

    and this:
    http://hints.macworld.com/article.php?story=20010613140025184


    Furthermore, most people use their computer in a regular basis, meaning that the ratio will hold true in the long run. If someone is using a Virtual Machine once a month (which wire x amount of predefined memory) and while doing so runs out of memory, then best solution is to close some software while running the virtualization, as upgrading RAM for just that 10 mins every month is not worth it money wise.

    As correctly said by Detrius Swap Used IS DYNAMIC, means that it shrinks when not in use, therefore making it hard to "catch" so to say. The easiest and most effective way to determine if you really need more physical memory, is by the ratio I've just said. Basically, because when you are working when your machine, you are not checking swap used every second, you check your computer at the end of the day.

    I'll attach you some pics from my activity monitor where I'm using all my memory, and using swap, and as you can check yourself in the pics, swap used goes up and down, while pages in/out keep going up and the only consistent way to have some sort of idea what went on, is by using the ratio which I've talked you about.

    Just take it as a tip, I do know what I'm talking about.

    Cheers.
     

    Attached Files:

  20. dusk007, May 25, 2011
    Last edited: May 25, 2011

    dusk007 macrumors 68040

    dusk007

    Joined:
    Dec 5, 2009
    #20
    @Detrius and GGJStudios what you are interpreting differently than me an Mac00I is what actuall means you "need" more memory. You act as though running out of memory is always bad and will affect performance but that is not necessarily the case. Usually stuff gets swapped that is not in dire need at the moment.
    Lets say I have 5 programs running (1 being Eclipse taking 550MB RAM) and am well with in my 4GB ram. Now I start up a VM to do some Windows stuff. The ram gets full. Because I only switch around between Opera and the VM the biggest and longest unused chunk is Eclipse. I just didn't close it because its startup initialization takes forever, but getting it back from Swap is faster than starting it with an SSD installed (and if I had an SSD I probably would hardly notice the difference).
    Now since I don't need my VM anymore I close it. Do some other stuff and than finally return to Eclipse and with some delay it is back to full speed.

    I did have page outs but that doesn't mean I really needed more RAM. Having 8 GB RAM would have gotten me nada in terms of performance. Just the delay when returning to the work I set back doesn't mean I need to shed out money for more RAM.
    Page Ins accumulate when stuff is loaded into RAM. If the app is closed it disappears from RAM and if it is loaded again there are more page Ins. That is how I got to 50 GB in a few weeks. Now I could have only kept open the apps I actually use and never gotten any page outs. But I didn't so there was one time where I got some bigger swap.
    Now if that happened more often my page outs would be way higher because it would have often had page ins following paged outs etc. . In relation to how much stuff I loaded into RAM I had very little page outs that tells me a meaning full number about my usage and if that usage requires more RAM.

    The relation therefore has some meaning.
    BTW you always get some little page outs. Even if you don't run out of memory. I guess it is just some very very rarely used data that moves out. I have 20mb page outs now but I restarted this morning and never got with my few apps beyond 3GB of used RAM. But you need to be smart enough to know if that amount of page outs mean anything or not. If the system runs for a while the relation can give a pretty good indication.
    In general you can also just open your usual apps load the data and see if RAM is close to full. Especially if it is one app that needs a big chunk and needs to partially page out or you always switch between apps where one needs to stay out of RAM you probably need more RAM.

    The Page-in/Page-out ratio can give you a good idea of your use and needs and it tells you enough after some runtime that one can quite safely assume the right answer. Page-out alone as well as swap might mean anything without looking at some other information too.
     
  21. GGJstudios macrumors Westmere

    GGJstudios

    Joined:
    May 16, 2008
    #21
    I have read that, and nowhere in either of those documents does it mention a ratio between page ins and page outs.
    The ratio never holds true, because page ins have no direct relation to page outs.
    No, it doesn't. The disk space used for swap will not decrease, once allocated, until a restart.
    False.
    Without time stamps, those images don't prove anything. There is no way to know the order in which they were taken.
    There IS no ratio! As said before, you can have page outs and swap used of the same amount, whether you have page ins of 8GB or 80GB.
    Your posts prove otherwise.
     
  22. mac00l macrumors 6502

    Joined:
    May 3, 2011
    #22
    Allright, enough is enough. You just proved you know nothing, and I'm sorry, but I won't keep on loosing my time with you.

    And here is a zip with the timestamps for everyone who wants to check if what I'm saying holds any true at all, you all can do it yourself quite quickly, just open a few programs, and then 100+ chrome tabs, and look your swap used skyrocketing, then just close chrome, and check how your swap used begins to go down.

    Cheers.
     

    Attached Files:

Share This Page