mlepage
Posts: 95
Joined: Tue Jun 12, 2012 1:58 am

Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 1:56 am

I've been experimenting for a week with using the Raspberry Pi 3 as my desktop, using the latest (Sep 2017) Raspbian. As you can imagine, the challenges are limited CPU, and low (1 GB) RAM.

I am keeping htop running in a terminal so I can monitor the CPU usage of all 4 cores, and also the memory usage and swap available.

Raspbian is using a desktop environment based upon LXDE, which I understand is already fairly optimized. My main concern is Chromium. I need some browser tabs for Gmail, Google docs, Twitter, etc. I find even with just a half dozen of these tabs open, I suffer small freezes, lags (e.g. I can type a sentence before it appears onscreen), and memory woes.

I already went out and got a Samsung Evo Plus 64 GB microsd card, and clocked it up to 83 MHz, which improved my read and write speeds. I'm hoping trying a different RPi 3 might help me get to 100 MHz there. And I put my swap up to 1 GB from the default 100 MB (otherwise I was getting severe lockups).

I understand for CPU usage, I can overclock and add cooling and a better power supply, to ensure it's stable. I'm working on that.

But memory usage seems to be the biggest concern. I can wait a bit for the CPU to catch up, but I can't manufacture more memory. (Need an RPi with 4 GB RAM!)

So what are ways I can help alleviate this? Simple ways, such as settings I can change. Or more radical ways? Is there a way I can cluster two RPi 3s together to share their RAM?

Any tips would be appreciated, links to posts too, I'm willing to read.

cjan
Posts: 712
Joined: Sun May 06, 2012 12:00 am

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 2:04 am

give up 64G sdcard, get a SSD driver.
increase swap-file and set gpu_mem=256 for Desktop using.

mlepage
Posts: 95
Joined: Tue Jun 12, 2012 1:58 am

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 2:11 am

So an SSD through USB? Will that be faster? What's the fastest MB/s I could get for read/write, assuming a sufficiently fast SSD? (I have an OCZ Vertex 2 I could use.)

cjan
Posts: 712
Joined: Sun May 06, 2012 12:00 am

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 2:22 am

mlepage wrote:
Tue Oct 03, 2017 2:11 am
So an SSD through USB? Will that be faster? What's the fastest MB/s I could get for read/write, assuming a sufficiently fast SSD? (I have an OCZ Vertex 2 I could use.)
Rpi3 can boot from USB, or boot from a small used sdcard and SSD for rootfs.
all data bus are the same(share), but i think SSD faster a bit than sdcard.

mlepage
Posts: 95
Joined: Tue Jun 12, 2012 1:58 am

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 2:44 am

Understood. My OCZ Vertex 2 is apparently around 250 MB/s. The SD card maxes out at 40 MB/s (interface limitation). So it could be faster, but not that fast, because USB 2 itself is limited to 60 MB/s, but I'm reading that practical limit is only about 40 MB/s. And it's a shared bus. :-(

Really need an RPi 4, with typical Chromebook specs: 4 GB RAM, wifi ac, and an improved GPU.

cjan
Posts: 712
Joined: Sun May 06, 2012 12:00 am

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 2:52 am

mlepage wrote:
Tue Oct 03, 2017 2:44 am
Really need an RPi 4, with typical Chromebook specs: 4 GB RAM, wifi ac, and an improved GPU.
it is said, there is Asus tinker board (off topic).

klricks
Posts: 6506
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 2:58 am

mlepage wrote:
Tue Oct 03, 2017 1:56 am
....
Raspbian is using a desktop environment based upon LXDE, which I understand is already fairly optimized. My main concern is Chromium. I need some browser tabs for Gmail, Google docs, Twitter, etc. I find even with just a half dozen of these tabs open, I suffer small freezes, lags (e.g. I can type a sentence before it appears onscreen), and memory woes.
The RPi is not intended to be a desktop replacement. Half a dozen tabs open is a lot. 2 or 3 may be OK depending on what the pages are doing.
mlepage wrote:
Tue Oct 03, 2017 1:56 am
I already went out and got a Samsung Evo Plus 64 GB microsd card, and clocked it up to 83 MHz, which improved my read and write speeds. I'm hoping trying a different RPi 3 might help me get to 100 MHz there. And I put my swap up to 1 GB from the default 100 MB (otherwise I was getting severe lockups).
Do all in your power to keep from going into swap mode. It's 'game over' if the RPi is swapping.
mlepage wrote:
Tue Oct 03, 2017 1:56 am
I understand for CPU usage, I can overclock and add cooling and a better power supply, to ensure it's stable. I'm working on that.
It's not advisable to OC a RP 3 at all. Cooling does not help OC unless the CPU is getting hotter than 80C where throttling occurs.
mlepage wrote:
Tue Oct 03, 2017 1:56 am
So what are ways I can help alleviate this? .Simple ways, such as settings I can change.
Changing the gpu merory split may help in some cases.
mlepage wrote:
Tue Oct 03, 2017 1:56 am
Or more radical ways? Is there a way I can cluster two RPi 3s together to share their RAM?.
NO not with a RPi.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

mlepage
Posts: 95
Joined: Tue Jun 12, 2012 1:58 am

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 3:39 am

Thanks guys.

I removed the CPU usage monitor from the LXDE top panel, and instead added the resource monitor, which can graph CPU and memory usage, so I could keep an eye on it. (Maybe that should be default.)

I'll try gpu_mem=256 for a while and see how it goes. (Default is 64.)

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5789
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 10:40 am

Increasing GPU memory won't help, unless you're using it for HW video decoding or OpenGL (ES). If anything, it will hurt performance of chromium.

I don't think having more than a few tabs open in a browser on a pi is going to be a good experience any time soon. You could try using a lighter browser, like midori or netsurf. With the optimization mozilla is working on, if it carried over to ARM, firefox might be a contender eventually.

rainer.brito
Posts: 33
Joined: Tue Aug 22, 2017 1:55 pm

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 11:54 am

Hi,

I am using a Rpi3 as my main computer, basically as a desktop replacement.
The point is: what do you expect from a desktop?

If you expect from it much more than "getting the job done", maybe a Rpi3 would frustrate you... As many people say: Rpi is not a powerhouse, is not a ultra gaming-desktop class pc, is not a mid-range notebook and so on.
It is a very nice and impressive SBC that can "do the job".

So you need to find a way to "get the job done" with Rpi3. In my case, I do basic and complex writing (Markdown, LibreOffice), I do some vector image manipulation (mostly Inkscape), surf the web, some casual gaming (Rpi ports and emulation), watch some movies (youtube works great when Chromium HW acceleration is working).
But to be "okay" with mt Rpi3 I had to change my habits: less chromium tabs, less open apps, etc... I think you should start from there; from a UNIX philosophy to the core: one task at once. Start and finish each task before starting another one. The truth is that, in general, we have an illusion that we can (and we need) to do a plenty of things at the same time when in front of a computer. And we actually cannot. Multitasking is much less human than it seems to be.

I do not agree that Asus Thinker Board is really that better: it has very bad software performance. With much less power and resources the Rpi3 (with raspbian) still wins. From a desktop/end-user view, we never benefit from pure harware use, no?

dukla2000
Posts: 190
Joined: Tue Jan 10, 2012 12:02 am
Location: Reading.UK.EU

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 11:06 pm

I ran my Pi3 as my only PC for 18 months with no major issues.

Never had a problem with dtparam=sd_overclock=100 for my 64G Evo+ - are you sure yours is genuine? Must be threads here that I have posted in test result numbers. Especially random small file writes. Personally I preferred to keep the USB ports for other things (like BT & DVB dongles) and at least avoid contention at the USB bus by maxing out my use of the SD card (which, UIAVMM is not on the USB bus).

Always ran gpu_mem_1024=64 - was fine for my plain usage with no games other than solitaire (mainly libreoffice, email, browsing, TV, gnucash)

Used midori - was less of a memory hog than Chromium and more stable (as in about 1 more tab open). I know this is contentious but it is my experience! Had to keep a close eye on memory though (I use gkrellm) to make sure was not swapping. Half a dozen tabs is pretty much the limit (if not beyond) though even for midori.

I have always used lightdm/openbox, quite a bit lighter on memory than most other stuff I have used, even LXDE.

Have recently defected to 3Gb RAM & aarch64 - pining terribly for omxplayer though :D
Daily driver: Pi3B, 64GB Samsung Evo+ @100MHz, DVB-T, onboard WiFi for internet, BT/USB dongle for KB/mouse, 250GB HDD via USB for media, Raspbian Jessie Lite with Openbox desktop.
Museum: Pi B

Heater
Posts: 12976
Joined: Tue Jul 17, 2012 3:02 pm

Re: Using Pi as Desktop, how to manage RAM?

Tue Oct 03, 2017 11:12 pm

Good grief. "How to manage RAM ?"

Well, if you only have a gigabyte of RAM. Don't go using it for a dozen Chrome tabs running some of the most heavy weight web apps in history.

How easy could it be?

Jason_25
Posts: 120
Joined: Tue Oct 20, 2015 6:25 pm

Re: Using Pi as Desktop, how to manage RAM?

Wed Oct 04, 2017 1:46 am

Chromium - For some of us just being able to compile it would be a miracle. Look into what it takes to compile it and see if your attitude does not change. Understand that Raspbian attempts to make everything "just work" and that all you had to do was pay a nominal fee for the Pi itself for the privilege of having all Linux software at your fingertips. The rest of us that do not choose to use Rasbian just take punishment after punishment. You are a lucky individual in reality to run (6!) tabs. Imagine how many decades or even centuries it would take to create something on the order of Chromium by yourself. Then imagine there are people like myself who are simply incapable of doing so even if given an eternity.

Gmail - you can just use Claws-mail. See my mini review here:
viewtopic.php?f=63&t=193364&p=1211760&h ... s#p1211760

Google Docs - use Openoffice instead.

Twitter - seems like a lightweight enough webpage but they likely have an API that some lightweight open source program is using so no reason to keep a tab open for that one either.

Hopefully these changes will allow you to be one of those people that do not have a web browser open all the time.

GPU memory set to 32MB should be sufficient also. Things will not slow down if the memory is too low. They will simply crash and you can Google the error message and determine the cause was low VRAM. When you have that little RAM it would be crazy to give so much of it to a really slow GPU anyway. Also If you use a 64 bit OS like myself that GPU is never going to be used anyway so you might as well reduce the memory split as much as possible!

mlepage
Posts: 95
Joined: Tue Jun 12, 2012 1:58 am

Re: Using Pi as Desktop, how to manage RAM?

Thu Oct 05, 2017 2:32 am

Thanks for all the tips. Trust me I'm not new to computers or to Linux. What I was most interested in, was people's experience running the Pi as desktop and advice for doing so, which a few of you have provided.

I'd be curious to know if Chromium has any settings which can be tweaked. As it happens, I would be fully capable of building Chromium from scratch, and I do know people who work on Chromium for a living. I know that ultimately the answer is, it's hard to make features that work on all the platforms, are secure, are fast, and use low memory. It's just a hard problem, I get that.

My Samsung Evo Plus (different from Evo+?) only seems to want to go to 83.3 MHz. Otherwise, it boots a bit but stays at black screen when it should go to desktop. I got it from Best Buy, so I assume I was just unlucky to get one that has difficulty clocking to 100 MHz. I guess even still I'd be limited to about 40 MB/s read and 20 MB/s write, and less for random 4K writes.

Maybe I should invest in a little bare bones PC. Still deciding.

User avatar
stefanv
Posts: 36
Joined: Wed Oct 19, 2016 12:08 pm
Location: Ontario, Canada
Contact: Website

Re: Using Pi as Desktop, how to manage RAM?

Thu Oct 05, 2017 5:52 pm

I use my Pi as a laptop replacement (A Compact Home-Made Raspberry Pi Tablet), and have tweaked a few things to get the most out of it.
  1. Overclocked the SD card, a Lexar 300x 32GB UHS-1 class 10 card, using dtparam=sd_overclock=100 in /boot/config.txt
  2. Set gpu_mem=32 in /boot/config.txt.
  3. I'm using control groups to limit memory usage of Chromium, as it was generally Chromium that locked up the system. To do this, I did the following:
    1. sudo apt-get install cgroup-bin
    2. inserted cgroup_enable=memory in /boot/cmdline.txt
    3. created /etc/cgconfig.conf:

      Code: Select all

      group browsers {
          memory {
              memory.limit_in_bytes = "384M";
              memory.soft_limit_in_bytes = "256M";
          }
      }
      
    4. created /etc/cgrules.conf:

      Code: Select all

      # user:process                                  subsystems      group
      my-user-id:/usr/bin/chromium-browser            memory          browsers
      
  4. installed the xTab plugin for Chromium to limit the number of open tabs (so I don't go too far by accident)
Stefan Vorkoetter: Programmer, hobbyist, amateur watchmaker, pilot, and collector of fountain pens, slide rules, calculators, and watches.

Return to “General discussion”