摘要

Replication is widely adopted in modern Internet applications and distributed systems to improve the reliability and performance. Though maintaining the strong consistency among replicas can guarantee the correctness of application behaviors, however, it will affect the application performance at the same time because there is a well-known trade-off between consistency and performance. Many real-world applications favoring performance often choose to enforce weak consistency. Although there has been some work on flexible configuration of consistency, most focuses on design or deployment time. As the system settings constantly change during runtime, the tuning of the consistency-performance trade-off needs to be handled dynamically. Failing to do that will cause either underestimation or overestimation of the consistency and performance that can be achieved. Existing work does not well support the dynamic tuning of the aforementioned trade-off in runtime, which is mainly because of the lack of an appropriate quantitative model of consistency and performance. In this work, based on our previous effort on the quantitative model of consistency and latency, we design a replication protocol, CC-Paxos, to achieve an adaptive trade-off between consistency and performance according to application preferences and runtime information. By design, CC-Paxos is not bound to any specific underlying data stores. We have implemented CC-Paxos and applied it to MySQL databases. And real experiments both within a data center and across data centers show that CC-Paxos not only can dynamically adjust the delivered consistency in return for ensured performance but also outperforms MySQL Cluster in the case of strong consistency guarantee.