Top Banner
Scaling MySQL with HAProxy April 23-25, 2018 @ Percona Live Laurent Kolakofsky SRE
9

Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down

Jul 28, 2018

Download

Documents

vungoc
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down

Scaling MySQL with HAProxyApril 23-25, 2018 @ Percona Live

Laurent KolakofskySRE

Page 2: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down

Scaling challenges

Two facets of scaling:

● Performance scaling : query rate & traffic growth

● Operation scaling : maintenance increase

Page 3: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down
Page 4: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down
Page 5: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down

Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports:

1. Achieved via HaProxy backend option: on-marked-down shutdown-sessions

HAProxy Frontend Port

MySQL Port

Main Pool members

Backup Pool members

Gracefulness1 Use case

<$port>3306

<$port>3306

All non-lagging slaves

Only master

let live Apps business critical and not tolerant to replication lag

Not tolerant to disconnection

1<$port>13306

kill connectionTolerant to disconnection

2<$port>23306

All slaves (lagging)

let live Apps tolerant to replication lag or not business critical

Not tolerant to disconnection

3<$port>33306

kill connectionTolerant to disconnection

Page 6: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down
Page 7: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down

HAProxy high availability

How do applications connect to HAProxy?

● Multi-host jdbc url, for example: jdbc:mysql:loadbalance://[host1],[host2]...

● Consul DNS: DNS records are returned based on HAProxy health-check

Page 8: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down

Pros & Cons

● [+] Load balance reads across healthy MySQL replicas

● [+] Pseudo quality of service (QoS)

● [+] Ensure replicas serving traffic are not lagging

● [+] Fast take in/out of rotation mysql backends for manual maintenance

● [-] Harder to track connections

● [-] Requires some client side tweaking or some tolerance to disconnection.

Page 9: Scaling MySQL with HAProxy - percona.com · Pseudo Quality of Service (QoS): a set of MySQL servers is accessible via 4 distinct ports: 1. Achieved via HaProxy backend option: on-marked-down

Q & A