Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Hello everyone, Imported from: http://groups.google.com/group/in-portal-dev/browse_thread/thread/b6afcc5108850e64#

We are looking to have the ability to run In-Portal website in Database Load
Balanced environment. It's usually necessary for high load/availability
websites.

The idea is to have MASTER/SLAVE(s) configuration. This will separate
WRITE/READ database requests between 2+ servers (1 Master and 1+ Slaves
replicated from Master).1.

  1. all Admin requests go to MASTER

...

  1. all Front READ requests go to SLAVE

...

  1. all Front WRITE requests go to MASTER

...

  1. all Front Search READ go to MASTER

To enable load balancing:1.

  1. add $_CONFIG['Database']['LoadBalancing'] = '1'; to /system/config.php

...

  1. file

...

  1. create /system/db_servers.php file with following content: 

    Code Block
    <?php

...

  1.  
    
    $_CONFIG['Databases'] = Array

...

  1.  ( 
        Array ( 
            'DBHost' => 'slave.host1',

...

  1.  
            'DBUser' => 'slave.user1',

...

  1.  
            'DBUserPassword' => 'slave.user.password1',

...

  1.  
            'DBLoad' => 1,

...

  1.  
        ), 
        Array ( 
            'DBHost' => 'slave.host2',

...

  1.  
            'DBUser' => 'slave.user2',

...

  1.  
            'DBUserPassword' => 'slave.user.password2',

...

  1.  
            'DBLoad' => 1,

...

  1.  
            'DBMaxLag' => 15, // optional, slave replication delay in

...

  1.  seconds 
            'DBMaxThreads' => 100, // optional, when slave thread count is above

...

  1.  this number, then it won't be

...

  1.  used 
        ),

...

  1.  
    ); 

...

  1. only Slave Servers are listed in file above, since database

...

  1. server defined in /system/config.php is considered as Master Server for

...

  1. backwards compatibility. 

See http://www.mediawiki.org/wiki/Manual:$wgDBservers for more details.

Most likely this functionality will be added to In-Portal 5.2.0, but has
been tested on 5.1.3 Beta2 - so can be applied if needed.

Task: 576: Separating Database Master/Slave Requests

Jira LegacyserverIn-Portal Issue TrackerserverId126bf1dc-b574-3522-8c14-3dd94dfb9de1keyINP-457

Attaching patch developed by Alex and  and tested by myself on 1 Master and 3
Slave servers.
Additional  Additional tests highly recommended and appreciated.
DA  

db_load_balancer_v2.patch

Related Tasks

Jira Legacy
serverSystem Jira
serverId513b375f-8291-3313-9d9f-704c39b1f915
keyINP-457