Linux Swap Memory Question


Recommended Posts

I am using Ubuntu 16.04 LTS. I have 4 gigs of ram on this ultrabook using intel core i7 3rd gen duel core ( since its laptop not quad core i7 ) tax tubo speed 3.0 ghz.

 

Anyways question is for ram. My ram when system idle is not maxed out however when I just just a few applications like google earth  , some browser tabs my ram maxes out and then goes to swap. 

I thought 4 gis of ram would be more than enough since I read linux is fairly resource light. It sees though I need more ram than for my swap to be always being used when I just have google earth open and a few browser tabs open and maybe a word processor document open. Since the system has to use swap memory ( it is the memory of last resort ) and it always seems to use another 3 gigs of swap.

Anyways else running linux with 4 gigs  of ram and having this issue or not having this issue? I am happy with Ubuntu I actually got all my tweaks worked out, graphics drivers etc. Other distros like linux mint wouldn't even install .

Link to comment
Share on other sites

Hmm. Seems like Mint, even the MATE Edition, would have been fine on that one. Weird. And that's more than enough ram for everything.

 

Are you using Firefox? That one is an absolute pig on memory. Nobody's really using it anymore, most of the time we just install Google Chrome and call it good. It's way better with memory management.

 

You might also want to consider using Zram. It's swap memory but it uses ram for swapping before your disks. It's also compression, so it'll turn whatever you allocate into an additional 25~50% of swapspace. Think of it this way: you allocate 1gb of ram to Zram. It'll compress that 1gb into 1.25 (at minimum) gb of swapspace, and since it's in ram it's WAY faster than disk-based swap. It's smart, too. Whatever the system isn't going to use within that 25~50% margin, it'll tune itself slightly but not overly so. I use it myself, and I've got 8gb of ram. I've fed Zram 4gb of system memory and tuned it (via config) to always compress at 50%, so I've effectively got 10gb of ram before the system will resort to using disk-based swapspace. There's a slight bit of processor overhead (1-3% on my Athlon x2 245), but it has never affected my gaming or College use (Word Processing, Browser-based research, etc) or anything. Zram should be enabled by default, in my opinion.

 

That should fix, or at least help somewhat. Google Chrome and Zram. Instructions for enabling Zram are actually in a post I wrote in the Tips & Tricks thread I've contributed to a little over a year ago. You can find that post here. I hope it's straightforward enough, and it's still relevant. The instructions were originally for Ubuntu 14.04, btw, and they still work. All you'll need to do is restart your machine. :) 

 

As far as installing Google Chrome, well, that's your choice if you do or not. We're all about choice in the Linux world. :yes: I've found it to be much lighter, more responsive, and all-around better on 'nix.

 

Good luck, and let us know how it turns out. I highly suggest reading the documentation about Zram, especially the Archlinux Wiki entries. Highly educational if you need to tune it. :yes: 

Link to comment
Share on other sites

UPDATE: Sorry for the late response as I currently have been working a lot of over time these few weeks and have not been able to log on.

Anyways I found out google earth it taking 2 gigs of ram or more when I use it. I am using the browser Opera and that uses about 1 gig of ram with just 3 tabs open. With nothing open Ubuntu 16.04 LTS uses about 800 megs of ram.

Seems like Google earth is the huge memory eater and Opera is 2nd. I may give Chrome a try but I have been happy with Opera and I hear Chrome spies on you since its google.

I tested Google earth in Windows 10 ( same laptop since I dual boot ) and it only uses up 1 gig of ram and Opera only uses up about 500 megs of ram. 

Maybe these programs in Linux are not as memory efficient?

I will check out Zram on the weekend if I can get  a day off work. Thanks for your detailed response.

  • Like 1
Link to comment
Share on other sites

Only Opera is open with 1 tab and Google earth and look how much ram is being eating up. In Windows it was only using 2.1 gigs with opera and google earth open. 

I know Linux reads ram different than Windows but when it is using SWAP memory I know that the Linux system is low on memory.

 

Screenshot from 2017-01-25 17-30-47.png

Link to comment
Share on other sites

No worries. We all have lives.

 

Linux is usually better on memory than Windows, by a lot. Especially Windows 10, I've seen that one chew up 2-3gb without blinking at it, then looking at me like ".... wut?". At least with 'nix, I know where it's going.

 

And yeah, give Zram a spin. Your system should deal with things better. Opera is a known memory hog, and btw it's not supported anymore (sadly). Try Google Chrome. It's quite bulletproof on 'nix. They actually have to backport it to Windows, believe it or not. Make sure to export your bookmarks first, preferably to an .html file for compatibility.

 

Any questions, just give me a holler here or in a PM. I'm always happy to help, and I get email notifies on a PM. :yes: I'll get to ya the next time I'm on my rig the next day. Just ask @Mindovermaster, been helping him via PM for well over a year now.

  • Like 1
Link to comment
Share on other sites

1 hour ago, Unobscured Vision said:

I'll get to ya the next time I'm on my rig the next day. Just ask @Mindovermaster, been helping him via PM for well over a year now.

He tells the truth! :p

Link to comment
Share on other sites

  • 2 weeks later...
On 1/26/2017 at 5:37 AM, Boo Berry said:

Ubuntu 17.04 is going to be ditching swap partitions on non-LVM installations, in favor of swap files.

Swap files? Interesting .. must be some sort of loopmounted shenanigans going on. They aren't going to be as fast as Zram ... ;) 

Link to comment
Share on other sites

  • 2 months later...
On 1/26/2017 at 5:46 AM, Unobscured Vision said:

And yeah, give Zram a spin.

if browser downloads a lot of multimedia stuff, zram makes swapping more severe, because zipped video/audio takes more space than original ones. + zram pounds cpu + system could be less stable.

On 1/26/2017 at 5:46 AM, Unobscured Vision said:

Opera is a known memory hog, and btw it's not supported anymore (sadly). Try Google Chrome. It's quite bulletproof on 'nix.

if you really want to save memory, you need ad blockers. but they have side effect: web page could become fully unworkable + many www's have used ad-blocker detection.

Link to comment
Share on other sites

14 minutes ago, SarK0Y said:

app runs faster at the least than browser.

You're using the same internet to use either one...

Link to comment
Share on other sites

11 minutes ago, Mindovermaster said:

You're using the same internet to use either one...

network the same, but browser runs scripts, app is binary code. just check utube videos in browser & smplayer ==>> smplayer gobbles definitely less cpu + ram.

Link to comment
Share on other sites

I'd use zswap instead of zram. They both try to achieve something similar but while zram just creates a compressed swap on RAM and swaps everything there, zswap is a bit more smart and only swaps to the compressed RAM when compression is good enough. Data with poor compression will still be swapped to disk.

 

Also when (if) you run out of RAM swap space with zram you'll start swapping to disk, meaning that chances of most active pages being written and read from the slower memory will increase.

Zswap on the other hand will write the least recently used pages to disk if the compressed RAM swap gets too big, so you are more likely to still be swapping to the fastest swap.

Link to comment
Share on other sites

18 hours ago, ichi said:

I'd use zswap instead of zram. They both try to achieve something similar but while zram just creates a compressed swap on RAM and swaps everything there, zswap is a bit more smart and only swaps to the compressed RAM when compression is good enough. Data with poor compression will still be swapped to disk.

yea, 'tis better way, but mostly the largest share to download is video/audio, thereby compression just gobbles cpu & ram/swap for temp data.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.