Splitting out to have the database in its own server

Splitting out to have the database in its own server

by Tammy Moore -
Number of replies: 8

Our Moodle kept up reasonable well with demand last year, but growth and peak demand is pushing us to the need to get our database on its own server. I have never done that before, so I am not sure what I should be in  the market for for the size and power we will need and how much RAM it is likely to need.

Right now we have a 2 TB, 4 core, 32 GB RAM LAMP stack and Moodle 2.9. Moodle is the only thing on it. We have 11,00 accounts all new within the last year to year and a half with 3,000 being added in the last month. 

For the second server for the database we also will be going with a quad core. The RAM is very customizable. Is there usually a sweet spot and then after that you get less and less performance for the dollar or does it scale well and every dollar you spend you just keep on getting a big increase? 

Of course I am hoping for a blow my socks off increase in performance, but in reality what performance increases have you found with having the database on its own server? Will it be very noticeable?

Average of ratings: -
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Paul Verrall -

IMHO your priorities should first be CPU cores and disk performance. More cores and some SSD will return the most gains. I'd hazard a guess that 32GB of RAM would be MORE than enough... just make sure you configure you database process to actually use it.

Average of ratings: Useful (1)
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I am not saying that getting a second server for a database is a bad idea... it's usually a good idea.   But... how did you establish that the database is the "pinch point" on your system? If it isn't then you'll be very disappointed.

Average of ratings: Useful (1)
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Michael Aherne -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

If it's a MySQL database, the main benefit of lots of RAM is the ability to configure the database to use it to buffer your data (innodb_buffer_pool_size). Ideally, you want enough RAM to be able to hold your entire database in memory, but once you achieve that, the benefits of adding more RAM will tail off, so that's kind of the sweet spot. The problem with that is that it's not fixed - you need to either build in some spare for the future, or make sure you can add more when your database gets bigger.

Average of ratings: Useful (1)
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Usman Asar -
Picture of Plugin developers Picture of Testers
Tammy, are you sure it's just a 4-core CPU and not with Hyper Threading?
32-GB RAM is way more than required to run moodle even with this many users, rather than setting up another box, just have a look first what is bottle necking your current build, most likely it would be drive speed killing the performance, if I would have been in your place, then cheapest, quickest and effective solution would be adding another SSD Drive to system, and shift the database to that drive, that will bring marginal improvement over system's performance, and depending upon the size of the drive, you can as well shift the temp folder to SSD Drive.
Average of ratings: Useful (1)
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Ken Task -
Picture of Particularly helpful Moodlers

Others have given good advice.   Suggest running tuner on your server to see what it might say in a couple of areas:

What does it say for:

[OK] Maximum reached memory usage:
[OK] Maximum possible memory usage: 

and the item the display of the above two ....

[OK] Overall possible memory usage with other process is compatible with memory available

There is also a section in InnoDB Metrics.

Number of users that have accounts doesn't necessarily equate to the number of users actually logged on *and* doing something.  So what other data does one have that indicates splitting out the DB onto another server will increase performance/solve issues?

While there are things one can choose/do to make sure the speed of a dedicated DB server is optimal, that setup still involves networking ... before the application.  That becomes a piece of the puzzle when things go south (if they do go south) and could involve other things not considered.   In the past, as an example,  it was thought by some that a fiber channel connection was needed (web -> DB server) to get max speed ... but Cat 6 wire now-a-days thought good enough to handle it ... IF not 20 hops away (as an example).

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Tammy Moore -

Thanks for the replies. I had requested some server optimizations with our dedicated server extended support plan and in the request was to get OPcache enabled (already installed, just needed the lines it added to php.ini to be uncommented and switch to fcgi so it would have a handler it could work with). I got the reply all was done and when the site was still so slow at peak, I felt there was no more that could be done. We did figure out that the OPcache was not yet on. We got it enabled properly last Friday. I had heard that it would speed things up Moodle by 2x to 3x times, but at peak it really feels more like it was a 10x gain. That is one useful tool to get on a busy site!

So, we are keeping up with demand now and will not need to resort to splitting the database out to get a performance boost just yet.


Now to figure out why we are starting to get Internal server error pages here and there for the last few days - One course will not load and a few less important pages are turning up with it. I am beginning to wonder if the server side troubleshooting will ever end. It is a bit like digging in sand. You shovel out one thing and it is replaced by something else. I have really learned a lot since moving to Moodle 2.9 and it has actually generated an interest in learning more about the server side of running a Moodle site - IF I can eek out more time than I have had so that I can learn it right and not just piecemeal here and there at least to get solid foundations under me.   :0)

Average of ratings: Useful (1)
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi Tammy

If I understood correctly, you managed to take enough load out of the server just by activating Opcache. No second server (for the database) was necessary. Still the problems are not completely solved, you still get "internal server error"sporadically. Right?

Invest the time you won on a systematic approach. For a start tell us more about the server. So far I know it is a "2 TB, 4 core, 32 GB RAM LAMP stack and Moodle 2.9". What Linux distribution and what version? What is installation tutorial followed?

Also, what are the "some server optimizations" you've requested from the hosting provider. It might save some communication problems, if they would participate in this discussion! Ask them to first go through the starting pointers in the header of this forum: https://moodle.org/mod/forum/post.php?forum=94. (Yes, you need an account on moodle.org to see the full thing.)

Also you said: "Moodle is the only thing on it. We have 11,00 accounts all new within the last year to year and a half with 3,000 being added in the last month." Possibly you meant 11,000 accounts?
In reply to Tammy Moore

Re: Splitting out to have the database in its own server

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well... what's in the logs for the internal server error?