Linux - EnterpriseThis forum is for all items relating to using Linux in the Enterprise.
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 would like to see how others are determining the amount of swap to put on a server. In the old days we just doubled the amount of memory that the server had. Today I am getting servers with 16GB or more of memory and it seems like it should not need that much swap. The other problem I have is the 2GB limit that Red Hat Enterprise linux has on swap partitions. Is there a way to create a swap partition of more that 2GB? This limitation seems to cause problems when you try to keep each swap partition on a sperate disk.
There is not now, nor was there ever, a formula for calculating the proper size of swap space. The only way that you can determine the required amount of swap space is to run your normal work load and see what it uses. The amount of swap space that is required is determined by the amount of memory required by the normal workload minus the amount of physical RAM available, then add some margin of safety.
So then the question is what to do when you are setting up a server. If you have a lot of disk space then you could set up a swap space that is equal in size to the RAM but you could end up wasting 16 GB of disk space if your server never swaps. On the other hand if you set up a 1 GB swap partition and all of the rest of your disk space is allocated for other things then you could have a problem when the server is put under a high load and your swap space gets filled.
One answer would be to set a small swap space but keep some disk space unallocated. Hopefully on a server you have more than one disk. So put a 4 GB or a 8 GB or whatever partition for swap space on one disk, and make another partition on another disk for swap. They should probably be equal in size. You can boot using both partitions and over time if you find that you don't need as much swap space then you can reallocate one of the swap files for something else, like making a physically adjacent partition larger.
Taking this approach will let you configure the server for a large swap space but will give you a way to easily recover some of the swap space if you find that you don't need it. If you do this then you could take the approach of initially allocating a lot of swap space knowing that you can recover some if it was not needed.
It really does depend on what you are doing with it. As he said oracle needs a good bit, but I've got a server with 3 gigs of memory that has a 2 gig swap and has never used more than 5 meg of it. It does small transactions, so it will fill up ram and never touch the swap as yet....You'll just have to decide what's right for you.
受教了!
I was told that the swap should be twice as the size as mem, though I don't think it should be in that way. Now I know how it should be, but I won't tell the teacher since they won't believe the things on their book is not correct.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.