Versions Compared

Key

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

...

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. all Admin requests go to MASTER
  2. all Front READ requests go to SLAVE
  3. all Front WRITE requests go to MASTER
  4. all Front Search READ go to MASTER

 

To enable load balancing:

  1. add $_CONFIG['Database']['LoadBalancing'] = '1'; to /system/config.php file
  2. create /system/db_servers.php file with following content: 

    Code Block
    <?php 
    
    $_CONFIG['Databases'] = Array ( 
        Array ( 
            'DBHost' => 'slave.host1', 
            'DBUser' => 'slave.user1', 
            'DBUserPassword' => 'slave.user.password1', 
            'DBLoad' => 1, 
        ), 
        Array ( 
            'DBHost' => 'slave.host2', 
            'DBUser' => 'slave.user2', 
            'DBUserPassword' => 'slave.user.password2', 
            'DBLoad' => 1, 
            'DBMaxLag' => 15, // optional, slave replication delay in seconds 
            'DBMaxThreads' => 100, // optional, when slave thread count is above  this number, then it won't be used 
        ), 
    ); 
  3. only Slave Servers are listed in file above, since database server defined in /system/config.php is considered as Master Server for backwards compatibility. 

...