Re: Using mdconfig for swap space
On Wed, Sep 09, 2009 at 04:46:56PM +0100, Daniel Bye wrote: > On Wed, Sep 09, 2009 at 10:59:23AM -0400, Jerry McAllister wrote: > > On Wed, Sep 09, 2009 at 11:57:07AM +0100, Daniel Bye wrote: > > > > > On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote: > > > > On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: > > > > > > > > > Are there any advantages to using mdconfig and creating a virtual > > > > > disk for swap space as opposed to having a designated swap partition? > > > > > For example, I could do something like this: > > > > > > > > Unless I am missing something basic here, it seems like a bad idea to > > > > me - to carve out and use up some memory to use as extra storage for > > > > processes that need more memory that you have taken away to give to > > > > swap. > > > > That is self defeating. > > > > > > > > In addition, one use of swap is to write dumps to if there is a crash. > > > > If you put it in memory, it is gone when you reboot. > > > > > > He's talking about using a swap file, rather than a dedicated partition > > > on > > > the disk, not in RAM! Although it is slightly slower, as Chuck has > > > already > > > pointed out, it might, in certain circumstances, be a somewhat more > > > convenient solution than repartitioning/reinstalling the whole system. > > > > > > And as RW has said, the facility already exists and can be enabled with a > > > couple of knobs in /etc/rc.conf. > > > > I understand using a file and making it in to swapspace. I have used that > > a couple of times when I needed to add some swap space temporarily. But > > isn't the command he is trying to use (mdconfig) for creating a memory > > filesystem - eg use a chunk of memory and make a file from it (then use it > > for swap or whatever)?That is in RAM. > > No, with the -t vnode and -f options, he'd actually be creating > a file-backed memory disk. The terminology can be a little confusing, but > in this instance the file wouldn't be loaded into RAM, but would instead > be treated as any other disk-like device. It's exactly the same approach > as used by /etc/rc.d/addswap, which gets its configuration from $swapfile > set in /etc/rc.conf. I see that now, but it seems like the long way around to get to what you get with a swapon. Oh well. jerry > > Dan > > -- > Daniel Bye > _ > ASCII ribbon campaign ( ) > - against HTML, vCards and X > - proprietary attachments in e-mail / \ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
On Wed, Sep 09, 2009 at 11:23:14AM -0400, Lowell Gilbert wrote: > Jerry McAllister writes: > > > On Wed, Sep 09, 2009 at 11:57:07AM +0100, Daniel Bye wrote: > > > >> On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote: > >> > On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: > >> > > >> > > Are there any advantages to using mdconfig and creating a virtual disk > >> > > for swap space as opposed to having a designated swap partition? For > >> > > example, I could do something like this: > >> > > >> > Unless I am missing something basic here, it seems like a bad idea to > >> > me - to carve out and use up some memory to use as extra storage for > >> > processes that need more memory that you have taken away to give to > >> > swap. > >> > That is self defeating. > >> > > >> > In addition, one use of swap is to write dumps to if there is a crash. > >> > If you put it in memory, it is gone when you reboot. > >> > >> He's talking about using a swap file, rather than a dedicated partition on > >> the disk, not in RAM! Although it is slightly slower, as Chuck has already > >> pointed out, it might, in certain circumstances, be a somewhat more > >> convenient solution than repartitioning/reinstalling the whole system. > >> > >> And as RW has said, the facility already exists and can be enabled with a > >> couple of knobs in /etc/rc.conf. > > > > I understand using a file and making it in to swapspace. I have used that > > a couple of times when I needed to add some swap space temporarily. But > > isn't the command he is trying to use (mdconfig) for creating a memory > > filesystem - eg use a chunk of memory and make a file from it (then use it > > for swap or whatever)?That is in RAM. > > Not necessarily. What he wants is the '-t vnode' option for mdconfig(8). Hmmm. Haven't dealt with that before. Still seems like either a regular file or a dedicated partition would be best. jerry > > -- > Lowell Gilbert, embedded/networking software engineer, Boston area > http://be-well.ilk.org/~lowell/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
On Wed, Sep 09, 2009 at 10:59:23AM -0400, Jerry McAllister wrote: > On Wed, Sep 09, 2009 at 11:57:07AM +0100, Daniel Bye wrote: > > > On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote: > > > On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: > > > > > > > Are there any advantages to using mdconfig and creating a virtual disk > > > > for swap space as opposed to having a designated swap partition? For > > > > example, I could do something like this: > > > > > > Unless I am missing something basic here, it seems like a bad idea to > > > me - to carve out and use up some memory to use as extra storage for > > > processes that need more memory that you have taken away to give to swap. > > > > > > That is self defeating. > > > > > > In addition, one use of swap is to write dumps to if there is a crash. > > > If you put it in memory, it is gone when you reboot. > > > > He's talking about using a swap file, rather than a dedicated partition on > > the disk, not in RAM! Although it is slightly slower, as Chuck has already > > pointed out, it might, in certain circumstances, be a somewhat more > > convenient solution than repartitioning/reinstalling the whole system. > > > > And as RW has said, the facility already exists and can be enabled with a > > couple of knobs in /etc/rc.conf. > > I understand using a file and making it in to swapspace. I have used that > a couple of times when I needed to add some swap space temporarily. But > isn't the command he is trying to use (mdconfig) for creating a memory > filesystem - eg use a chunk of memory and make a file from it (then use it > for swap or whatever)?That is in RAM. No, with the -t vnode and -f options, he'd actually be creating a file-backed memory disk. The terminology can be a little confusing, but in this instance the file wouldn't be loaded into RAM, but would instead be treated as any other disk-like device. It's exactly the same approach as used by /etc/rc.d/addswap, which gets its configuration from $swapfile set in /etc/rc.conf. Dan -- Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ pgpucoDWr6Wwu.pgp Description: PGP signature
RE: Using mdconfig for swap space
>It's easy to *try* the swap files. Then measure the performance. >If the behaviour is really as specific to your custom application as you >indicate, then general advice may not apply either. In fact, after discussing this with the team, we are going to do exactly that. We'll allocate an extra 8GB of swap space through an image file and let QA run their stress tests to see how things behave. That's the only way to know for sure if this will work for us. Thanks for the feedback. Peter ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
Jerry McAllister writes: > On Wed, Sep 09, 2009 at 11:57:07AM +0100, Daniel Bye wrote: > >> On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote: >> > On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: >> > >> > > Are there any advantages to using mdconfig and creating a virtual disk >> > > for swap space as opposed to having a designated swap partition? For >> > > example, I could do something like this: >> > >> > Unless I am missing something basic here, it seems like a bad idea to >> > me - to carve out and use up some memory to use as extra storage for >> > processes that need more memory that you have taken away to give to swap. >> > That is self defeating. >> > >> > In addition, one use of swap is to write dumps to if there is a crash. >> > If you put it in memory, it is gone when you reboot. >> >> He's talking about using a swap file, rather than a dedicated partition on >> the disk, not in RAM! Although it is slightly slower, as Chuck has already >> pointed out, it might, in certain circumstances, be a somewhat more >> convenient solution than repartitioning/reinstalling the whole system. >> >> And as RW has said, the facility already exists and can be enabled with a >> couple of knobs in /etc/rc.conf. > > I understand using a file and making it in to swapspace. I have used that > a couple of times when I needed to add some swap space temporarily. But > isn't the command he is trying to use (mdconfig) for creating a memory > filesystem - eg use a chunk of memory and make a file from it (then use it > for swap or whatever)?That is in RAM. Not necessarily. What he wants is the '-t vnode' option for mdconfig(8). -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
Peter Steele wrote: > Thanks for the responses. The reason I'm looking at doing this is > that we have increased memory on our platform from 4GB to 8GB and > therefore have to increase swap space from 8GB to 16GB. We have > enough space in our /var partition that we could add a swap file > there and not have to touch the existing partition layout. I like the > simplicity of the swap file approach, but we have an application that > is very sensitive to I/O performance and I'm a little wary what this > could mean. QA I know would have a field day in trying to pound the > system with all sorts of stress tests. I think a dedicated swap > partition is probably a safer option. Nowadays having swap twice as RAM is not necessary. If your system wasn't swapping much in the past you can safely stay with 4G in my opinion... extending it to 16G would be waste of space :) -- regards, Maciej Suszko. signature.asc Description: PGP signature
Re: Using mdconfig for swap space
Peter Steele writes: >>Nowadays having swap twice as RAM is not necessary. If your system >>wasn't swapping much in the past you can safely stay with 4G in my >>opinion... extending it to 16G would be waste of space :) > > I won't bore you with the details but in fact our application *does* > require this much swap space, but not for the typical reasons. It's a > side effect of how our application works and we thought we could make > use of an image file for the extra swap rather than repartitioning, > but I've read too many warnings against going this route so I've > decided to stick with increasing the size of the swap partition. It's easy to *try* the swap files. Then measure the performance. If the behaviour is really as specific to your custom application as you indicate, then general advice may not apply either. -- Lowell Gilbert, embedded/networking software engineer, Boston area http://be-well.ilk.org/~lowell/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
On Wed, Sep 09, 2009 at 11:57:07AM +0100, Daniel Bye wrote: > On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote: > > On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: > > > > > Are there any advantages to using mdconfig and creating a virtual disk > > > for swap space as opposed to having a designated swap partition? For > > > example, I could do something like this: > > > > Unless I am missing something basic here, it seems like a bad idea to > > me - to carve out and use up some memory to use as extra storage for > > processes that need more memory that you have taken away to give to swap. > > That is self defeating. > > > > In addition, one use of swap is to write dumps to if there is a crash. > > If you put it in memory, it is gone when you reboot. > > He's talking about using a swap file, rather than a dedicated partition on > the disk, not in RAM! Although it is slightly slower, as Chuck has already > pointed out, it might, in certain circumstances, be a somewhat more > convenient solution than repartitioning/reinstalling the whole system. > > And as RW has said, the facility already exists and can be enabled with a > couple of knobs in /etc/rc.conf. I understand using a file and making it in to swapspace. I have used that a couple of times when I needed to add some swap space temporarily. But isn't the command he is trying to use (mdconfig) for creating a memory filesystem - eg use a chunk of memory and make a file from it (then use it for swap or whatever)?That is in RAM. jerry > > Dan > > -- > Daniel Bye > _ > ASCII ribbon campaign ( ) > - against HTML, vCards and X > - proprietary attachments in e-mail / \ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
RE: Using mdconfig for swap space
>Nowadays having swap twice as RAM is not necessary. If your system wasn't >swapping much in the past you can safely stay with 4G in my opinion... >extending it to 16G >would be waste of space :) I won't bore you with the details but in fact our application *does* require this much swap space, but not for the typical reasons. It's a side effect of how our application works and we thought we could make use of an image file for the extra swap rather than repartitioning, but I've read too many warnings against going this route so I've decided to stick with increasing the size of the swap partition. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
On Wednesday 09 September 2009 15:07:37 Peter Steele wrote: > Thanks for the responses. The reason I'm looking at doing this is that we > have increased memory on our platform from 4GB to 8GB and therefore have to > increase swap space from 8GB to 16GB. No you don't. It's advised, but not mandatory. > We have enough space in our /var > partition that we could add a swap file there and not have to touch the > existing partition layout. I like the simplicity of the swap file approach, > but we have an application that is very sensitive to I/O performance and > I'm a little wary what this could mean. QA I know would have a field day in > trying to pound the system with all sorts of stress tests. I think a > dedicated swap partition is probably a safer option. Any I/O bound application suffers from any kind of swap. You would do better to first establish how this application suffers once you start swapping. If your machine needs more then or even close to 8GB of swap, I doubt the applications are responsive to begin with. With 8GB of memory, it's probably better to have 2GB of swap, so that offending applications are killed off sooner and the machine is able to recover sooner. But - I'm assuming this is a server, for a multimedia machine - editing large images or videos - more swap is beneficial as inactive images/videos can be swapped out. -- Mel ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
RE: Using mdconfig for swap space
Thanks for the responses. The reason I'm looking at doing this is that we have increased memory on our platform from 4GB to 8GB and therefore have to increase swap space from 8GB to 16GB. We have enough space in our /var partition that we could add a swap file there and not have to touch the existing partition layout. I like the simplicity of the swap file approach, but we have an application that is very sensitive to I/O performance and I'm a little wary what this could mean. QA I know would have a field day in trying to pound the system with all sorts of stress tests. I think a dedicated swap partition is probably a safer option. Peter -Original Message- From: owner-freebsd-questi...@freebsd.org [mailto:owner-freebsd-questi...@freebsd.org] On Behalf Of Daniel Bye Sent: Wednesday, September 09, 2009 3:57 AM To: 'freebsd-questions@freebsd.org' Subject: Re: Using mdconfig for swap space On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote: > On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: > > > Are there any advantages to using mdconfig and creating a virtual disk for > > swap space as opposed to having a designated swap partition? For example, I > > could do something like this: > > Unless I am missing something basic here, it seems like a bad idea to > me - to carve out and use up some memory to use as extra storage for > processes that need more memory that you have taken away to give to swap. > That is self defeating. > > In addition, one use of swap is to write dumps to if there is a crash. > If you put it in memory, it is gone when you reboot. He's talking about using a swap file, rather than a dedicated partition on the disk, not in RAM! Although it is slightly slower, as Chuck has already pointed out, it might, in certain circumstances, be a somewhat more convenient solution than repartitioning/reinstalling the whole system. And as RW has said, the facility already exists and can be enabled with a couple of knobs in /etc/rc.conf. Dan -- Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
On Tue, Sep 08, 2009 at 07:52:59PM -0400, Jerry McAllister wrote: > On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: > > > Are there any advantages to using mdconfig and creating a virtual disk for > > swap space as opposed to having a designated swap partition? For example, I > > could do something like this: > > Unless I am missing something basic here, it seems like a bad idea to > me - to carve out and use up some memory to use as extra storage for > processes that need more memory that you have taken away to give to swap. > That is self defeating. > > In addition, one use of swap is to write dumps to if there is a crash. > If you put it in memory, it is gone when you reboot. He's talking about using a swap file, rather than a dedicated partition on the disk, not in RAM! Although it is slightly slower, as Chuck has already pointed out, it might, in certain circumstances, be a somewhat more convenient solution than repartitioning/reinstalling the whole system. And as RW has said, the facility already exists and can be enabled with a couple of knobs in /etc/rc.conf. Dan -- Daniel Bye _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ pgpMvbL6kGGlc.pgp Description: PGP signature
Re: Using mdconfig for swap space
On Tue, 8 Sep 2009 16:51:20 -0500 Peter Steele wrote: > Are there any advantages to using mdconfig and creating a virtual > disk for swap space as opposed to having a designated swap partition? > For example, I could do something like this: > > mdconfig -a -t swap -f /var/swap0 -s 4g > swapon -a /dev/md0 FWIW that's already supported by adding swapfile="/var/swap0" to rc.conf Your arguments are wrong BTW "-t swap" creates a device *backed* by swap. And the size comes from the size of the supplied file - which you typically create with dd. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
On Tue, Sep 08, 2009 at 04:51:20PM -0500, Peter Steele wrote: > Are there any advantages to using mdconfig and creating a virtual disk for > swap space as opposed to having a designated swap partition? For example, I > could do something like this: Unless I am missing something basic here, it seems like a bad idea to me - to carve out and use up some memory to use as extra storage for processes that need more memory that you have taken away to give to swap. That is self defeating. In addition, one use of swap is to write dumps to if there is a crash. If you put it in memory, it is gone when you reboot. jerry > > mdconfig -a -t swap -f /var/swap0 -s 4g > swapon -a /dev/md0 > > to add 4G to the system swap space backed by the file /var/swap0. How would > this compare to repartitioning my hard drive and adding a new 4GB swap > partition? > > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org" > ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
On Tue, Sep 8, 2009 at 4:51 PM, Peter Steele wrote: > Are there any advantages to using mdconfig and creating a virtual disk for > swap space as opposed to having a designated swap partition? For example, I > could do something like this: > > mdconfig -a -t swap -f /var/swap0 -s 4g > swapon -a /dev/md0 > > to add 4G to the system swap space backed by the file /var/swap0. How would > this compare to repartitioning my hard drive and adding a new 4GB swap > partition? > > In general, this is not a good idea. Your system will ideally not use swap space at all, and if it's using it a lot then it could sure use the extra ram consumed by the md drive instead of in swap. Most likely to slow your system down, not speed it up. If you're going to do anything, it's best to keep swap on a separate disk, or on the outer part of disk. -- Adam Vande More ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: Using mdconfig for swap space
Hi, Peter-- On Sep 8, 2009, at 2:51 PM, Peter Steele wrote: Are there any advantages to using mdconfig and creating a virtual disk for swap space as opposed to having a designated swap partition? For example, I could do something like this: mdconfig -a -t swap -f /var/swap0 -s 4g swapon -a /dev/md0 to add 4G to the system swap space backed by the file /var/swap0. How would this compare to repartitioning my hard drive and adding a new 4GB swap partition? First, using -f means using -t vnode. Secondly, swapping directly to a swap partition is mildly faster than having to navigate through the filesystem layers to do swapfile based swapping. Other platforms have chosen to go with the dynamically created and deleted swapfiles (under /var/vm/swapfile0, 1, etc for example) to allow the system to adjust the amount of disk used for swapspace dynamically. With disk space costing a matter of a few cents per gigabyte nowadays, setting up a dedicated swap partition and just letting it do it's thing is much easier than trying to fiddle around with alternatives, IMHO, but you're welcome to experiment and see whether you end up with something which is actually better for your circumstances Regards, -- -Chuck ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"