Preferred php handler for large moodle site

Preferred php handler for large moodle site

by Farhan Karmali -
Number of replies: 8
Picture of Core developers Picture of Plugin developers Picture of Testers

Hi everyone

We have a fairly large moodle instance , with around 6000 active users each month. Our server configuration is also very high  like we have 128 GB RAM, 24 cores CPU etc. However we still suffer performance issues and not mainly due to concurrent users, Our server is not able to handle downloading of builtin Moodle reports that have alot of data in them , (Example bulk downloading users from a particular country etc), Also we face performance issues on other moodle pages.

I have been trying to read about performance recommendations of Moodle from https://docs.moodle.org/28/en/Performance_recommendations however since I am not much of a server guy , I am not sure I understand them completely,

Our apache is configured to use php handler suphp . My reading suggested that this will not let us use opcache , is that true? What is the preffered php handler for running a large moodle instance , we are on cent os 6.7 . Also do we need memcache or is opcache sufficient. I do understand the questions are too generic but I just want to understand few basics.

Any help will be much appreciated

Average of ratings: -
In reply to Farhan Karmali

Re: Preferred php handler for large moodle site

by Usman Asar -
Picture of Plugin developers Picture of Testers

Karmali, for this large installation, ideally you must have a separate box for database, fastest PHP Handlers as I am aware of on Apache are mod_php (Apache's own) and FastCGI, where FastCGI has added benefit of security like suPHP does, but at the cost of highest memory usage in all PHP handelers, at the same time lower CPU usage as compared to suPHP , but as you are already on 128G's, so shouldn't be an issue with you, also so far only FastCGI can support PHP accelerators like APC, OpCache etc, and speaking of OpCache, it does brings LOTS of performance improvements.

if it would have a windows server, i would have been in better position to assist you, Wondering why no one has replied where 95% of the community is Linux driven.

In reply to Farhan Karmali

Re: Preferred php handler for large moodle site

by Ken Task -
Picture of Particularly helpful Moodlers

Might want to read this blog:

https://www.chriswiegman.com/2011/10/fastcgi-vs-suphp-vs-cgi-vs-mod_php-dso/

"best comparison"?   Will leave that to others to comment upon but it does explain some things.

One of 'catch22's' for folks who are on shared systems is suPHP.   After reading the above blog post, me thinks for your implementation, suPHP will just get in the way.

Think someone mentoned in a another posting some where in these forums, about Linux distro's not having PHP 7 (reportedly better than previous versions) it doesn't mean one can use other repos that are reputable 3rd party providers of packages not yet offered by the distro.    CentOS is of the RedHat 'family' and mimics RedHat Enterprise (without the RH eye candy and RH repos).   RedHat has been traditionally 'conservative' and slow to provide upgrades to 'latest and greatest'.   This is because, I think, they put stability over 'latest and greatest'.   CentOS will require reputable 3 rd party repos for some things ... like PHP.   Until RH and thus CentOS and the rest of the RH family 'moves upwards'.

Too bad there aren't more K12 people in here ... 6000 a month is close to what some K12 implementation of a Moodle would do in a day.   K12 with 'bring your own device' + 1:1 (students issued laptops/tablets to use just like textbooks) and that has a Moodle, that Moodle will get used ... period.   Most courses in  such a Moodle are either blended or 'flipped' and those approaches do make a difference on usage of Moodle and when thus a k12 Moodle will get more hits in a day than implementations for a corp or even some higher eds - those are asynchronous ... not synchronous.

So some of the decision about what and how much needs to be base on projected use.   Better understanding of how it will be used leads to better decision making.

My 2 cents ... of course!

'spirit of sharing', Ken

In reply to Farhan Karmali

Re: Preferred php handler for large moodle site

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Opcache is used for storing compiled PHP scripts and storing them in memory, thus saving disk and compiling operations. Definitely worth having and I find using a monitor helps to understand what's happening, see http://www.stevejenkins.com/blog/2014/07/my-favorite-zend-opcache-status-scripts/ for some examples.

memcached is used for storing variables and other data outputs into memory, rather than reading from the db or a file cache. Also worth having, though the default file cache is often just fine.

We're looking at using PHP7, and from my own tests we noticed a significant improvement in performance - don't have the numbers to hand, but it was about twice as fast.

That's the web side of things, then there's the database. As someone noted, it's worth having the db on a separate server. You're going to have to play with the settings for the DB to get the best config for your server and expected usage. It's a bit of trial and error.

With regards to reports, I think the OU operate a separate webserver especially for reports, something I'm considering doing at some point. This allows you to have slightly separate configurations like longer timeouts and more memory allocation to cope with the harder work, but without messing up everyone else.

In reply to Mark Sharp

Re: Preferred php handler for large moodle site

by Usman Asar -
Picture of Plugin developers Picture of Testers

Mark, as i am aware, OU has 10 load balanced nodes, with Master / Slave for DB on PostgreSQL, haven't heard  about reporting server separate, Tim has to confirm about that.

In reply to Mark Sharp

Re: Preferred php handler for large moodle site

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

That is not quite accurate about the OU. What we actually do is:

  • Of our 11 web servers, 8 are for requests coming from outside the OU campus, that is almost entirely student and tutors viewing web sites, so they are all really quick requests.
  • The other 3 are for requests coming form on campus, which includes all the really slow things like backup and restore and big reports that can tie up a server for a while.

This seems to give more consistently faster response for people off-campus.

Also, it makes it easy to monitor the performance our students are seeing, without all the slow staff requests obscuring the graph.

In reply to Tim Hunt

Re: Preferred php handler for large moodle site

by Mark Sharp -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Thanks for clarifying - you had written up something about this some time ago, I was recalling from memory.

In reply to Mark Sharp

Re: Preferred php handler for large moodle site

by Farhan Karmali -
Picture of Core developers Picture of Plugin developers Picture of Testers

Thank you everyone 

These replies where very helpful , hopefully we will switch go a separate database server for better performance 

In reply to Farhan Karmali

Re: Preferred php handler for large moodle site

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It is worth being precise. There are two separate concepts here:

  • Performance: how fast your Moodle site can display one page (when it is not doing anything else).
  • Scalability: how many different pages your Moodle site can display at the same time (simultaneous users) before performance gets really, really slow.

Moving the database on another server is likely to make performance worse (since every database query now has to travel across a network connection). The point is that it makes scalability much, much better. And, if you do it right, it does not make performance on a single request much worse.