Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm writing up some documentation for work explaining the steps for rebuilding a linux box, and on a proof read I spotted I'd written that the good practice is for swap to be the same size as system memory, something I remember reading somewhere. What I don't remember is why? I can think of various locations talking about the reccomended size of a swap file for Windows and getting everything from "half the system memory + 64mb" through to obscure ones like "total system memory + 2* your Aunt Mary's Age, divided by the number of prunes she had for dinner"; there seemed to be no concensus nor any real explanation as to where these hard and fast rules had developed from.
Is there such an explanation out there for Linux and its swap drive size? Is "same size as system memory" really good practice?
Don't know.. I heard that it's double the system memory though
-A
Old rule of thumb that is..
Nowadays when desktop systems have 1GB of memory almost standard, it just all depends on how much swap you should use. It all depends on what the system is going to be used for, how much memory total it has, etc.
Heavily used server with 2GB of RAM, it probably wouldn't hurt to have a 2GB swap space. Same server lightly used and not expecting high loads, 512MB might do the job and might never get used, even the 2GB swap on high traffic server might never get used.
Is "same size as system memory" really good practice?
"Good practice" is what works for you. Long threads of logical arguments about how swap is good or not so good are interesting, but don't point to a single simple formula.
If you are "rebuilding" an existing server, there should be some idea about what works in your particular network.
If there is no idea about what is most efficient in a network, and I felt obliged to put a formula in the documentation, I wouldn't hesitate to put something about starting with 2x RAM, monitoring, and adjusting if needed.
For a desktop, Poetics' formula looks good to me, generally. More swap may be advised for putting together custom live CDs or DVDs. I've read that lots of swap is good for working with video.
A work manual? Remember KISS. Keep it as simple as possible. Don't try to explain all the issues of the Linux universe.
"Good practice" is what works for you. Long threads of logical arguments about how swap is good or not so good are interesting, but don't point to a single simple formula.
If you are "rebuilding" an existing server, there should be some idea about what works in your particular network.
If there is no idea about what is most efficient in a network, and I felt obliged to put a formula in the documentation, I wouldn't hesitate to put something about starting with 2x RAM, monitoring, and adjusting if needed.
How does one go about monitoring the swap usage? I don't think I've ever read it anywhere.
Quote:
A work manual? Remember KISS. Keep it as simple as possible. Don't try to explain all the issues of the Linux universe.
Good Luck!
I've done my absolute hardest to keep the manual simple, but its literally a step-by-step process talking the end user exactly through installing Gentoo and then on to a fully working DVB PVR box. I can't have done too badly with it as a totally non-linux geek has just managed to do it on a test box in the office
How does one go about monitoring the swap usage? I don't think I've ever read it anywhere.
I'm really out of my league here, with servers. Maybe someone else will jump in.
Here is something less serious folk like me might do on a desktop machine... Configure a KSysGuard chart to show swap use for a half hour. Take a snapshot of this screen after a period when memory use is high. But a server administrator may not want KSysGuard anywhere near his server.
A resourceful expert could probably use "free" in a script, collecting memory use data info every few seconds, but that appears to be reinventing what surely has to already be out there.
A little googling located this James Day post in mysql forum:
"In a linux environment you should use top and vmstat to monitor swap use. For top, turn on the optional column for displaying the number of hard page faults (called nFLT in some versions). If it's a dedicated server I aim for close to zero si and so in vmstat monitoring, based on experience showing that any significant amount hurts. " http://forums.mysql.com/read.php?24,8218,8266
But sorry, I really don't know if Mr. Day has the best answer either.
I keep finding stuff about "meminfo", but reading it is giving me an awful headache. Maybe you can do better!
Quote:
Originally Posted by Garp
I've done my absolute hardest to keep the manual simple, but its literally a step-by-step process talking the end user exactly through installing Gentoo and then on to a fully working DVB PVR box. I can't have done too badly with it as a totally non-linux geek has just managed to do it on a test box in the office
Whoa! You bit off a big chunk for starters. Take some time to enjoy your accomplishments. Congrats.
Whoa! You bit off a big chunk for starters. Take some time to enjoy your accomplishments. Congrats.
It was and wasn't my choice
We really needed to be able to record off freeview (digital terrestrial in the UK), and be able to burn the recordings onto DVD for use in classrooms. After spending ages digging around I couldn't find a commercial solution that fulfilled all the requirements, dual tuners etc. etc. Decision was made amongst the team that as I had a mythtv box running at home (more or less.. was still working on it at the time), if we bought a couple of digital tv cards we could produce an in house solution. After bashing my head against brickwalls in RHES (running on other servers in-house), Fedora Core, and Slackware, I finally switched over to Gentoo like I was using at home. No hassles there Install took longer, sure, but it works with no hassles on the scale I was getting with the other distros.
Problem is I'm the only person on site that has ever installed Gentoo before, so documentation of install was necessary in case I get run over by a number 9 bus or something
Eventually, when I get time, I'll be knocking up the instructions into more of a HOWTO format than they are currently for others to use. A few of the colleges in the area have heard about our PVR and were asking how to make ones of their own...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.