LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-20-2013, 05:37 AM   #1
austin0902008
LQ Newbie
 
Registered: Jun 2013
Posts: 5

Rep: Reputation: Disabled
SWAP Partition location


Hi All,

I have one query, When we install any Enterprise Linux server, Shall we create the SWAP partition on Primary or Extended?

How is the generally deploy specially on those Internet Server?

I would like to know if we can use this for tuning the server.

Regards,
Austin
 
Old 06-20-2013, 06:13 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
It doesn't matter at all if it is a primary or a logical partition in an extended partition. If you want to tune it for speed you should put the swap partition onto the fastest part of the disk, which is usually the outer part, to get the best transfer data. A different approach would be to put the swap partition in the middle of the disk, so that head movements from and to the swap partition are as short as possible. The real thing to tune your server for speed would be to add more RAM, so that swap is rarely used in the first place, or at least to use a fast SSD for swap storage, that will give you better transfer rates and minimizes seek times.
 
Old 06-20-2013, 07:09 AM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by TobiSGD View Post
It doesn't matter at all if it is a primary or a logical partition in an extended partition.
I agree.

Quote:
If you want to tune it for speed you should put the swap partition onto the fastest part of the disk, which is usually the outer part, to get the best transfer data. A different approach would be to put the swap partition in the middle of the disk, so that head movements from and to the swap partition are as short as possible.
That is obsolete advice based on ram prices that were so high that configuring a server with "enough" ram was not cost effective. Those days are long gone.

Swap on a server now serves two purposes:
1) Stale anonymous data (typically used in startup of service processes and never touched during normal operation) can be swapped out once and left in swap till shutdown.
2) Graceful degradation (rather than OOM killer) in case of memory leak or unexpected demand crunch.

Both those uses imply swap should be put out of the way somewhere, saving premium disk positions for more important purposes. On a system with a single hard drive, that typically means the swap partition goes at the end of the drive.

Quote:
The real thing to tune your server for speed would be to add more RAM, so that swap is rarely used in the first place,
I would guess the server already has enough ram that swap is rarely used.

Quote:
or at least to use a fast SSD for swap storage, that will give you better transfer rates and minimizes seek times.
If you have both SSD and hard disk and can choose:

If swap is rarely used, taking up SSD space is a waste.
If swap is heavily used, using SSD is still a waste. Swap usage typically has one write for every read. That is low performance for SSD. SSD should be used for contents that are mostly read and rarely written.

If you have a mix of SSD and hard drive and you have such limited ram that swap speed is a noticeable factor in performance and you can't simply add enough ram, you may want to tune the swappiness parameter.

First you would make sure all the commonly used programs are stored in SSD. Then reduce swappiness. The default swappiness in Linux is based on the approximation that one reread of a program page is half as expensive as a write plus reread of swap. But if program storage is on SSD, a reread of a program page is much less than half as expensive as a swap. So a lower swappiness may conserve ram at the cost of many program page rereads, and that conserved ram saves a few swaps, netting to better performance since SSD reads are so fast.
 
Old 06-20-2013, 07:57 AM   #4
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by johnsfine View Post
If swap is heavily used, using SSD is still a waste. Swap usage typically has one write for every read. That is low performance for SSD. SSD should be used for contents that are mostly read and rarely written.
I disagree. Modern SSDs have write speeds of above 400MB/s. I wouldn't call that low performance, but if you do, how would you call write speed of mechanical disks?
 
Old 06-21-2013, 02:27 AM   #5
austin0902008
LQ Newbie
 
Registered: Jun 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi All,

Thank you for providing this valuable information.

Regards,
Austin
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
swap file or swap partition? What is better? zemir Linux - Newbie 28 08-19-2011 09:15 PM
Can swap file or a swap partition be mounted and read? Mr-Bisquit Linux - General 3 06-08-2009 02:16 PM
Hard Drive Partition Management - Mandriva Double Partition with Swap File partition moshebagelfresser Linux - Hardware 2 05-23-2008 10:46 AM
what is best location of swap Kristian2 Linux - General 12 10-28-2006 05:43 PM
best location for swap partition spyderusa11 Linux - General 14 07-22-2003 02:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration