Forum Stats

  • 3,769,358 Users
  • 2,252,956 Discussions
  • 7,874,999 Comments

Discussions

Can mysqlrouter be load balanced?

user619241
user619241 Member Posts: 17 Blue Ribbon
edited Jul 21, 2020 10:36AM in MySQL Community Space

I'm trying to figure out how to achieve mysqlrouter HA. Can multiple mysqlrouter be load balanced?

For cluster resilience, should I create mysqlrouter instance on the same compute instance the MySQL instance is installed? Or should I create separate mysqlrouter compute instance?

Thanks,

- Xinhuan

Best Answer

  • Dave Stokes-MySQL Community Team-Oracle
    Dave Stokes-MySQL Community Team-Oracle MySQL Community Manager TexasMember Posts: 366 Employee
    edited Jul 21, 2020 9:06AM Accepted Answer

    Place the MySQL Router on the same platform as the application. Applications connect to MySQL Router and not directly to MySQL Server, and if the connection fails then applications are designed to retry the connection because MySQL Router selects a new MySQL server after failed attempts. This is also called simple redirect connection routing because it requires the application to retry the connection. That is, if a connection from MySQL Router to the MySQL server is interrupted, the application encounters a connection failure. However, a new connection attempt triggers Router to find and connect to another MySQL server. When a server is no longer reachable, MySQL Router moves to the next server destination in the list and circles back to the first server destination if the list is exhausted as per the round-robin strategy.

    Dave Stokes

    MySQL Community Manager

Answers

  • Dave Stokes-MySQL Community Team-Oracle
    Dave Stokes-MySQL Community Team-Oracle MySQL Community Manager TexasMember Posts: 366 Employee
    edited Jul 21, 2020 9:06AM Accepted Answer

    Place the MySQL Router on the same platform as the application. Applications connect to MySQL Router and not directly to MySQL Server, and if the connection fails then applications are designed to retry the connection because MySQL Router selects a new MySQL server after failed attempts. This is also called simple redirect connection routing because it requires the application to retry the connection. That is, if a connection from MySQL Router to the MySQL server is interrupted, the application encounters a connection failure. However, a new connection attempt triggers Router to find and connect to another MySQL server. When a server is no longer reachable, MySQL Router moves to the next server destination in the list and circles back to the first server destination if the list is exhausted as per the round-robin strategy.

    Dave Stokes

    MySQL Community Manager

  • user619241
    user619241 Member Posts: 17 Blue Ribbon
    edited Jul 21, 2020 10:36AM

    Hello Dave,

    If the number of application instances (for example, Apache HTTPD process), are over 100, does it mean mysqlrouter has to be deployed 100 times to all compute instances hosting Apache HTTPD process? Or is there a separate computing instance only hosting mysqlrouter? What if the computing instance hosting mysqlrouter needs maintenance and go offline?

    Thank you,

    - Xinhuan