As one of the 60 or so OS Ambassadors in Sun world wide, I frequently see the question asked about how to configure Solaris swap. Apparently, there is quite a bit of mystery about swap space even though it is clearly documented in the Solaris administrator collection. I decided to publish a collection of my favorite myths and facts about Solaris swap space. Note that certain applications (such as Oracle) that use "Intimate Shared Memory" will require more swap than most applications. Please refer to the application docs for swap size recommendations.
Myth: Always set Solaris swap to 2 x RAM size
This myth is clearly a case of users who have been around since the SunOS 4.x days. Virtual memory today consists of the sum total of physical RAM and swap space on disk. Solaris DOES NOT require any swap space to be configured at all. If you choose this option, once RAM is full, you will not be able to start new processes. There are recommendations for swap space size in the Solaris documentation but the rule of thumb in general is that swap should be configured about 30% of physical RAM.
Myth: Solaris swap requires raw partitions to be available
Swap can easily be added using standard UFS files in addition to raw disk slice, online without a reboot. The added swap space takes effect immediately. The instructions are documented but because I'm a nice guy (and it is so easy) I'll put an example here.
- mkfile 500m /swapfile
- swap -a /swapfile
- Make this added swap area persistent across reboots by adding a new entry in /etc/vfstab
There now, that didn't hurt a bit did it? The file can be any size you choose and any location in a UFS file system. You can add as many swap files as you like. ZFS is not currently supported for swap files. You can use the vmstat or swap commands to show the changes. Swap space is used in a round robin rotation.
Myth: Swap partitions are also dump partitions
It was back in the Solaris 8 timeframe (late 1999) that the dumpadm command was added to Solaris. To quote the S8 documentation (because I'm lazy): The new dumpadm command, which allows system administrators
to configure crash dumps of the operating system. The dumpadm configuration
parameters include the dump content, dump device, and the directory in which crash
dump files are saved. See the Solaris 10 dumpadm documentation for more information.
Myth: You can't control swap space for Solaris 10 containers
With the latest update of Solaris 10 08/07, we added new resource controls for swap space and containers. These provide significantly better control and help eliminate denial of service attacks caused by memory leaks and "malloc bombs."
- zone.max-locked-memory
- zone.max-msg-ids
- zone.max-sem-ids
- zone.max-shm-ids
- zone.max-shm-memory
- project.max-locked-memory - Replaces project.max-device-locked-memory
- zone.max-swap - Provides swap capping for zones through the capped-memory resource
Fact: Swap and tmpfs are the same
This is true. This design has a number of benefits but we also offer a number of options for controlling tmpfs usage. I'll refer you directly to the documentation again.
Fact: Using swap is bad for performance
Think of swap space as an overflow area for RAM. It's OK if non-active processes are using swap space, however, if actively used processes are constantly having their pages moved back and forth from RAM to disk based swap areas, performance will suffer. You can monitor this using the vmstat FREE column. In Solaris 7 and earlier this number wass relatively meaningless. Since Solaris 8, however, the FREE column provides an accurate indicator of your free memory. If the number is too low, page scanning begins (as indicated by the 'sr' column in vmstat). Any non-zero number in the 'sr' column for an extended period of time is an indicator that it's time to buy more RAM.
Jim Maura and Rich McDougall have written excellent books about Solaris Internals which described memory utilization in excruciating details. See their Solaris Internals wiki for more FAQ and to purchase the books.
Why should you care?
Solaris continues to be updated and improved with every update based upon feedback from our customers. If you are not staying up with the latest technology, you're still "living in the 90s" and not getting the most from your compute resource. We work hard to provide you the facilities in Solaris to increase your availability and utilization of you compute farms.
A key thing you miss is the fact that there are multiple definitions of swap and these are not well understood. As a testament to this, look at the number of bugs against vmstat saying the amount of swap reported is incorrect. The two key "swap" definitions that seem to have made the most sense to those I work with are:
swap space - This is what most people think of as swap. It is typically a raw partition (can be a file) that is used to page out the least active pages of memory.
swap - The portions of virtual memory made up of "physical memory" (e.g. DIMMs) and swap space. Note that virtual memory includes (but swap does not include) memory mapped files and memory mapped devices.
It is possible to be out of swap without being "out of memory". That is, the vmstat swap column can be near zero while the vmstat free column can be quite large. This is because memory allocations count immediately against swap but do not count against "physical memory" until the allocated memory (reserved swap) is used.
Posted by Mike Gerdts on November 12, 2007 at 08:48 AM EST #
Along the comment that it is possible to be out of swap but not out of memory, I recently ran into an issue with oracle on one of our dev boxes.
the cc-inv agent kept hanging, and after a while there were a bunch running (cron kicks them off every so often). Because these procs were not doing anything, they were pushed into swap. Thus, we had 24G of ram free but only 256MB or so of swap.
Guess what? We could not start any oracle instances because there was no swap space to back the shared memory segments.
killing the cc procs freed up the swap space, which allowed us to start the oracle instances.
For this reason, we tend to spec 1-2x RAM for our oracle boxes.
Posted by john on November 12, 2007 at 10:03 AM EST #
In the section about adding swap on UFS filesystems, you neglected to mention that you need to add the relevant entry to /etc/vfstab to make it persistent. Otherwise, after a reboot, /swapfile will still be taking up 500 MB on your root filesystem, but it will not be added as swap.
Otherwise this is an excellent summary of things I've been trying to tell people for years but have had trouble pointing them to documentation to back it up. Thanks, Jim!
Posted by Gordon Cook on November 12, 2007 at 10:59 AM EST #
Thanks for the comments. I added a line mentioning /etc/vfstab for persistence.
Posted by Jim Laurent on November 12, 2007 at 11:09 AM EST #
Nice writeup. One question I've seen a lot about using swap files (versus partitions) is what is the performance penalty? I got an email response from Adrian Cockcroft about 10 years ago saying it was extremely low (~ 1-2%), is that still true for Solaris 10?
Posted by William Hathaway on November 12, 2007 at 01:01 PM EST #
Sun Portal Server 7 needs 4G of swap space to install without complaining... Given the nature of portal, I can understand the need for a lot of swap, since portal desktops can have a long life.
Posted by J on November 12, 2007 at 01:53 PM EST #
Fact: Swap and tmpfs are the same - True.
Sorry, but that's not correct in any sense of the word. swap is, well swap. tmpfs is a virtual-memory based filesystem. Not what I'd consider the same at all!
If you're trying to say that they use the same space, you're still wrong. Swap uses disk. tmpfs uses virtual memory, which includes both swap as well as physical RAM.
Myth: Always set Solaris swap to 2 x RAM size - False
OK, so this is generally true, but there are cases where 2x is a very good recommendation (and your 30% certainly isn't enough). In particular, when using Dynamic Intimate Shared Memory (DISM) Solaris _does_ double-allocate memory - in effect it's very similar to the way SunOS 4 worked for all memory. If you don't have at least as much swap as DISM allocated memory then you're going to start having issues very quickly...
Posted by 124.168.150.122 on November 12, 2007 at 07:24 PM EST #
We have found 2-3xRAM on large (6900) system. Oracle and large Java app system with 100+ zones is the most effective.
Not that it is all used frequently but it does allow for large processes to fork/exec for the brief period of time before they give up reserved memory.
Posted by Shawn Ferry on November 13, 2007 at 03:18 AM EST #
Hi, Jim.
Although you state that Solaris can run without swap-space being allocated on disk (which is mostly true in my experience) there is the question of how a process starts.
It is at the discretion of the programmer to build into their code a demand that swap space be allocated for that, particular, process to use should paging/swapping ever become necessary. So, I would always consider it good practice to allocate at least some swap space (on disk!) on each installed Solaris system, regardless of whether or not you feel that you have sufficient memory to support the expected processing workload.
Posted by Jeff Turner on November 26, 2007 at 03:24 AM EST #
The post by "124.168.." is correct, swap and /tmp are quite different.
More interestingly your 30% recommendation is possibly defensible for large multi-application hosts, but indefensible for small systems and some larger machines dedicated to apps that require shared memory to be backed by tmpfs - on swap space.
In general sysadmins should configure swap to be at least double the maximum needed by the application - and if that isn't known in advance, try at least 2 x RAM for RAM <16GB, dropping to a lower percentage for larger RAM.
Posted by Paul Murphy on November 26, 2007 at 11:24 AM EST #
124.168... is wrong about this:
"If you're trying to say that they use the same space, you're still wrong. Swap uses disk. tmpfs uses virtual memory, which includes both swap as well as physical RAM."
The term "swap" is often used in Solaris to mean all of the virtual memory space, so they do use the same space. See Mike's first comment.
Posted by Ceri Davies on December 30, 2007 at 05:43 AM EST #
http://pipes.yahoo.com/pipes/pipe.info?_id=Yp7rIXlO3RGd3VFN1vC6Jw | buy cialis
http://pipes.yahoo.com/pipes/pipe.info?_id=a695638e13263efe7d6ae23db50932a8 | generic cialis
http://pipes.yahoo.com/pipes/pipe.info?_id=25b7955a0f898b11964010cedf0db264 | order cialis
http://pipes.yahoo.com/pipes/pipe.info?_id=3fc3d97a31f6f731bb94871be76c43f1 | cheap cialis
http://pipes.yahoo.com/pipes/pipe.info?_id=7fd66d29ed9f11d7545fd77f9dd7ef6a | cheapest cialis
http://pipes.yahoo.com/pipes/pipe.info?_id=360543c1539015851941870ce878378a | generic cialis prices
http://pipes.yahoo.com/pipes/person.info?eyuid=PYf4nl4xvXqUlX8SQucFtp8U0So- | cialis
Posted by buy cialis on July 10, 2008 at 05:10 PM EDT #
http://pipes.yahoo.com/pipes/pipe.info?_id=ZBbgpw1X3RGVSbdYJphxuA | buy levitra online
http://pipes.yahoo.com/pipes/pipe.info?_id=ZBbgpw1X3RGVSbdYJphxuA | levitra online
http://pipes.yahoo.com/pipes/pipe.info?_id=Hn_cBxBX3RGru2qd1fC6Jw | cheap levitra
http://pipes.yahoo.com/pipes/pipe.info?_id=tE3Scg9X3RGfhwKV1fC6Jw | order levitra
http://pipes.yahoo.com/pipes/pipe.info?_id=Og7rVQ5X3RGtF__0EpPZnA | generic levitra
http://pipes.yahoo.com/buy2levitra | buy levitra
Posted by buy levitra on July 27, 2008 at 11:08 AM EDT #
tnx
Posted by order viagra on August 07, 2008 at 03:00 PM EDT #
tnx
Posted by order levitra on August 07, 2008 at 03:00 PM EDT #
tnx
Posted by order cialis on August 07, 2008 at 03:00 PM EDT #
what does the 'sr' column in vmstat = 3 mean then?
Thanks!
Posted by abdullah on June 15, 2009 at 07:13 AM EDT #
The SR column indicates "scan rate." This is the number of page scans being performed in order to free up RAM by moving non-active pages to disk so that new pages can be lowered. In Solaris 10, if scan rate (sr) is non-zero, it means that you have a memory problem. If this continues on a regular basis you should expand RAM or eliminate some processes.
Posted by Jim Laurent on June 15, 2009 at 07:59 AM EDT #
I have purposely not done any comparisons to "Linux" because "Linux" is a source code development project at kernel.org (not too dissimilar from OpenSolaris at opensolaris.org). "Linux" is not a product. Solaris 10 and RHEL 5 are products that customers can buy and get support for.
http://www.globalsale.me/Aion-gold-083.aspx
http://www.cheap-gamegold.org
http://www.gamegoldvip.org
http://www.watchrolexshop.com
http://www.gamegoldme.com
Posted by aion gold on June 24, 2009 at 10:53 PM EDT #
cards for plastic
cards for plastic is a leader and innovator in the cards for plastic industry catering for all your membership cards and any custom size cards for plastic required from small to big quantity. We are a one-stop center for your entire cards for plastic requirement. <a href="http://www.7days-printing.com ">cards for plastic</a>.Have your cards ready in less than 1 hour if necessary in high laminated cards for plastic quality without compromising on quality and durability! The cards for plastic will be highly glossy laminated, very falt, non peeling and very sharp!
[URL=http://www.7days-printing.com]cards for plastic[/URL].We are also the authorized distributor for all range of cards for plastic as well as javelin cards for plastic in malaysia for personalizing the cards for plastic with thermal printing of text and barcode as well as encoding the magnetic stripe and cards for plastic.
custom plastic card
As a leading company in the custom plastic card printing industry, our factory has passed many certificate and produces over two million custom plastic card per year. Our custom plastic card is exactly like the credit cards.
<a href="http://www.7days-plasticcards.co.uk">custom plastic card</a> We produce custom plastic card. our custom plastic card is four color litho printed with heidilberg machines. If you order our custom plastic card, we will offer you the best value for your money without any waste. [URL=http://www.7days-plasticcards.co.uk]custom plastic card[/URL] Ordering custom plastic card from us directly over the phone or internet, we can give you the best price which you can not find elsewhere!Today, custom plastic card is various and the company supplies more than 5oo million custom plastic card annually to customers all over the world. But our custom plastic card has many advantages.
card supplier
As a corporate has card supplier facility manager or security professinal, you meet hundreds of card supplier every day. It’s your job to identify card supplier, but can you be expected to recognize every card supplier in your facility? You’re going to need a little help from identification card supplier, so take your pick: use standard size card supplier like you’ll find at [URL=http://www.7daysprinting.com] card supplier [/URL] or oversized photo ID badges like you’ll find at <a href="http://www.7daysprinting.com"> card supplier </a >to verify identities. Use proximity or card supplier to grant access to unattended building entries and bar codes or magnetic stripe card supplier for accurate time and attendance tracking and more. Fargo systems integrators like us offer complete card supplier personalization systems to help solve these challenges.
hologram company
hologram company is the most fundamental marketing tool that you always have with you. hologram company contains business information about you and your company. hologram company communicate the primary information of your company to your prospective customers- in a compact and simple way. hologram company is a proven method which effectively advertises your business. Whether you are launching a new product or marketing an existing one, a hologram company will always help you do it right.
[URL=http://www.hologram-sticker.co.uk]hologram company[/URL]
hologram company is used for presentation of your marketing materials in a superior way. hologram company ontains multiple pockets inside to hold your marketing materials. By utilizing folders, you can enhance the presentation of your hologram company. <a href="http://www.hologram-sticker.co.uk">hologram company</a>. hologram company is a significant part of any company’s distinctiveness to others.
hologram design
We can supply from stock a complete range of hologram design for use with card printers. <a href="http://www.dynamicworldwide.co.uk">hologram design </a>.The recently updated hologram design fooers all the features required to create and design card layouts with ease of set up and simplified operation. Four editons of hologram design are available from the entry level hologram design which allows for connection to external databases and the encoding of contactless hologram design.
[URL=http://www.dynamicworldwide.co.uk]hologram design[/URL]Whatever your requirement, hologram design has the solution. A hologram design personalisation bureau service is offered, where pre-printed or hologram design can be thermally printed, embossed and encoded to your specific requirements. hologram design can also be produced by digital or litho print methods. Other brands of hologram design can also be supplied and supported.
metal card
Businesses of all sizes rely on a powerful but tiy tool to communicate their business information: the metal card. <a href="http://www.metal-card.co.uk"> metal card </a>
Whether you’re a business behemoth or one-man-brand consultant, the appropriate metal card is a must. metal card printing can be a daunting task because metal card come in all shapes and sizes. There are your standard dorizontal facing metal card, and even metal card with the rounded deges. That depends on what exactly you are trying to communicate with your metal card.The appropriate content is very important for your metal card selection. [URL=http://www.metal-card.co.uk]metal card[/URL]Your customers should be able to easily remember what it is you offer and also be able to contact you from the information on your metal card. The last thing you want to do is hand a potential customer a brilliantly designed metal card that does not help them find you when they need you. metal card printing goes beyong metal card design.
gift bag printing
gift bag printing is the key to promoting your business. gift bag printing also increase the number of new customers coming in to redeem their gifts. gift bag printing offers bring in customers seeking discounts on new purchases. As one of the leading manufacturers of gift bag printing. <a href="http://www.printing-gift.co.uk">gift bag printing</a>Our company has supplied gift bag printing for top retall companies. Generating new gift bag printing is a big benefit to a successful gift bag printing. Not only will your existing customers find gift bag printing appealing, they will in turn tell other new potential customers about gift bag printing. Branding on your new gift bag printing raise awareness.[URL=http://www.printing-gift.co.uk]gift bag printing[/URL] There are many advertising and branding opportunities with gift bag printing. This is because of the many diverse things gift bag printing can be used for today. gift bag printing for business has been increasing in popularity for several years. We offer affordable custom gift bag printing at the lowest prices around.
smart card service
Since our smart card service is produced with unique equipment, you can be sure that your smart card service will be of high quality. In addition, our smart card service options are fully customizable to meet any specific needs. Your smart card service can also be ordered in combination with the convenient key smart card service, which is a smaller version of your smart card service that can be easily attached to a key chain. [URL=http://www.smartcard-supplier.co.uk]smart card service[/URL]Our smart card service helps companies that need a new design creat smart card service. For companies that already have a smart card service, we can print directly from your own supplied smart card service artwork.
<a href="http://www.smartcard-supplier.co.uk"> smart card service</a>
All of our custom printed smart card service offer high resolution graphics. We offer options for smart card service production such as unique smart card service textures or transparent smart card service for or a highly appealing visual appearance.Your customers will truly see your new smart card service as an outstanding them or high value.
Posted by molly on July 27, 2009 at 01:28 AM EDT #
If I understand it all correctly, the problem may be the "swap" setting for my zones. The zone on the T5140 has the following config (zonecfg -z niddev01 info):
capped-memory:
physical: 8G
[swap: 2G]
The zone on the T5240 has the following config (zonecfg -z nidtfacts02 info):
capped-memory:
physical: 8G
[swap: 2G]
If you could confirm the exact meaning of the "physical", "swap" and "locked" settings under the "capped-memory" control, I'll appreciate. The Sun documentation is not clear at all.
Should swap be equal or less than the global zone's disk based swap? Or should it be "physical" memory cap PLUS swap available in global zone?
Please get back to me as soon as you get an answer.
Posted by shawn cannel on September 18, 2009 at 04:50 AM EDT #
First of all, keep in mind that non-global zones are NOT complete OS images in the same way that LDOMs and VMware creates virtual machines. Non-global zones are simply collections of programs that run at reduced privilege over a single kernel shared and in a single memory space that is shared by all the non-global zones.
The purpose of the resource controls for physical memory and swap is to prevent certain denial of service conditions in which a bad program in a non-global zone could overfill RAM or SWAP (such as tmpfs) resulting in a condition affection other non-global zones or even the global zone.
The physical setting limits how much physical memory the zone can use before some of its pages start begin swapped out to disk. the "locked" setting limits how much memory can be pinned or locked in RAM by applications such as Oracle which likes to lock its SGA in RAM.
Swap space for zone is carved out of the total system swap space.
http://docs.sun.com/app/docs/doc/817-1592/rm.rcapd-1?l=en&a=view
Posted by Jim Laurent on September 18, 2009 at 06:53 AM EDT #
124.168.150.122 wrote "In particular, when using Dynamic Intimate Shared Memory (DISM) Solaris _does_ double-allocate memory - in effect it's very similar to the way SunOS 4 worked for all memory."
Not true, per the Solaris Internals book page 434. You can also verify this for yourself using "pmap -S" and looking at the amount of swap associated with the ISM segments. Solaris 2.6 no longer allocates swap for ISM
Posted by Matt on September 18, 2009 at 06:04 PM EDT #
http://www.jsjyyb.cn
Posted by 电磁流量计 on September 27, 2009 at 04:33 AM EDT #
http://www.shanghaimassages.net
Posted by shanghai massage on September 27, 2009 at 04:34 AM EDT #