Multiple Moodles on one server

Multiple Moodles on one server

Spiros Mitropoylos -
回帖数:16

Hello there,


I want to setup a server with about 20 different moodle installations. No more than 5 users for each installation will connect concurrently. In each instance newbie admins will log in to test moodle's functions and may break something.


What is the best strategy to follow for this type of setup? E.x. each installation with it's own database and db user? Maybe docker is better for each moodle instance? What are the hardware specs the server should have at minumum approximately?


Sincerely,

Spiros Mitropoylos

回复Spiros Mitropoylos

Re: Multiple Moodles on one server

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

Yes - you can do that. It's easiest to have each completely separate. You don't say what operating system you will be using, but something like...

/var/www/html/moodle1
/var/www/html/moodle2
/var/www/html/moodle2
...and so on

/var/moodledata/moodle1
/var/moodledata/moodle2
/var/moodledata/moodle3
...and so on

...and likewise for the databases. Name everything sensibly.

20 installations with 5 concurrent users is much the same thing as a single installation with 100 users. Without more details of what they will be doing, the server OS etc. it's impossible to say. It's not an insignificant number though. 

I'm unfamiliar with Docker so can't comment on that

回复Howard Miller

Απάντηση: Re: Multiple Moodles on one server

Spiros Mitropoylos -
Thank you for your answer Howard.

The host OS is Ubuntu server. I was thinking going for FreeBSD with jails but It's too much pain I think for my purpose.

5 concurrent users per moodle installation is almost the worst case scenario but I'm working with this to be sure.

Do you have any suggestion for the HTTP server? Apache - Nginx or something else? Memcache will help or the users will have to clear the cache every time they make a change?

I'm trying to make the best possible strategy to be sure for the high availability of my setup.

Thank you
回复Spiros Mitropoylos

Re: Απάντηση: Re: Multiple Moodles on one server

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像

If your users don't have access to the server itself (only Moodle) then I can't see any benefit using Jails or even VMs for this. 

Moodle needs to cache *somewhere* regardless - it will use the disk by default. Unless you know your disk IO to be fast then a proper cache server is a good idea but you will need a separate instance for each Moodle (I think). 

Moodle runs successfully on both Apache and Nginx. It probably comes down to the one you are most familiar with. I hear a lot of good things about Nginx with Moodle so given a free choice that might be the one to go for. 

A lot of people talk about high availability but there are always single points of failure that you have no control over. Make sure you have a decent backup regime!

回复Howard Miller

Re: Multiple Moodles on one server

Charles McCoy -

Howard Miller, 

Have you tried the install as you explained? I was just wondering if it works well over time.(with adding several courses, quizzes, scorm, etc.) 

thanks



回复Charles McCoy

Re: Multiple Moodles on one server

Rick Jerz -
Particularly helpful Moodlers的头像 Testers的头像

I have tried the technique that Howard explains, and it works well over time.

The only thing that I wonder about is what affect multiple courses have on opcahe, since multiple moodles might point to the same cache.  In my past experience, there doesn't seem to be any problem, but I have wondered about this.

回复Rick Jerz

Re: Multiple Moodles on one server

Leon Stringer -
Core developers的头像 Particularly helpful Moodlers的头像

Rick: As far as I know OPcache indexes scripts by their full path so multiple sites can use the same cache with no clash. The thing to watch is that opcache.memory_consumption and opcache.max_accelerated_files would normally need increasing to accommodate the additional sites. Check the Used Memory and Cached Scripts stats in PHP info to see if these need increasing.

回复Leon Stringer

Re: Multiple Moodles on one server

Rick Jerz -
Particularly helpful Moodlers的头像 Testers的头像

Thanks for your reply, Leon.

I have opcache.memory_consumption = 128, and opcache.max_accelerated_files = 8000.  The moodle docs recommendation is 128 and 2000.  I am not sure why I increased the accelerated_files to 8000.

In my "info.php" output, I see that Used Memory is at 18,272,800 and that Cached scripts is "1".

Well, any more advice?  Should I double the 128 to 256?  It appears that the Used Memory is about 18MB out of 116MB free memory, with 0 wasted memory.  I am not sure if Cached Scripts = 1 means that only my one moodle right now is using opcache, and that this would go to 2 if I were to install another experimental moodle.


回复Rick Jerz

Re: Multiple Moodles on one server

Leon Stringer -
Core developers的头像 Particularly helpful Moodlers的头像

The docs page for 3.4 says 8000 for opcache.max_accelerated_files so that sounds right to me.

Cached scripts under the Zend OPcache heading in PHP info is the number of cached PHP scripts for all sites, so this number should be in the thousands, a value of 1 sounds like something is not quite right.

In terms of tuning these values for multiple sites you need to watch the Cache hits and Cache misses. Hits should be a lot larger than misses (say 10×). If it's not you can check Free memory to see if this has all been used and increase opcache.memory_consumption as needed. But each server will be different depending on the individual sites and increasing this too much may reduce memory for other services on the server.

We can maybe break this out into a separate forum thread if there's more info required.

回复Leon Stringer

Re: Multiple Moodles on one server

Rick Jerz -
Particularly helpful Moodlers的头像 Testers的头像

Okay Leon, now I know where I got the 8000.

Here is a screenshot of exactly what php info shows for my Opcache.  I am running my moodle on a VPS, so maybe that is why some of my opcache information might look strange.  I am far from an experienced server administrator, so I am still learning.

附件 opcache.jpg
回复Rick Jerz

Re: Multiple Moodles on one server

Leon Stringer -
Core developers的头像 Particularly helpful Moodlers的头像

That doesn't look right to me. I read that as OPcache has cached a single .php script out of a whole Moodle site (or sites). For comparison here's the status for my test site with just me logged in (PHP 7.1):

OPcache status from PHP info

Cached scripts is over a thousand which is what I'd expect to see. I'm using Apache with the default PHP handler (not FPM), I don't know if that has any effect on what OPcache does.

Is your max_accelerated_files 8000? Because that should make Max keys 16229 (the Moodle Docs explain why). If this is the case maybe the settings aren't being picked up?

回复Rick Jerz

Re: Multiple Moodles on one server

AL Rachels -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像

One thing mentioned by Leon, that might not leap off the page at you, is that Zend Opcache is running for the WHOLE server. In other words, my main server has eight Moodle sites, plus some other types of sites running on it. Zend Opcache is taking care of ALL of them as shown by my monitoring script. This means that depending what you have on your server, 128M memory and 8000 for opcache.max_accelerated_files, might not be the optimum sizes to use. You might need to make both number bigger. And, it definitely pays to use one of the monitoring scripts that Ken provides the link to, so you can see at a glance what's going on.

I have one archived sever set to 12,000 files and when I turn it on and let it run a few hours for various types of testing, it winds up caching over 11,000 files, as it has every Moodle from 1.9 to 3.3 installed on it.

回复Spiros Mitropoylos

Re: Multiple Moodles on one server

Usman Asar -
Plugin developers的头像 Testers的头像
Consider Docker for 50+ installations, 20 are easy manageable.
for 100 concurrent you dont need a high powered server, even 4 core 4GB RAM will do perfect, just keep drives with high IOPS at least for databases.
回复Usman Asar

Απάντηση: Re: Multiple Moodles on one server

Spiros Mitropoylos -

Hello Usman,


I was thinking about Docker because of the simplisity of backing up every installation and restoring it.

回复Spiros Mitropoylos

Re: Multiple Moodles on one server

Ken Task -
Particularly helpful Moodlers的头像

As Howard and Usman has told you ... doable ... but I've a question for ya ... more like food for thought/strategy/planning ...

Full featured version 3.2 with Annotation and Unoconvert and Search?

Anno and Uno will require installation of libreoffice ... Uno would be shared resource.

Search will require a separate solr index for each site.

Even with only 5 users at the most?

The real 'Devil' (lots of times) is in the details. ;)

'spirit of sharing', Ken

回复Spiros Mitropoylos

Re: Multiple Moodles on one server

Dashamir Hoxha -

I know this is a late answer, but just for the records (in case someone else comes accross the same question), I would recommend you to use this containerized Moodle: https://github.com/docker-scripts/moodle

In my opinion it is quite easy to manage and also very scriptable (which is important when you have large quantities).

However I am not sure about the minimum hardware specs of the server for 20 moodle sites, since each container is going to have its own apache and mysql processes. If you manage to factor out mysql to its own container (used by all the moodle containers), and if you fix apache configs to spawn only 1 or 2 idle processes, maybe a 4GB RAM server will be quite OK for 20 containers.