Is it possible to do load balance between database hosts in laravel read & write connections?

113 Views Asked by At

From the laravel doc Read & Write Connections, laravel can isolate read statements (SELECT) and write statemets (INSERT, UPDATE, and DELETE) with below config.

'mysql' => [
    'read' => [
        'host' => [
            slave1,
            slave2,
        ],
    ],
    'write' => [
        'host' => [
            master,
        ],
    ]

In my site the write operation is much less than read operation. And the master instance has 8C16G hard while the slave1/2 has 4C8G.

So it's a waste of hardware resource to make the master instance only response the write operation.

Is it possible to add some balance weight among the master and slave instance to response the read opration?

0

There are 0 best solutions below