Load Balancing

Load Balancing

by Hiroki Inoue -
Number of replies: 8
Hello folks.

I work for private university in Japan as part time lecturer. And the school tries to implement Moodle as Course Management System with 38000 FTE. We are exploring the way to load balance Moodle installation to meet high load. But the budget is limited. We think the way to load balance the servers are;

1. Use Round Robin DNS for multiple front end web servers and huge DB server.
2. Use software load balancer for front end web servers.
3. Use hardware based load balancer << it's pretty expensive and not affordable for us.

Are there any problem to use #1? or what is your recommendation for load balanced Moodle installation. Also in case #2, which load balance software is recommended. I'd like to know which one is actually used for clustered Moodle servers.

Thanks in advance for your advise.

Hiro from Japan
Average of ratings: -
In reply to Hiroki Inoue

Who are you really and where do you really work?

by Paul Shew -
Hello Hiro.

I noticed in your profile that you say you work at Aoyama Gakuin University. Well, I'm in charge of the only Moodle installation that I'm aware of at Aoyama Gakuin, and I don't know who you are.

I also noticed that you've registered MoodleJapan.com hosted by and sharing the same physical address as Sakura Internet (http://sakura.ne.jp). It seems that you're using it to sell Moodle hosting and services, but I also notice that you're not a Moodle Partner. And, I hear that you've been warned about trademark infringement regarding your offering of Moodle services at MoodleJapan.com.

I'm just beginning to look into this situation and it could all be some kind of a mixup. But these are a raising a lot of red flags for me. Please feel free to contact me directly.

Paul Shew
Assistant Professor, Aoyama Gakuin University
Kirisutokyo.jp Administrator
http://Kirisutokyo.jp
In reply to Hiroki Inoue

Re: Load Balancing

by Paul Shew -
I just got off the phone with Prof. Hiro Nakahara who teaches part-time at Aoyama Gakuin University, and he apparently did not know about Moodle or this post. He is full time faculty at Saitama University.

In reply to Hiroki Inoue

Re: Load Balancing

by Paul Shew -
Nakahara-san,

I noticed that you've changed your profile this morning, and you now introduce youself as a "project member of Mobile learning project at Aoyama Gakuin University and exploring the way to make Moodle keitai-friendly." I'm interested in learning about this project, and talking with you about Moodle at Aoyama Gakuin. Would you please contact me? You can call me at extension 12755 or dail-in 03-3409-6537. もちろん、日本語で結構です。

シュー
In reply to Paul Shew

Re: Load Balancing

by Johnny Chung -

Paul,

I wold like to know if anyone has setup Moodle in a Load Balanced environment on a DMZ Network with internal private IP Addresses.

I have setup Moodle system with Load Balancing, but I encountered some problems because of the variable "$CFG->wwwroot" in the configuration file.

1. If I put internal IP Address in the configuration file, I cannot acces from the external network.

2. If I put external IP Address in the configuration file, I cannot access from the internal network.

My setup envionment:

1. DB Server: 192.168.0.245 (db.dmz.mydomain.net)

2. NFS server: 192.168.0.248 (nfs.dmz.mydomain.net) (For storing MoodleData)

3. Webserver 1: 192.168.0.246 (moodle1.dmz.mydomain.net)

4. Webserver 2: 192.168.0.247 (moodle2.dmz.mydomain.net)

5. Moodle Internal URLhttp://moodle.dmz.mydomain.net (192.168.0.250) (Load Balanced with: 192.168.0.246 and 192.168.0.247)

6. Moodle External URL: http://moodle.mydomain.net (xxx.xxx.xxx.250) (Load Balanced with: 192.168.0.246 and 192.168.0.247)

I have attached the chart of my setup if you need more detail in visual.

Please let me know if you know a anyway to set the variable "$CFG->wwwroot" in the configuration file so that I can access the site both in the Internal and External network.

Regards,

JC

 

In reply to Johnny Chung

Re: Load Balancing

by Timothy Takemoto -
I really have no idea (and the purpose of my post is to ask you a question), first of all, how about using apache's mod_rewrite, to make the two URLs equivalent?

http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Canonical URLs
Description:
On some webservers there are more than one URL for a resource. Usually there are canonical URLs (which should be actually used and distributed) and those which are just shortcuts, internal ones, etc. Independent of which URL the user supplied with the request he should finally see the canonical one only.

Solution:

We do an external HTTP redirect for all non-canonical URLs to fix them in the location view of the Browser and for all subsequent requests. In the example ruleset below we replace /~user by the canonical /u/user and fix a missing trailing slash for /u/user.

RewriteRule ^/~([^/]+)/?(.*)      /u/$1/$2 [R]
RewriteRule ^/([uge])/([^/]+)$   /$1/$2/ [R]

Oh and there is even an even more complex rewrite rule for

Webcluster through Homogeneous URL Layout

Description:

We want to create a homogeneous and consistent URL layout over all WWW servers on a Intranet webcluster, i.e. all URLs (per definition server local and thus server dependent!) become actually server independent! What we want is to give the WWW namespace a consistent server-independent layout: no URL should have to include any physically correct target server. The cluster itself should drive us automatically to the physical target host.

But I am not sure if that is relevant, and in any case you know all about this and I do not.

What I wanted to ask is, when using a load balanced arrary do you necessarily have any problem with session data? Do you have to use
BecomeRoot
???

Pardon my ignorance.

In reply to Timothy Takemoto

Re: Load Balancing

by Johnny Chung -

Hello Timothy,

Thank-you for your reply. Unfortunately I am not very familiar with Apache rewrite module, so that can't do me much help. But I did read something about the rewrite module has some problems reading and writing files from NFS share. Let me know if I am wrong.

On my settings, I use the NFS share to store the "moodledata", so both servers share same moodle sessions. Eventually, I would like to store all Moodle system files on a NFS share also, so that I only need to change once to take affect on all the servers. I am still testing...

I found a solution to my own problem, is that I use the PHP server Env variable "SERVER_NAME or HTTP_HOST" on the Moodle configuration file.

example:

$MYROOT = $_SERVER['HTTP_HOST'];

$CFG->wwwroot   = 'http://'.$MYROOT.';

This way, it doesn't matter where the end user accessing from, the system will be able to resolve the host properly. But, somehow it seems that it decreases the performance with this setting. I am not very sure why, but I am still testing.

If anyone know why or have a better way implementing Load Balancing on Moodle system please kindly let me know.

Thanks all.

 

In reply to Johnny Chung

Re: Load Balancing

by michele slocovich -
I think the suggestion you made:

$MYROOT = $_SERVER['HTTP_HOST'];

$CFG->wwwroot = 'http://'.$MYROOT.'';


should be made as default or, at least, included within config.php as an example.
indeed it is useful, not only within cluster, but for standalone servers for which httpd.conf servername is not exactely the one for which all users shall reach it, as well as for multihomed machines, and during migration processes....

i can't figure how it could harm, hence i'd think of suggesting it for being default....

cheers
mike

In reply to michele slocovich

Re: Load Balancing

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
i can't figure how it could harm, hence i'd think of suggesting it for being default....

It harms! Really smile Moodle builds lots of absolute URLs from this value. And they have to be absolute. So using something like this, you could have, say, half of your content only available from inside your network ('couse your using private non-routable IPs) and the other half only availavle from outside.

The real answer to this problem is using a DNS name that resolves to the right IP each time (the internal one when you are inside your network, and the public one when you are outside it).

Saludos. Iñaki.