Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet262/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   258   259   260   261   262   263   264   265   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

[
 200 
]
Then, we can use the 
mkswap
 command to convert this file into an actual 
swap
 file:
sudo mkswap /swapfile
Now, we have a handy-dandy 
swap
 file stored in our root filesystem. Next, we'll need 
to mount it. As always, it's recommended that we add this to our 
/etc/fstab
 file. 
What follows is an example entry:
/swapfile   none   swap   sw   0 0
From this point, we can activate our new 
swap
 file with the 
swapon
 command that I 
mentioned earlier:
sudo swapon -a
Now, the 
swap
 file is active and in use. While I certainly hope you won't need to 
resort to using swap, I know from experience that it's only a matter of time. Knowing 
how to add and activate swap when you need it is definitely a good practice, but for 
the most part, you should be fine because, by default on most platforms, you'll have 
swap created for you when setting up Ubuntu for the first time during installation. If 
you do need to create it manually for whatever reason, I always recommend a bare 
minimum of 2 GB on servers, but if you can manage to create a larger one for this 
purpose, that's even better.
How much swap is being used is something you should definitely keep an eye on. 
When the memory starts to get full, the server will start to utilize the 
swap
 file that 
was created during installation. It's normal for a small portion of swap to be utilized 
even when the majority of the RAM is free. But if a decent chunk of swap is being 
used, it should be investigated (perhaps a process is using a larger than normal 
amount of memory).
You can actually control at which point your server will begin to utilize swap. How 
frequently a Linux server utilizes swap is referred to as its swappiness. By default
the 
swappiness
 value on a Linux server is typically set to 
60
. You can verify this with 
the following command:
cat /proc/sys/vm/swappiness
The higher the 
swappiness
 value, the more likely your server will utilize swap. If 
the 
swappiness
 value is set to 
100
, your server will use swap as much as possible. 
If you set it to 
0
, swap will never be used at all. This value correlates roughly to the 
percentage of RAM being used. For example, if you set 
swappiness
 to 
20
, swap will 
be used when RAM becomes (roughly) 80 percent full. If you set it to 
50
, swap will 
start being used when half your RAM is being used, and so on.


Chapter 8

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   258   259   260   261   262   263   264   265   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish