swapfile query
Hello list, (freebsd-current is r317212 on this machine) I have a machine with 128GB RAM. When 12-current was installed, for some reason the swap partition was set to 4GB. I see sometimes via top and also via daily status reports that sometimes the machine runs out of swap. It doesn't crash the machine though. I know how to add more swap with a swapfile. My questions are: 1. should I make more than one swapfile, say 4x32GB or will it be ok with one 128GB swapfile? 2. will the 4GB already there as swap play nice with a swapfile, or multiple swapfiles? Or should I deactivate the 4GB swap partition first? 3. should total swap be 1x 2x or some other multiple of RAM these days? FreeBSD and the swap partition reside on the same SSD. The swapfiles, if created, will reside on this SSD. thanks, -- J. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
In message <77fdd002-2873-eb67-c851-0127ae314...@zyxst.net>, tech-lists writes: > Hello list, > > (freebsd-current is r317212 on this machine) > > I have a machine with 128GB RAM. When 12-current was installed, for some > reason the swap partition was set to 4GB. I see sometimes via top and > also via daily status reports that sometimes the machine runs out of > swap. It doesn't crash the machine though. > > I know how to add more swap with a swapfile. My questions are: > > 1. should I make more than one swapfile, say 4x32GB or will it be ok > with one 128GB swapfile? It's better to spread the load across multiple spindles. > > 2. will the 4GB already there as swap play nice with a swapfile, or > multiple swapfiles? Or should I deactivate the 4GB swap partition first? Is the 4 GB on the same disk as another swapfile? > > 3. should total swap be 1x 2x or some other multiple of RAM these days? Depends. If you're running some kind of database server or OLTP application. Some vendors recommend no swap whatsoever while others recommend some. What does your application vendor recommend? > > FreeBSD and the swap partition reside on the same SSD. The swapfiles, if > created, will reside on this SSD. Then it doesn't matter if you use one or many swapfiles and deleting the 4 GB won't make a difference. Just add the desired swap as required. With 128 GB RAM you shouldn't be swapping anyway. If your system is you have more serious problems than the lack of swap. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
On 19/08/2017 17:54, Cy Schubert wrote: > Then it doesn't matter if you use one or many swapfiles and deleting the 4 > GB won't make a difference. Just add the desired swap as required. > > With 128 GB RAM you shouldn't be swapping anyway. If your system is you > have more serious problems than the lack of swap. The system is a bhyve host. There are 9 guests, two of them are freebsd-11-stable, the rest are ubuntu-14.04-LTS. Restarting some (but not all) of the guests has the effect of decreasing swap usage. The system also runs ZFS. The guests live on the ZFS filesystem. The OS & swap on the host are SSD and are not part of the ZFS system. What I'm seeing is, the host system won't touch swap for days. I guess when the guests get busier than an as yet unknown amount, the host starts using swap. The issue I'm having isn't so much it using swap, it's that the used swap seemingly is not liberated after it has been used, and I don't know exactly how to narrow it down. thanks, -- J. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
On 19 Aug 2017, at 17:54, Cy Schubert wrote: > >> 3. should total swap be 1x 2x or some other multiple of RAM these days? > > Depends. If you're running some kind of database server or OLTP > application. Some vendors recommend no swap whatsoever while others > recommend some. What does your application vendor recommend? The main advantage of swap these days (on machines with that sort of amount of RAM) is to allow you to keep some file-backed memory objects in memory in preference to leaked (or very cold) heap memory. David ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
In message , David Chisnall w rites: > On 19 Aug 2017, at 17:54, Cy Schubert wrote: > > > >> 3. should total swap be 1x 2x or some other multiple of RAM these days? > > > > Depends. If you're running some kind of database server or OLTP > > application. Some vendors recommend no swap whatsoever while others > > recommend some. What does your application vendor recommend? > > The main advantage of swap these days (on machines with that sort of amount o > f RAM) is to allow you to keep some file-backed memory objects in memory in p > reference to leaked (or very cold) heap memory. Memory overcommitment and the working set of each address space determines how much and what is paged out. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
In message , tech-lists writes: > On 19/08/2017 17:54, Cy Schubert wrote: > > Then it doesn't matter if you use one or many swapfiles and deleting the 4 > > GB won't make a difference. Just add the desired swap as required. > > > > With 128 GB RAM you shouldn't be swapping anyway. If your system is you > > have more serious problems than the lack of swap. > > The system is a bhyve host. There are 9 guests, two of them are > freebsd-11-stable, the rest are ubuntu-14.04-LTS. Restarting some (but > not all) of the guests has the effect of decreasing swap usage. The > system also runs ZFS. The guests live on the ZFS filesystem. > > The OS & swap on the host are SSD and are not part of the ZFS system. > > What I'm seeing is, the host system won't touch swap for days. I guess > when the guests get busier than an as yet unknown amount, the host > starts using swap. The issue I'm having isn't so much it using swap, > it's that the used swap seemingly is not liberated after it has been > used, and I don't know exactly how to narrow it down. An easy way to find out is to run top, type in "w", then "o" and "swap" to see which processes are using swap. You'll notice that the numbers won't add up. I haven't looked at this but my guess is that there may be swap leak. You can verify this by replacing the swapfile (add a new and remove the old). Run vmstat. If the system is actively paging you will see page outs and page ins, some page reclaims, and a scan rate in the hundreds. (On my -CURRENT laptop I see a scan rate in the hundreds on a totally idle laptop and in the teens of my idle firewall. IMO this doesn't seem right, at least not compared to previous releases of FreeBSD or from the days when I worked on Solaris. You shouldn't see a scan rate on an idle system.) My rule of thumb [was] scan rate less than 200 is good or to put it another way if you're using more than 5% of your system resources ( > 5% CPU or > 5% disk I/O) paging or swapping you need more RAM. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
In message <201708192100.v7jl0vfk003...@slippy.cwsent.com>, Cy Schubert writes: > (On my -CURRENT laptop I see a scan rate in the hundreds on a totally idle > laptop and in the teens of my idle firewall. IMO this doesn't seem right, > at least not compared to previous releases of FreeBSD or from the days when > I worked on Solaris. You shouldn't see a scan rate on an idle system.) It appears that on an idle system with many pages in use, i.e. a laptop running X and not really doing anything else, pages are scanned though the system is idle. This is likely an artifact of r308474. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
On Sat, Aug 19, 2017 at 02:24:19PM -0700, Cy Schubert wrote: > In message <201708192100.v7jl0vfk003...@slippy.cwsent.com>, Cy Schubert > writes: > > > (On my -CURRENT laptop I see a scan rate in the hundreds on a totally idle > > laptop and in the teens of my idle firewall. IMO this doesn't seem right, > > at least not compared to previous releases of FreeBSD or from the days when > > I worked on Solaris. You shouldn't see a scan rate on an idle system.) > > It appears that on an idle system with many pages in use, i.e. a laptop > running X and not really doing anything else, pages are scanned though the > system is idle. This is likely an artifact of r308474. It's an intentional consequence of r254304. The page daemon performs a slow and steady scan of the queue of active pages and will gradually move unreferenced pages to the inactive queue. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
In message <20170819213149.GA34140@raichu>, Mark Johnston writes: > On Sat, Aug 19, 2017 at 02:24:19PM -0700, Cy Schubert wrote: > > In message <201708192100.v7jl0vfk003...@slippy.cwsent.com>, Cy Schubert > > writes: > > > > > (On my -CURRENT laptop I see a scan rate in the hundreds on a totally idl > e > > > laptop and in the teens of my idle firewall. IMO this doesn't seem right, > > > > at least not compared to previous releases of FreeBSD or from the days wh > en > > > I worked on Solaris. You shouldn't see a scan rate on an idle system.) > > > > It appears that on an idle system with many pages in use, i.e. a laptop > > running X and not really doing anything else, pages are scanned though the > > system is idle. This is likely an artifact of r308474. > > It's an intentional consequence of r254304. The page daemon performs a > slow and steady scan of the queue of active pages and will gradually > move unreferenced pages to the inactive queue. This is certainly better. It's probably good idea to remove scan rate from vmstat output as it's not meaningful in the traditional sense any more. For example on a traditionally scanning VM system (Solaris or z/OS) the number of pages scanned per second (or unreferenced interval count -- the inverse of the scan rate) is the first indication that you need to look at your vm subsystem. As of r254304 rate cannot be used used as a metric any more except when one sees it deviate wildly from previous observations. (Not that I'm complaining.) See below: procs memory pagedisks faults cpu r b w avm fre flt re pi pofr sr ad0 da0 insycs us sy id 0 0 0 3.9G 292M 4 0 0 0 193 125 0 0 434 773 588 0 0 100 1 0 0 3.9G 292M55 0 0 0 181 123 22 0 460 2467 1402 0 1 99 0 0 0 3.9G 290M 969 0 0 1 316 124 1 0 490 12571 4004 3 1 95 0 0 0 3.9G 289M 261 0 0 0 160 124 21 0 505 20426 7751 2 2 97 0 0 0 1.5G 755M 3481 0 1 1 60951 74 18 0 463 19918 6576 13 4 82 At this point I closed firefox. Pages are freed and scan rate decreases. We now have a new normal. 0 0 0 1.5G 752M10 0 0 0 0 24 1 0 409 595 365 0 0 100 0 0 0 1.5G 754M 1 0 0 0 403 23 49 0 478 609 1321 0 1 99 0 0 0 1.5G 754M19 0 0 0 171 24 0 0 402 655 382 0 0 100 0 0 0 1.5G 754M 0 0 0 0 170 24 0 0 423 568 463 0 0 100 0 0 0 1.5G 754M 0 0 0 0 174 12 0 0 403 627 359 0 0 100 0 0 0 1.5G 754M 0 0 0 0 172 35 4 0 425 625 474 0 0 100 0 0 0 1.5G 754M 1 0 0 0 170 24 4 0 416 651 398 0 0 100 0 0 0 1.5G 754M 0 0 0 0 163 23 1 0 426 655 490 0 0 100 0 0 0 1.5G 754M 0 0 0 0 176 23 0 0 429 663 384 0 0 100 0 0 0 1.5G 754M 0 0 0 0 163 23 0 0 445 661 482 0 0 100 Should we consider removing scan rate from vmstat output? It doesn't really mean anything in relation to tuning any more. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
Re: swapfile query
On Saturday, 19 August 2017 at 16:00:28 +0100, tech-lists wrote: > Hello list, > > (freebsd-current is r317212 on this machine) > > I have a machine with 128GB RAM. When 12-current was installed, for some > reason the swap partition was set to 4GB. I see sometimes via top and > also via daily status reports that sometimes the machine runs out of > swap. It doesn't crash the machine though. > > I know how to add more swap with a swapfile. That's one way. It's really better to use a swap partition. If you repartition the SSD for whatever reason, you should consider creating a larger swap partition. > 1. should I make more than one swapfile, say 4x32GB or will it be ok > with one 128GB swapfile? It doesn't make any difference, but 128 GB seems excessive. You might like to try with one 32 GB swap file and see if that's enough. On my machine I have 32 GB of memory and 10 GB swap, and I don't have much of a problem with that. > 2. will the 4GB already there as swap play nice with a swapfile, or > multiple swapfiles? Or should I deactivate the 4GB swap partition > first? Yes. > 3. should total swap be 1x 2x or some other multiple of RAM these days? It never needed to be. The only issue is that if you want processor dumps, you once needed a swap partition (and not a swap file) at least marginally larger than memory. With compressed dumps, that requirement is relaxed, but I suspect that a 4 GB partition could be too small. Greg -- Sent from my desktop computer. Finger g...@freebsd.org for PGP public key. See complete headers for address and phone numbers. This message is digitally signed. If your Microsoft mail program reports problems, please read http://lemis.com/broken-MUA signature.asc Description: PGP signature