Running Gentoo linux on B2

How are you using your Bubba Two or Excito B3? Got pictures? Share here!
Post Reply
paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Running Gentoo linux on B2

Post by paulchany » 07 Jan 2016, 05:53

Hi,

I'm running Gentoo linux on my Bubba 2.
This is the oldest revision of B2 I think.

Following Sakaki's advices ( thanks Sakaki ) I have now set up my home LAN and wifi LAN too.
https://github.com/sakaki-/gentoo-on-b2

I have a web server apache2 on this B2, reachable at http://cspl.hu
This is just a simple web site so far, with only one index file. I plan to set up apache2 web server to uses SSL only; after that I wish to install emacs-webserver, because it is fast and I think it should run fast on my B2 too.

I tried these days to install on it Moodle but can't use it; I get message like: 'Not enough resources'. So I think B2 is to slow for Moodle.

I wish to know whether can I use my B2 only for web, mail server, and maybe for owncloud? For what services is approppriate B2 for?

However, I plan to set a home network so so B2 will be a router between mine internet connection and LAN, and set B2 up to 'port forward' HTTP traffic to my Raspberry Pi 2 ( with external USB hard drive ) which ( Pi 2 ) would have (only) an address on my LAN.

On that Raspberry Pi 2 would then I install the Moodle. I expect max. 20-30 users on this Moodle site only.

What do you think about this plan?
Best, Pali

Gordon
Posts: 1289
Joined: 10 Aug 2011, 03:18

Re: Running Gentoo linux on B2

Post by Gordon » 08 Jan 2016, 03:42

Don't know Moodle, but it appears to be running on PHP. Did you read the install manual for it? Chances are they want you to use specific minimal settings in PHP that are higher than the defaults. The message may also be misinforming and it could be something like missing timezone setting in PHP.

Don't own a B2, so also don't know how much memory is in it. Is it 512M like in the B3? It should be able to run everything the B3 does then, likely only a bit slower. Which can become a problem earlier when the number of users increase. Of course much depends on the services you allow them to use. Apache is quite stressful on our little machines, but it is great for its extensions that allow you to do stuff that other web services don't. Running Emacs (I like Nginx myself) should help relieve things, but will require trickery to serve dynamic content. I have one of my B3's serving the Bubba web UI through Nginx and it is truly snappy compared to the one running Apache.

Yes the Pi will help for offloading the traffic to your Moodle site. I run a similar environment here, only I use two B3's for it. The front end machine serving static content and acting as a proxy to the backoffice machine serving dynamic content. This will sometimes cause an HTTP 500 when the backoffice machine gets overloaded, but doesn't bring everything to a full stop like would be the case if you ran all from the same machine.

paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: Running Gentoo linux on B2

Post by paulchany » 08 Jan 2016, 04:13

My B2 has:

Code: Select all

free -m
_______total__used__free__shared__buff/cache__available
Mem:___247____64____6_____25_______176_______138
Swap:__1023____77__946

that is 247 M of the memory.
What are its consequences in serving Moodle that is indeed running on PHP?
However, on my Moodle site there will be just a few pupils ( 10-15 ) out there.
Best, Pali

Gordon
Posts: 1289
Joined: 10 Aug 2011, 03:18

Re: Running Gentoo linux on B2

Post by Gordon » 08 Jan 2016, 06:36

Okay, so that will be half the amount of memory from the B3, with PPC apparently shaving off some of the memory for internal use. Apache reserves ~128M for each running instance (12 default) but most of them will consume less than 10M. MySQL will also reserve over 100M, but it will also really consume some 80M. This will definitely cause you to lean heavily on swap and impact performance.

As you can see file cache is quite aggressive, using more than 70% of internal memory and pushing more than half of your applications' memory usage to swap. Your freemem is also smaller than used to be set in the original Bubba OS as minimum for some applications to be able to start at any given time. For improved stability you may therefore want to investigate the next two sysctl tweaks.

This is from the original Bubba OS:

Code: Select all

# This settings increase the allocable memory which is required for
# certain applications that needs to be able to allocate more than
# the default limit

vm.min_free_kbytes = 8192
And this is what I use to make swapping less aggressive on my own B3s.

Code: Select all

vm.swappiness=20
vm.vfs_cache_pressure=200

paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: Running Gentoo linux on B2

Post by paulchany » 08 Jan 2016, 07:09

I create the file:
/etc/sysctl.d/local.conf
and put into it:

Code: Select all

vm.swappiness=20
vm.vfs_cache_pressure=200
then I reboot B2 and issue:

Code: Select all

free -m
_______total__used_free_shared__buff/cache_available
Mem:____247___47__101___15________98_______166
Swap:__1023____0__1023
It seems that that the situation is a little better now, right?
The command:

Code: Select all

sysctl -a
shows me all the values currently available
( just don't know where to find the meaning of these variables ).
Best, Pali

Gordon
Posts: 1289
Joined: 10 Aug 2011, 03:18

Re: Running Gentoo linux on B2

Post by Gordon » 08 Jan 2016, 09:00

File cache will build up over time, as applications will receive memory from the kernel when they start to use it. You'll need to run it for some time to be able to draw any conclusions from these tweaks. Did you also add the "vm.min_free_kbytes" value?

With regards to the meaning of all the sysctl values I can only say that google is your friend. There's just too many of them and some can influence each other. Some of them may be better for workstations, some for file servers and some for application servers.

vm.swappiness has a default value of 60. By setting it to 20 I'm telling the kernel to give a higher priority to applications wanting memory than file cache. 20 is what I consider to be sane in my environment, but you might find that an even lower value works better in your situation.

vm.vfs_cache_pressure has a default value of 100. By setting it to 200 I tell the kernel to try harder reclaiming memory from file cache. If I'd set this value to zero, the system would never reclaim memory from cache, which could be good if I wanted to use the system strictly as a NAS (but might also cause Samba authentication to become ridiculously slow)

Detailed information on al the vm settings here: https://www.kernel.org/doc/Documentation/sysctl/vm.txt

paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: Running Gentoo linux on B2

Post by paulchany » 08 Jan 2016, 09:42

I add also vm.min_free_kbytes:

Code: Select all

vm.swappiness=10
vm.vfs_cache_pressure=200
vm.min_free_kbytes=10000
reboot and

Code: Select all

free -m
_______total__used__free__shared__buff/cache__available
Mem:___247____43____95___16_________108______151
Swap:_1023_____0__1023

Now I see that there is less free memory out there: instead of 101M now I have 96M. So maybe the value '10000' is not the best value, right?
However, I'll run it for some time to draw my conclusions.
Best, Pali

Gordon
Posts: 1289
Joined: 10 Aug 2011, 03:18

Re: Running Gentoo linux on B2

Post by Gordon » 08 Jan 2016, 13:33

vm.min_free_kbytes takes care that the amount of free memory never drops below the set value for more than a few milliseconds. Which means that with normal usage your applications should never receive an out of memory signal. That your freemem dropped is because either the running applications requested that additional memory or file cache did.

paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: Running Gentoo linux on B2

Post by paulchany » 17 Jan 2016, 13:35

Well, it seems that that I must to set up Nginx so so my Moodle site looks better.
http://www.cspl.hu/moodle/

What could missing in my setup?

I think I found an answer here:
https://docs.moodle.org/dev/Install_Moo ... nx/PHP-fpm
In the Moodle administration, disable 'slash arguments' (http://YOURMOODLESITE/admin/search.php? ... shargument). Without disabling the 'slash arguments', you may notice that the admin setup page is missing the images and css styling. However, if you turn off slash arguments, then other things won't work, so really someone ought to work out what is wrong here and fix it.
Best, Pali

paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: Running Gentoo linux on B2

Post by paulchany » 24 Jan 2016, 14:37

Hi,

I have finally setup Moodle with Nginx webserver on my Bubba 2.
I'm using nginx with php-fpm and XSendfile to speed up my Moodle site:
http://cspl.hu/moodle
It is still slow.
Should I use memcached to speed it up a little?
Or should I connect to my Bubba 2 an external USB HDD to install on it Gentoo system so the internal HDD not to be used at all because maybe this speed up Bubba 2 too?
Best, Pali

paulchany
Posts: 123
Joined: 10 Jul 2009, 15:48
Location: Serbia
Contact:

Re: Running Gentoo linux on B2

Post by paulchany » 29 Jan 2016, 07:02

Hi,

I think Bubba 2 can't serve a Moodle site because of it's small RAM ( just 256 MB of RAM ) and it's weak CPU:
Architecture: ppc
CPU op-mode(s): 32-bit
Byte Order: Big Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
Model: MPC8313ERDB
BogoMIPS: 66.66
L1d cache: 16K
L1i cache: 16K

So I think Bubba 2 is capable to serve as a small web-, mail server, a router, a gateway. What do you think about this?
Best, Pali

Gordon
Posts: 1289
Joined: 10 Aug 2011, 03:18

Re: Running Gentoo linux on B2

Post by Gordon » 01 Feb 2016, 07:19

I think maybe the fact that moodle requires mySQL as a backend may be overdoing it. It's precisely for this reason that I set out to eliminate mySQL in my Gentoo port of the Bubba UI.

Post Reply