![]() |
|
Off-Topic Everything else. |
View Poll Results: Do you use a swap partition? | |||
Yes |
![]() ![]() ![]() ![]() |
23 | 100.00% |
No |
![]() ![]() ![]() ![]() |
0 | 0% |
Voters: 23. You may not vote on this poll |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
Hello,
In the days of increasing RAM in computers - where 2GB is standard and 4GB or even 8GB is not unheard of - how many of you still use a swap partition. I think my first swap partition that I created back for Red Hat 9 was only about 1GB - back then they recommended double your amount of RAM for the swap. Today, some swaps would need to be 16GB or more to accommodate that recommendation. I believe that swap was used as a supplement for less RAM, but that help may no longer be needed. So, how many of you still use a swap partition?
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
![]()
Contrary to popular believe, a swap partition is still an integral role of paging in the x86 architecture, pages are relocated to "secondary storage" when not in use.
You should always create a swap file or partition, even if you don't think it's important.. it really is. |
|
|||
![]()
I still do -- 4GB with 3GB RAM -- simply because disk space is so cheap. Its size really is set to accommodate the memory requirements of the largest program you can run. I don't run anything that requires 7GB of RAM, but I could. And freeing 4GB out of the 200GB or so of disk that I have installed is not worth it.
|
|
|||
![]()
@OP, Let's expand on this concept... each process has access to it's own "virtual" address space, 4GB on a 32bit architecture.
When a program "allocates" memory, i.e: malloc(3), it's actually requesting that "x" amount of memory be mapped into it's address space. (Because, most of it is empty space, i.e: unmapped..). Now, allocated memory doesn't always need to stay in RAM, The kernel is free to "relocate" it into the swap space on your hard drive. If the program attempts to access the memory that was swapped, a "page fault" occurs, causing the kernel to halt the process, and reload the data back into RAM. The benefits of this are clear... ![]() |
|
|||
![]()
Configuring swap space is insurance, but ultimately it depends on the system & how it is used. Being familiar with standard performance metrics observable with tools like top(1) is imperative -- especially in situations where space which would/should be configured as swap is scrimped upon.
The old adage of configuring 2x the amount of RAM has to be tempered with usage & what resources are available. Like DrJ, I am more liberal with configuring swap on systems where disk space is not an issue. However, on smaller systems were extremely limited storage is available (firewalls...), I reduce swap significantly. Paraphrasing BSDfan666, the lack of any configured swap space can really hurt if it isn't available. Thus, I like the insurance of configured swap space on servers which are exposed to the wiles of the Internet. Yet for desktop systems, I can be more experimental because I'm more in control of what loads they are subjected. Ultimately, the decision is yours, & if you can justify your decisions & live with the consequences if your decisions are wrong, go for it. |
|
|||
![]() Code:
$ swapctl -l Device 512-blocks Used Avail Capacity Priority swap_device 128000 0 128000 0% 0
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
|||
![]()
@J65nko, wise guy..
![]() |
|
||||
![]()
I always add SWAP space and I always mount /tmp there.
My choices on my boxes has been like that: 256MB RAM laptop: 512MB SWAP + 128MB for /tmp 1GB RAM workstation: 2GB RAM SWAP + 256MB for /tmp 2GB RAM workstation: 2GB RAM SWAP + 512MB for /tmp
__________________
religions, worst damnation of mankind "If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds Linux is not UNIX! Face it! It is not an insult. It is fact: GNU is a recursive acronym for “GNU's Not UNIX”. vermaden's: links resources deviantart spreadbsd |
|
|||
![]()
About the 2xRAM size this is what the OpenBSD FAQ has to say (http://www.openbsd.org/faq/faq4.html#Partitioning)
Quote:
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
|
||||
![]()
The way I look at it, if my computer does not have enough virtual memory to complete the tasks I need of it, I can't use my computer to do what I need/want it to do, hence I've screwed myself by design.
All of my systems have swap space and /tmp allocated based on usage and hardware parameters. I typically will use as much swap space as I ever intend to have RAM installed. And /tmp big enough to accomdate the largest unpacking jobs I expect to run, typically 0.1~1500mb For example, my desktop has 2GB of RAM and 4GB of swap, it's maximum capacity is 4gb and disk space is huge. It rarely has extreme loads but sometimes does, hence lots of swap just in case of WW III ! My laptop has 512MB of RAM and 1GB of Swap which is the most I ever expect to have installed, although she tops out at 2GB of RAM. I'm prone to doing a lot of things in short order on computers, to the point that I usually call it "omni tasking". My laptop used to have 512MB of Swap and I've seen top come to close suggesting that my swap space is approaching exhaustion (~10s of mb left). I have not had that happen more then once or twice but by George, doubling my swap space is a small price for paranoia on an 80gb disk! I never trust memory usage reported by any program, top included but I do consider it a guideline. The PC pressed into service as a file server has about 300MB of swap and 384MB RAM -8MB for the gfx card. Disk space was initially small (8GB), I have no reason to buy extra PC100, and it sits idle most of the time. SSH, NFS, and MySQL currently running 'round the clock with provisions for Samba and printing software to be added later. She doesn't have much need for swapping, so the swap space was kept quite minimal. normally if RAM is small (e.g. <1GB) or disk space cheap (e.g. > 80GB) I will usually opt for more swap then I need to worry about because I *can*. In this case, extreme swap would've been more dentimental then memory problems.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
![]() Quote:
![]() A swap partition will not eat any bread. Further, a swap partition will not eat a primary entry either, and all Linuces or *BSDs can mount an extended Linux swap partition. Hard drive space is penty, so I have a swap parition in the "extended" area, usage 0% , available to whoever is concerned ![]() Well, I am the kind of guy holding his pants with both a bet and suspenders. ![]() La,la: 32MB of swap once was plenty. If you intend to debug a memory dump, you might use a swap=memory. If this happens me twice, I reinstall the OS from fresh. Some laptops suspend to swap (or elsewhere). Some OSes really make a bad usage of the RAM (and swap). ---- edit the FAQ reads: ... twice the size of your main system RAM. This rule is nonsense.
__________________
da more I know I know I know nuttin' Last edited by lvlamb; 9th July 2008 at 11:52 PM. |
|
||||
![]()
OK, how about "one third of your total memory should be physical"?
Like everyone says, I always configure a generous swap, but it is rarely used. Code:
Device 1K-blocks Used Avail Capacity /dev/ad4s1b 3897344 68K 3.7G 0%
__________________
The only dumb question is a question not asked. The only dumb answer is an answer not given. |
|
|||
![]()
That does bring up a question. Sometimes I have some things in swap, even though there is plenty of free memory. Like now:
Quote:
|
|
||||
![]()
Firstly , free physical memory is good for a system. It means that it does not have to free up memory if a process suddenly requires a large amount of memory. (The other side of the tale, "Free memory is wasted memory," is also true: the two maxims must be balanced.)
That swap may simply be pages of memory that are cached in swap - The data is both in swap and in physical RAM, so the space is there if the system needs it, and the data is there if the process needs it. Best of both worlds. And what is the point of paging back in idle data? The process is not likely to require it any time soon, or it wouldn't have stayed paged out for the last hour. I'll only have to swap it back out again, and I'm lazy. Despite having a brain the size of a planet....
__________________
The only dumb question is a question not asked. The only dumb answer is an answer not given. |
|
|||
![]() Quote:
This is on FreeBSD 6.3, FWIW. |
|
||||
![]()
What makes you think that X, gnome, the daemons or even the kernel is not the culprit? Indeed, it is these, long-running, largely-unused processes that often have bits of them swapped out, and, as the memory is idle, give no reason for the system to page them back in.
__________________
The only dumb question is a question not asked. The only dumb answer is an answer not given. |
|
|||
![]()
They are too small. Usually these take about 100MB of memory; the swap used is larger. Something else has to be in there.
|
|
|||
![]()
"Too small", congratulations.. you found a memory leak.
![]() If memory is allocated, and the program loses track of it.. (i.e: poorly managing pointers, it remains until the program is terminated..) Because nothing is using it, makes sense that the kernel would swap it off to secondary storage. |
|
|||
![]()
I'll see if it is anything with X or Gnome, but the swap has always occupied so far. The gecko-based browsers all seem to have memory leaks, this this one is something else.
|
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to swap partitions Help | revzalot | OpenBSD Installation and Upgrading | 2 | 1st September 2009 07:44 AM |
swap partition | lumiwa | FreeBSD General | 6 | 11th September 2008 03:57 PM |