LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   modify swap space (https://www.linuxquestions.org/questions/linux-newbie-8/modify-swap-space-4175529591/)

!! hack-back !! 12-30-2014 02:46 PM

modify swap space
 
hello,
after finish installing debian server
i found that there is 8GB swap space and now i want to increase them for 30GB
the default i found is
Code:

swapon -s
Filename                                Type            Size    Used    Priority
/dev/sdf5                              partition      9526268 0      -1


Code:

df -h
Filesystem                                              Size  Used Avail Use% Mounted on
rootfs                                                  212G  1.6G  199G  1% /
udev                                                    10M    0  10M  0% /dev
tmpfs                                                  3.2G  256K  3.2G  1% /run
/dev/disk/by-uuid/bfae05ad-9281-447b-9640-89c8f9047536  212G  1.6G  199G  1% /
tmpfs                                                  5.0M    0  5.0M  0% /run/lock
tmpfs                                                  8.1G    0  8.1G  0% /run/shm


how i can increase the size ?

angel115 12-30-2014 03:12 PM

Hi,

Here is a prety well detail how to, to do so:
http://www.linux.com/learn/tutorials...th-a-swap-file

But let me be curious and ask you why would you do such thing?

Usually, when your os is swapping, this is bad.

So I don't even imagin with 30G of SWAP. Unless you really want to kill the performances of your machine.
But if you got the choice, add some RAM... Really.

Angel.

!! hack-back !! 12-30-2014 03:15 PM

i have 32gb ram, and am using squid server so at some point squid will eat all the ram thats why i need that swap area , what you say ?

angel115 12-30-2014 03:32 PM

I say => DO NOT SWAP (At least I wouldn't do.)
Limit your squid cache size, but do not swap.

swapping will kill the performances of your server.


If you don't believe me, try it, and you will understand my words.

Squid is like a child, the more you'll give him the more it will take.
Show him who is the BOSS. :tisk:

johnsfine 12-30-2014 04:05 PM

Quote:

Originally Posted by angel115 (Post 5292875)
I say => DO NOT SWAP (At least I wouldn't do.)
Limit your squid cache size, but do not swap.

I can't tell whether that advise is based on what you might know about squid (which I will assume is more than I know) or based on what you think you know about swapping (which I'm quite confident is more than you actually know).

Servers using swap space is not generally a bad thing. Even major use of swap space in not necessarily a performance problem. Limiting swap space or swappiness to less than your system should have, can significantly reduce performance.

I have quite a lot of swap space configured, and in some cases used, on the Linux systems for which I make those decisions. My decisions in those cases are quite well supported by evidence, unlike the common bias against swapping seen in this forum. I would not extrapolate from my experience to a server on which the major memory usage is squid, because I don't know enough. So I won't claim to know you are wrong. I just think the OP should be warned that you sound like you are repeating commonly held incorrect views.

angel115 12-31-2014 03:29 AM

Hi Johnsfine,

Thank you for your well formulated contribution to this answer.

Few years back I did experience this issue as well, and I notice that squid swapping was making the IO going up as hell.
After tuning up squid on "what should be cached" and what should not, I reduce the cache size.
Doing so, I've seen a significant performance improvement.
Tuning squid cache is not easy but you'll get much better performances at the end.


But you are right with one point here, I do not have enough information to say that hack back shouldn't use SWAP. Maybe he got some SSD, in that case it might not heart too much (although I never tried this configuration).

But at the end of the day (in my opinion "and by experience", and it seems that by the squid team as well) SWAP usage should be use with caution as performances WILL suffer. (see my quote below)


Quote:

If you have a low memory server, and a large disk, then you will not necessarily be able to use all the disk space, since as the cache fills the memory available will be insufficient, forcing Squid to swap out memory and affecting performance. A very large cache_dir total and insufficient physical RAM + Swap could cause Squid to stop functioning completely. The solution for larger caches is to get more physical RAM; allocating more to Squid via cache_mem will not help.
Ref: http://wiki.squid-cache.org/SquidFaq/SquidMemory

Regards,
Angel.


All times are GMT -5. The time now is 08:01 AM.