Linux Crash Course - Understanding Memory and Swap Usage

preview_player
Показать описание
The "Linux Crash Course" series (formerly known as the "Linux Essentials" series) tackles important concepts around Linux, one video at a time. In this episode, we'll take a look at understanding memory and swap usage.

## This video was sponsored by Linode:

*Support Learn Linux TV*
Note: Commission may be earned for any and all links presented here.

*⏰ TIME CODES*
00:00 - Intro
03:40 - The free command
12:11 - Understanding swap
14:49 - Should you disable swap and not use it?
16:57 - Adjusting how often swap is used (Swappiness)*🎓 FULL LINUX COURSES FROM LEARN LINUX TV*

*🌐 LEARN LINUX TV ON THE WEB*

*⚠️ DISCLAIMER*
Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. Always make sure you have written permission before working with any infrastructure and that you are compliant with all company rules, change control procedures, and local laws.

#Linux #LearnLinux #LinuxTutorial
Рекомендации по теме
Комментарии
Автор

Can't thank you enough for explaining the memory swap subject! Over 3 years using Linux as my daily driver I still found myself closing browsers, shutting down my virtual machines, even rebooting to address it (even with 32gb of ram). I now have the confidence to tackle this and really make use of my rig!

rudyleplane
Автор

Hi Jay! Your videos are a godsend. As a career changer and a sort of a late-starter in IT, your content is pure gold to me. This video helped me fit some pieces better in place and I feel more confident with this topic now. Thank you so much!

krernertok
Автор

I LOVE the way you and DJ Ware cover these kinds of topics- a great blend of more advanced topics that are useful for home desktop users as well as server and enterprise admins. I'm a compulsive tinkerer and videos like these help me learn ways to satisfy my tinkering/ optimization addiction.

walter_lesaulnier
Автор

i've always wanted to learn how this works. thanks so much for uploading!

StrikerEureka
Автор

I like this format where you go through tools and features individually with their own videos. It works better for me than longer more wide-ranging videos.

Thanks for the helpful content!

christopherjackson
Автор

All about data handling. The whole IT field rest on that. Thanks Jay for readjusting this in my brain. Your content is a brain saver.

ferdwinfondong
Автор

I've always included a swap file on distributions I've installed. Now, there is a different type called a page file. In the Windows world, the difference is a page file is dynamicly allocated as needed up to the limit you set, whereas a swap file is a static size. Page files are more disk management efficient because it only takes up as much space as it needs. But, contiguous space is not assured, which can really hurt performance.

My first experience with paging and swapping was in 1985 on a VAX 785, where idle procecess would be swapped out to allow higher priority and active interactive processes access to memory (all 2 megabytes of it).

We were running VMS 3.4, and the system administrator made the swapper a lower priority than he should have. The VAX (which serviced the 28, 000 undergrad and graduate student population - even if you weren't a student that had a reason for an account, you had an account) was freezing. After about 3 days of troubleshooting, it was found that the swapper was swapping itself out to the page file. When something is paged out, it is put in a sleep state until the swapper swaps it back into memory. Well, if the swapper is put to sleep, how is the swapper going to swap itself back in? The system admin pit the swapper back at the hiest priority so it would never be swapped out.

Thank you for reading my war stories of my leading a time sharing system.

kellingc
Автор

This is the best vid I've seen on the science of memory and use of swap!

thatfilm
Автор

I have an old original Raspberry Pi with 256 MB ram and 64 MB allocated to GPU. It runs headless and has Apache server installed along with ssh, dlna server, network scanner server and a vnc server. A desktop is installed. I very rarely need the desktop so both it and vnc server are disabled and only started if required. I did enable 512MB of swap as I think this may be needed when I do run the desktop and vnc server.

I do have more modern Pi devices but old faithful has server me well and continues to do so.

sendgl
Автор

Great intro to the topic, but would love a deep dive into memory.

devbites
Автор

I use swappiness on my machines to limit the swapping to my SSD. I'd love to hear your take on swappiness, and recommendations.

TomeOfKnowledge
Автор

The reason too the free is lower than available is the buff/cache. The latter being alot like a RAM disk, but is changeable depending on memory demands.

Matt
Автор

In the scenario of hosts behind a load balancer, I would rather avoid swap slowness all together, and quickly remove that host as it stops taking requests reaching memory limitations, that I would see request latency increase, especially if your application is set to backoff/retry behind the scenes. This is the best argument against it imo, its not just about disk space being cheap.

progpogs
Автор

Thanks. Nice clear explanation. Simple enough to understand.

janleroux
Автор

"free -h" is the best readable for noobies like me :)

toweliethetowel
Автор

Excellent content, thanks. In regard to allocating storage for swap-space, maybe you can elaborate on this: When a laptop is put to sleep/suspended I thought that the OS writes the contents of RAM to swap-space and back the other way when the laptop is awakened. So, in that use-case wouldn't a sufficient amount of swap be necessary? Sleep/suspend isn't relevant to servers/workstations but maybe it's worth mentioning.

reptilicusrex
Автор

Once again you have helped me to better understand a Linux topic, esp swap. Thank you so much!

Not-THAT-ChrisPratt
Автор

oh my. You nailed it, good explanation

testaccount-xlki
Автор

Even though it may cause slowing down the server, any swap is better than no swap, especially running a database aplication. 30+ years of experience suggests that. Cheers, .

mrmfloy
Автор

Thanks for the video. Unfortunutely, my server uses swap because of the analysis dependencies. I have more than enough space, ram and storage but the analysis sometimes oversteps to swap.

drcemdede