If I want to reduce the I/O accesses for example to SSD media on a laptop and I don''t plan to run any big applications is it safe to delete the swap file ? How do I configure opensolairs to run without swap ? I''ve tried ''swap -d /dev/zvol/dsk/rpool/swap'' but ''swap -s'' still shows the same amount of memory allocated. What happens with the /tmp file system when there is no swap device? I suppose it could fill up the RAM and cause a crash if not limited. Is there any other potential problem in running without swap? Any suggestion would be appreciated Thanks, -- This message posted from opensolaris.org
Brandon High
2010-May-08 15:57 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On Thu, Apr 22, 2010 at 11:59 AM, Karl Dalen <k_dal2 at hotmail.com> wrote:> If I want to reduce the I/O accesses for example to SSD media on a laptop > and I don''t plan to run any big applications is it safe to delete the swap file ?When installing on a small drive (eg: 8GB thumb drive), the installer doesn''t create a swap or dump volume. I imagine it''s OK to do, but if the system needs to page, you''ll get out of memory errors.> How do I configure opensolairs to run without swap ?Remove the line from /etc/vfstab and reboot. -B -- Brandon High : bhigh at freaks.com
Richard Elling
2010-May-08 16:41 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On May 8, 2010, at 8:57 AM, Brandon High wrote:> On Thu, Apr 22, 2010 at 11:59 AM, Karl Dalen <k_dal2 at hotmail.com> wrote: >> If I want to reduce the I/O accesses for example to SSD media on a laptop >> and I don''t plan to run any big applications is it safe to delete the swap file ? > > When installing on a small drive (eg: 8GB thumb drive), the installer > doesn''t create a swap or dump volume. > > I imagine it''s OK to do, but if the system needs to page, you''ll get > out of memory errors.Duh :-) Same thing happens when you run out of swap space and memory.>> How do I configure opensolairs to run without swap ? > > Remove the line from /etc/vfstab and reboot.No need to reboot. Just edit the /etc/vfstab and use "swap -d" to remove the swap device. -- richard -- ZFS storage and performance consulting at http://www.RichardElling.com
Edward Ned Harvey
2010-May-08 21:40 UTC
[zfs-discuss] Is it safe to disable the swap partition?
> From: zfs-discuss-bounces at opensolaris.org [mailto:zfs-discuss- > bounces at opensolaris.org] On Behalf Of Karl Dalen > > If I want to reduce the I/O accesses for example to SSD media on a > laptop > and I don''t plan to run any big applications is it safe to delete the > swap file ? > > How do I configure opensolairs to run without swap ? > I''ve tried ''swap -d /dev/zvol/dsk/rpool/swap'' > but ''swap -s'' still shows the same amount of memory > allocated. > > What happens with the /tmp file system when there is no swap device? > I suppose it could fill up the RAM and cause a crash if not limited. > Is there any other potential problem in running without swap?I don''t know if it''s safe to disable swap or not, but I know you shouldn''t do it, unless you have some unusual requirement. There is a common misconception out there, that using swap hurts performance. This is true if some app consumes more RAM than the system has, but that''s the only situation where it''s true. A vast majority of the time, the opposite is true. Most of the time, having swap available increases performance. Because the kernel is able to choose: "Should I swap out this idle process, or should I dump files out of cache?" With swap enabled, the kernel is given another degree of freedom, to choose which is colder: idle process memory, or cold cached files.
Bob Friesenhahn
2010-May-08 22:51 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On Sat, 8 May 2010, Edward Ned Harvey wrote:> > A vast majority of the time, the opposite is true. Most of the time, having > swap available increases performance. Because the kernel is able to choose: > "Should I swap out this idle process, or should I dump files out of cache?" > With swap enabled, the kernel is given another degree of freedom, to choose > which is colder: idle process memory, or cold cached files.Are you sure about this? It is always good to be sure ... -- Bob Friesenhahn bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Brandon High
2010-May-09 03:25 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On Sat, May 8, 2010 at 9:41 AM, Richard Elling <richard.elling at gmail.com> wrote:>> Remove the line from /etc/vfstab and reboot. > > No need to reboot. ?Just edit the /etc/vfstab and use "swap -d" > to remove the swap device.I tried that on a VBox instance and it failed to remove the swap. I guess only reboot id swap -d doesn''t work. -B -- Brandon High : bhigh at freaks.com
Roy Sigurd Karlsbakk
2010-May-09 13:30 UTC
[zfs-discuss] Is it safe to disable the swap partition?
----- "Bob Friesenhahn" <bfriesen at simple.dallas.tx.us> skrev:> On Sat, 8 May 2010, Edward Ned Harvey wrote: > > > > A vast majority of the time, the opposite is true. Most of the > time, having > > swap available increases performance. Because the kernel is able to > choose: > > "Should I swap out this idle process, or should I dump files out of > cache?" > > With swap enabled, the kernel is given another degree of freedom, to > choose > > which is colder: idle process memory, or cold cached files. > > Are you sure about this? It is always good to be sure ...This is the case with most OSes now. Swap out stuff early, perhaps keep it in RAM and swap at the same time, and the kernel can choose what to do later. In Linux you can set it in /proc/sys/vm/swappiness. Anyone that knows how this is tuned in osol, btw? Best regards roy -- Roy Sigurd Karlsbakk (+47) 97542685 roy at karlsbakk.net http://blogg.karlsbakk.net/ -- I all pedagogikk er det essensielt at pensum presenteres intelligibelt. Det er et element?rt imperativ for alle pedagoger ? unng? eksessiv anvendelse av idiomer med fremmed opprinnelse. I de fleste tilfeller eksisterer adekvate og relevante synonymer p? norsk.
Edward Ned Harvey
2010-May-09 14:26 UTC
[zfs-discuss] Is it safe to disable the swap partition?
> From: Bob Friesenhahn [mailto:bfriesen at simple.dallas.tx.us] > > On Sat, 8 May 2010, Edward Ned Harvey wrote: > > > > A vast majority of the time, the opposite is true. Most of the time, > having > > swap available increases performance. Because the kernel is able to > choose: > > "Should I swap out this idle process, or should I dump files out of > cache?" > > With swap enabled, the kernel is given another degree of freedom, to > choose > > which is colder: idle process memory, or cold cached files. > > Are you sure about this? It is always good to be sure ...Hehheheeh ... I am sure of it in Linux. I am only assuming solaris/opensolaris are as good. So I could be wrong. ;-)
Edward Ned Harvey
2010-May-09 14:40 UTC
[zfs-discuss] Is it safe to disable the swap partition?
> From: Bob Friesenhahn [mailto:bfriesen at simple.dallas.tx.us] > > On Sat, 8 May 2010, Edward Ned Harvey wrote: > > > > A vast majority of the time, the opposite is true. Most of the time, > having > > swap available increases performance. Because the kernel is able to > choose: > > "Should I swap out this idle process, or should I dump files out of > cache?" > > With swap enabled, the kernel is given another degree of freedom, to > choose > > which is colder: idle process memory, or cold cached files. > > Are you sure about this? It is always good to be sure ...This is the easiest way I know to show this in Linux: After the machine has been on, and doing things for a while (maybe hours, maybe days) run top or free. It is natural for the "free" to decrease to near-zero, while the buffers and cached climb to huge numbers. The buffers and cache are memory allocated to the kernel. It is also normal to see plenty of free, plenty of buffers and cache, and then see the swap usage increase to something nonzero. This is evidence that the Linux kernel is sometimes choosing to swap out idle processes, instead of dropping the buffers or cache usage. I don''t really know how to do the same in solaris/opensolaris, but I haven''t tried either. I only know that top doesn''t show the same info in solaris 10. And then I moved on.
Bob Friesenhahn
2010-May-09 16:23 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On Sun, 9 May 2010, Roy Sigurd Karlsbakk wrote:>> >> Are you sure about this? It is always good to be sure ... > > This is the case with most OSes now. Swap out stuff early, perhaps > keep it in RAM and swap at the same time, and the kernel can choose > what to do later. In Linux you can set it in > /proc/sys/vm/swappiness. > > Anyone that knows how this is tuned in osol, btw?While this is the zfs-discuss list, usually we are talking about Solaris/OpenSolaris here rather than "most OSes". No? Bob -- Bob Friesenhahn bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Richard Elling
2010-May-09 18:33 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On May 9, 2010, at 6:30 AM, Roy Sigurd Karlsbakk wrote:> ----- "Bob Friesenhahn" <bfriesen at simple.dallas.tx.us> skrev: > >> On Sat, 8 May 2010, Edward Ned Harvey wrote: >>> >>> A vast majority of the time, the opposite is true. Most of the >> time, having >>> swap available increases performance. Because the kernel is able to >> choose: >>> "Should I swap out this idle process, or should I dump files out of >> cache?" >>> With swap enabled, the kernel is given another degree of freedom, to >> choose >>> which is colder: idle process memory, or cold cached files. >> >> Are you sure about this? It is always good to be sure ... > > This is the case with most OSes now. Swap out stuff early, perhaps keep it in RAM and swap at the same time, and the kernel can choose what to do later. In Linux you can set it in /proc/sys/vm/swappiness. > > Anyone that knows how this is tuned in osol, btw?This is a better question for perf-discuss. For a storage server, swap is not needed. If you notice swap being used then your storage server is undersized. -- richard -- ZFS storage and performance consulting at http://www.RichardElling.com
I know that according to the documentation Solaris is supposed to be fully operational in the absences of swap devices. However, I''ve experienced cases which I have not been able to trace the root cause of yet where the disk access has increased drastically and caused the system to hang but it may be more of a performance issue. One concern is that I have applications that create a lot of /tmp files and they may end up consuming all RAM. I assume /tmp files cannot be swapped out to give room for new processes without a swap device so the malloc failures in the applications will come much sooner. I wonder if cached files or process pages have the highest priority of not being swapped out in the Solaris swap policy? /Karl D -- This message posted from opensolaris.org
Edward Ned Harvey
2010-May-10 00:40 UTC
[zfs-discuss] Is it safe to disable the swap partition?
> From: zfs-discuss-bounces at opensolaris.org [mailto:zfs-discuss- > bounces at opensolaris.org] On Behalf Of Richard Elling > > For a storage server, swap is not needed. If you notice swap being used > then your storage server is undersized.Indeed, I have two solaris 10 fileservers that have uptime in the range of a few months. I just checked swap usage, and they''re both zero. So, Bob, rub it in if you wish. ;-) I was wrong. I knew the behavior in Linux, which Roy seconded as "most OSes," and apparently we both assumed the same here, but that was wrong. I don''t know if solaris and opensolaris both have the same swap behavior. I don''t know if there''s *ever* a situation where solaris/opensolaris would swap idle processes. But there''s at least evidence that my two servers have not, or do not.
On Sun, May 9, 2010 at 7:40 PM, Edward Ned Harvey <solaris2 at nedharvey.com> wrote:> > > From: zfs-discuss-bounces at opensolaris.org [mailto:zfs-discuss- > > bounces at opensolaris.org] On Behalf Of Richard Elling > > > > For a storage server, swap is not needed. If you notice swap being used > > then your storage server is undersized. > > Indeed, I have two solaris 10 fileservers that have uptime in the range of a > few months. ?I just checked swap usage, and they''re both zero. > > So, Bob, rub it in if you wish. ?;-) ?I was wrong. ?I knew the behavior in > Linux, which Roy seconded as "most OSes," and apparently we both assumed the > same here, but that was wrong. ?I don''t know if solaris and opensolaris both > have the same swap behavior. ?I don''t know if there''s *ever* a situation > where solaris/opensolaris would swap idle processes. ?But there''s at least > evidence that my two servers have not, or do not.If Solaris is under memory pressure, pages may be paged to swap. Under severe memory pressure, entire processes may be swapped. This will happen after freeing up the memory used for file system buffers, ARC, etc. If the processes never page in the pages that have been paged out (or the processes that have been swapped out are never scheduled) then those pages will not consume RAM. The best thing to do with processes that can be swapped out forever is to not run them. -- Mike Gerdts http://mgerdts.blogspot.com/
Daniel Carosone
2010-May-10 02:53 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On Sun, May 09, 2010 at 09:24:38PM -0500, Mike Gerdts wrote:> The best thing to do with processes that can be swapped out forever is > to not run them.Agreed, however: #1 Shorter values of "forever" (like, say, "daily") may still be useful. #2 This relies on knowing in advance what these processes will be. #3 Where are the JeOS builds without all the gnome-infested likely suspects? -- Dan. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 194 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20100510/66c6f153/attachment.bin>
Bob Friesenhahn
2010-May-10 03:58 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On Sun, 9 May 2010, Edward Ned Harvey wrote:> > So, Bob, rub it in if you wish. ;-) I was wrong. I knew the behavior in > Linux, which Roy seconded as "most OSes," and apparently we both assumed the > same here, but that was wrong. I don''t know if solaris and opensolaris both > have the same swap behavior. I don''t know if there''s *ever* a situation > where solaris/opensolaris would swap idle processes. But there''s at least > evidence that my two servers have not, or do not.Solaris and Linux are different in many ways since they are completely different operating systems. Solaris 2.X has never swapped processes. It only sends dirty pages to the paging device if there is a shortage of pages when more are requested, or if there are not enough free, but first it will purge seldom accessed read-only pages which can easily be restored. Zfs has changed things up again by not caching file data via the "unified page cache" and using a specialized ARC instead. It seems that simple paging and MMU control was found not to be smart enough. Bob -- Bob Friesenhahn bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Thomas Tornblom
2010-May-10 07:28 UTC
[zfs-discuss] Is it safe to disable the swap partition?
2010-05-10 05:58, Bob Friesenhahn skrev:> On Sun, 9 May 2010, Edward Ned Harvey wrote: >> >> So, Bob, rub it in if you wish. ;-) I was wrong. I knew the behavior in >> Linux, which Roy seconded as "most OSes," and apparently we both >> assumed the >> same here, but that was wrong. I don''t know if solaris and opensolaris >> both >> have the same swap behavior. I don''t know if there''s *ever* a situation >> where solaris/opensolaris would swap idle processes. But there''s at least >> evidence that my two servers have not, or do not. > > Solaris and Linux are different in many ways since they are completely > different operating systems. Solaris 2.X has never swapped processes. It > only sends dirty pages to the paging device if there is a shortage of > pages when more are requested, or if there are not enough free, but > first it will purge seldom accessed read-only pages which can easily be > restored. Zfs has changed things up again by not caching file data via > the "unified page cache" and using a specialized ARC instead. It seems > that simple paging and MMU control was found not to be smart enough. > > BobSorry, but this is incorrect. Solaris (2 if you will) does indeed swap processes in case normal paging is deemed insufficient. See the chapters on Soft and Hard swapping in: http://books.google.com/books?id=r_cecYD4AKkC&pg=PA189&lpg=PA189&dq=solaris+internals+swapping&source=bl&ots=oBvgg3yAFZ&sig=lmXYtTLFWJr2JjueQVxsEylnls0&hl=sv&ei=JbXnS7nKF5L60wTtq9nTBg&sa=X&oi=book_result&ct=result&resnum=4&ved=0CCoQ6AEwAw#v=onepage&q&f=false
Bob Friesenhahn
2010-May-10 16:06 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On Mon, 10 May 2010, Thomas Tornblom wrote:> > Sorry, but this is incorrect. > > Solaris (2 if you will) does indeed swap processes in case normal paging is > deemed insufficient. > > See the chapters on Soft and Hard swapping in: > > http://books.google.com/books?id=r_cecYD4AKkC&pg=PA189&lpg=PA189&dq=solaris+internals+swapping&source=bl&ots=oBvgg3yAFZ&sig=lmXYtTLFWJr2JjueQVxsEylnls0&hl=sv&ei=JbXnS7nKF5L60wTtq9nTBg&sa=X&oi=book_result&ct=result&resnum=4&ved=0CCoQ6AEwAw#v=onepage&q&f=falseIf this book is correct, then I must be wrong. I certainly would not want to use a system which is in this dire condition. Bob -- Bob Friesenhahn bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Richard Elling
2010-May-10 18:40 UTC
[zfs-discuss] Is it safe to disable the swap partition?
On May 10, 2010, at 9:06 AM, Bob Friesenhahn wrote:> On Mon, 10 May 2010, Thomas Tornblom wrote: >> >> Sorry, but this is incorrect. >> >> Solaris (2 if you will) does indeed swap processes in case normal paging is deemed insufficient. >> >> See the chapters on Soft and Hard swapping in: >> >> http://books.google.com/books?id=r_cecYD4AKkC&pg=PA189&lpg=PA189&dq=solaris+internals+swapping&source=bl&ots=oBvgg3yAFZ&sig=lmXYtTLFWJr2JjueQVxsEylnls0&hl=sv&ei=JbXnS7nKF5L60wTtq9nTBg&sa=X&oi=book_result&ct=result&resnum=4&ved=0CCoQ6AEwAw#v=onepage&q&f=false > > If this book is correct, then I must be wrong. I certainly would not want to use a system which is in this dire condition.It is correct (and recommended reading :-). I find this knowledge useful for troubleshooting. If you stumble across a stumbling system and notice that the vmstat "w" column is not zero, then you know that at some time in the past the system has experienced a severe memory shortfall. -- richard -- ZFS storage and performance consulting at http://www.RichardElling.com
Miles Nordin
2010-May-10 18:50 UTC
[zfs-discuss] Is it safe to disable the swap partition?
>>>>> "mg" == Mike Gerdts <mgerdts at gmail.com> writes:mg> If Solaris is under memory pressure, [...] mg> The best thing to do with processes that can be swapped out mg> forever is to not run them. Many programs allocate memory they never use. Linux allows overcommitting by default (but disableable), but Solaris doesn''t and can''t, so on a Solaris system without swap those allocations turn into physical RAM that can never be used. At the time the never-to-be-used pages are allocated, ARC must be dumped to make room for them. With swap, pages that are allocated but never written can be backed by swap, and the ARC doesn''t need to be dumped until the pages are actually written. Note that, in this hypothetical story, swap is never written at all, but it still has to be there. If you run a java vm on your ``storage server'''', then you might care about this. I think the no-swap dogma is very soothing and yet very obviously wrong. If you want to get into the overcommit game, fine. If you want to play a game where you will overcommit up to the size of the ARC, well, ``meh'''', but fine. Until then, though, swap makes sense. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 304 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20100510/83c4db94/attachment.bin>